1147 - Initial auto mappings pass

This commit is contained in:
modmuss50 2019-05-26 12:37:59 +01:00
parent 48198dbcb3
commit 4e03ac893c
291 changed files with 3335 additions and 3504 deletions

View file

@ -25,9 +25,9 @@
package techreborn.world;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraftforge.fml.common.IWorldGenerator;
import net.minecraft.world.chunk.ChunkManager;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry;
import techreborn.TechReborn;
@ -51,11 +51,11 @@ public class OilLakeGenerator implements IWorldGenerator {
public static int rareity = 30;
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
public void generate(Random random, int chunkX, int chunkZ, World world, ChunkGenerator chunkGenerator, ChunkManager chunkProvider) {
if (!enable) {
return;
}
if (!world.getDimension().isSurfaceWorld()) {
if (!world.getDimension().hasVisibleSky()) {
return;
}
if (random.nextInt(rareity) != 0) {

View file

@ -24,19 +24,19 @@
package techreborn.world;
import net.minecraft.block.trees.AbstractTree;
import net.minecraft.block.sapling.SaplingGenerator;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.chunk.ChunkManager;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.AbstractTreeFeature;
import net.minecraft.world.gen.feature.NoFeatureConfig;
import net.minecraftforge.fml.common.IWorldGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import javax.annotation.Nullable;
import java.util.Random;
public class RubberTreeGenerator extends AbstractTree implements IWorldGenerator {
public class RubberTreeGenerator extends SaplingGenerator implements IWorldGenerator {
boolean isWorldGen = true;
@ -46,7 +46,7 @@ public class RubberTreeGenerator extends AbstractTree implements IWorldGenerator
@Nullable
@Override
protected AbstractTreeFeature<NoFeatureConfig> getTreeFeature(Random random) {
protected AbstractTreeFeature<DefaultFeatureConfig> createTreeFeature(Random random) {
return null;
}
@ -180,7 +180,7 @@ public class RubberTreeGenerator extends AbstractTree implements IWorldGenerator
}
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
public void generate(Random random, int chunkX, int chunkZ, World world, ChunkGenerator chunkGenerator, ChunkManager chunkProvider) {
}
}

View file

@ -26,14 +26,13 @@ package techreborn.world.feature;
import java.util.Random;
import java.util.Set;
import net.minecraft.block.state.IBlockState;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.EnumFacing;
import net.minecraft.block.BlockState;
import net.minecraft.tag.BlockTags;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.IWorld;
import net.minecraft.world.gen.feature.AbstractTreeFeature;
import net.minecraft.world.gen.feature.NoFeatureConfig;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import techreborn.blocks.BlockRubberLog;
import techreborn.init.TRContent;
@ -41,13 +40,13 @@ import techreborn.init.TRContent;
* @author drcrazy
*
*/
public class RubberTreeFeature extends AbstractTreeFeature<NoFeatureConfig> {
public class RubberTreeFeature extends AbstractTreeFeature<DefaultFeatureConfig> {
//TODO: Configs
private int treeBaseHeight = 5;
private int sapRarity = 10;
private int spireHeight = 4;
final IBlockState leafState = TRContent.RUBBER_LEAVES.getDefaultState();
final BlockState leafState = TRContent.RUBBER_LEAVES.getDefaultState();
public RubberTreeFeature() {
super(false);
@ -56,7 +55,7 @@ public class RubberTreeFeature extends AbstractTreeFeature<NoFeatureConfig> {
@Override
protected boolean place(Set<BlockPos> changedBlocks, IWorld worldIn, Random rand, BlockPos saplingPos) {
int treeHeight = rand.nextInt(5) + treeBaseHeight;
int worldHeight = worldIn.getWorld().getHeight();
int worldHeight = worldIn.getWorld().getTopPosition();
int baseY = saplingPos.getY();
int baseX = saplingPos.getX();
@ -64,10 +63,10 @@ public class RubberTreeFeature extends AbstractTreeFeature<NoFeatureConfig> {
if (baseY <= 1 && baseY + treeHeight + 1 >= worldHeight) { return false; }
BlockPos rootBlockPos = saplingPos.down();
IBlockState rootBlockState = worldIn.getBlockState(rootBlockPos);
BlockState rootBlockState = worldIn.getBlockState(rootBlockPos);
boolean isSoil = rootBlockState.canSustainPlant(worldIn, rootBlockPos,
net.minecraft.util.EnumFacing.UP,
(net.minecraft.block.BlockSapling) TRContent.RUBBER_SAPLING.getBlock());
net.minecraft.util.math.Direction.UP,
(net.minecraft.block.SaplingBlock) TRContent.RUBBER_SAPLING.getBlock());
if (!isSoil) { return false; }
int yOffset;
@ -82,10 +81,10 @@ public class RubberTreeFeature extends AbstractTreeFeature<NoFeatureConfig> {
radius = 2;
}
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
BlockPos.Mutable blockpos$mutableblockpos = new BlockPos.Mutable();
for (xOffset = baseX - radius; xOffset <= baseX + radius; ++xOffset) {
for (zOffset = baseZ - radius; zOffset <= baseZ + radius; ++zOffset) {
if (!this.canGrowInto(worldIn, blockpos$mutableblockpos.setPos(xOffset, yOffset, xOffset))) {
if (!this.canGrowInto(worldIn, blockpos$mutableblockpos.set(xOffset, yOffset, xOffset))) {
return false;
}
}
@ -114,15 +113,15 @@ public class RubberTreeFeature extends AbstractTreeFeature<NoFeatureConfig> {
// Trunk
BlockPos topLogPos = null;
IBlockState logState = TRContent.RUBBER_LOG.getDefaultState();
BlockState logState = TRContent.RUBBER_LOG.getDefaultState();
for (yOffset = 0; yOffset < treeHeight; ++yOffset) {
BlockPos blockpos = new BlockPos(baseX, baseY + yOffset, baseZ);
IBlockState state1 = worldIn.getBlockState(blockpos);
if (state1.isAir(worldIn, blockpos) || state1.isIn(BlockTags.LEAVES)) {
BlockState state1 = worldIn.getBlockState(blockpos);
if (state1.isAir(worldIn, blockpos) || state1.matches(BlockTags.LEAVES)) {
if (rand.nextInt(sapRarity) == 0) {
logState = logState.with(BlockRubberLog.HAS_SAP, true)
.with(BlockRubberLog.SAP_SIDE, EnumFacing.byHorizontalIndex(rand.nextInt(4)));
.with(BlockRubberLog.SAP_SIDE, Direction.fromHorizontal(rand.nextInt(4)));
}
//setBlockState(worldIn, blockpos, logState);
@ -149,7 +148,7 @@ public class RubberTreeFeature extends AbstractTreeFeature<NoFeatureConfig> {
}
private boolean growLeaves(IWorld worldIn, BlockPos pos) {
IBlockState state1 = worldIn.getBlockState(pos);
BlockState state1 = worldIn.getBlockState(pos);
if (state1.canBeReplacedByLeaves(worldIn, pos)) {
this.setBlockState(worldIn, pos, leafState);
return true;

View file

@ -24,12 +24,12 @@
package techreborn.world.village;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.LootTableList;
import net.minecraft.util.Identifier;
import net.minecraft.world.loot.LootTables;
import techreborn.TechReborn;
public class ModLootTables {
public static final ResourceLocation CHESTS_RUBBER_PLANTATION = LootTableList.register(new ResourceLocation(TechReborn.MOD_ID, "chests/rubber_plantation"));
public static final Identifier CHESTS_RUBBER_PLANTATION = LootTables.registerLootTable(new Identifier(TechReborn.MOD_ID, "chests/rubber_plantation"));
}

View file

@ -24,38 +24,38 @@
package techreborn.world.village;
import net.minecraft.block.BlockCrops;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.EnumFacing;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.CropBlock;
import net.minecraft.structure.StructurePiece;
import net.minecraft.structure.VillageGenerator;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.MutableBoundingBox;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MutableIntBoundingBox;
import net.minecraft.world.IWorld;
import net.minecraft.world.gen.feature.structure.StructurePiece;
import net.minecraft.world.gen.feature.structure.VillagePieces;
import techreborn.init.TRContent;
import techreborn.world.RubberTreeGenerator;
import java.util.List;
import java.util.Random;
public class VillageComponentRubberPlantaion extends VillagePieces.Field1 {
public class VillageComponentRubberPlantaion extends VillageGenerator.Field1 {
public static VillagePieces.Village buildComponent(VillagePieces.PieceWeight villagePiece, VillagePieces.Start startPiece, List<StructurePiece> pieces, Random random, int p1, int p2, int p3, EnumFacing facing, int p5) {
MutableBoundingBox structureboundingbox = MutableBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, 13, 4, 9, facing);
return canVillageGoDeeper(structureboundingbox) && StructurePiece.findIntersecting(pieces, structureboundingbox) == null ? new VillageComponentRubberPlantaion(startPiece, p5, random, structureboundingbox, facing) : null;
public static VillageGenerator.Piece buildComponent(VillageGenerator.PieceWeight villagePiece, VillageGenerator.Start startPiece, List<StructurePiece> pieces, Random random, int p1, int p2, int p3, Direction facing, int p5) {
MutableIntBoundingBox structureboundingbox = MutableIntBoundingBox.createRotated(p1, p2, p3, 0, 0, 0, 13, 4, 9, facing);
return canVillageGoDeeper(structureboundingbox) && StructurePiece.method_14932(pieces, structureboundingbox) == null ? new VillageComponentRubberPlantaion(startPiece, p5, random, structureboundingbox, facing) : null;
}
public VillageComponentRubberPlantaion() {
}
public VillageComponentRubberPlantaion(VillagePieces.Start start, int type, Random rand, MutableBoundingBox structureBoundingBox, EnumFacing facing) {
public VillageComponentRubberPlantaion(VillageGenerator.Start start, int type, Random rand, MutableIntBoundingBox structureBoundingBox, Direction facing) {
super(start, type, rand, structureBoundingBox, facing);
}
@Override
protected void fillWithBlocks(IWorld worldIn, MutableBoundingBox boundingboxIn, int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, IBlockState boundaryBlockState, IBlockState insideBlockState, boolean existingOnly) {
protected void fillWithBlocks(IWorld worldIn, MutableIntBoundingBox boundingboxIn, int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, BlockState boundaryBlockState, BlockState insideBlockState, boolean existingOnly) {
//Replaces farmland with dirt, its not great but it works.
if (boundaryBlockState.getBlock() == Blocks.FARMLAND) {
boundaryBlockState = Blocks.GRASS.getDefaultState();
@ -70,7 +70,7 @@ public class VillageComponentRubberPlantaion extends VillagePieces.Field1 {
}
@Override
protected void setBlockState(IWorld worldIn, IBlockState blockstateIn, int x, int y, int z, MutableBoundingBox boundingboxIn) {
protected void setBlockState(IWorld worldIn, BlockState blockstateIn, int x, int y, int z, MutableIntBoundingBox boundingboxIn) {
if (isCrop(blockstateIn)) {
blockstateIn = TRContent.RUBBER_SAPLING.getDefaultState();
}
@ -78,7 +78,7 @@ public class VillageComponentRubberPlantaion extends VillagePieces.Field1 {
}
@Override
public boolean addComponentParts(IWorld worldIn, Random randomIn, MutableBoundingBox structureBoundingBoxIn, ChunkPos chunkPos) {
public boolean addComponentParts(IWorld worldIn, Random randomIn, MutableIntBoundingBox structureBoundingBoxIn, ChunkPos chunkPos) {
super.addComponentParts(worldIn, randomIn, structureBoundingBoxIn, chunkPos);
for (int i = 1; i < 7; i++) {
growRandom(i, 1, structureBoundingBoxIn, randomIn, worldIn);
@ -94,7 +94,7 @@ public class VillageComponentRubberPlantaion extends VillagePieces.Field1 {
return true;
}
private void growRandom(int coloum, int row, MutableBoundingBox structureBoundingBox, Random random, IWorld world) {
private void growRandom(int coloum, int row, MutableIntBoundingBox structureBoundingBox, Random random, IWorld world) {
if (random.nextInt(10) == 0) {
setBlockState(world, Blocks.AIR.getDefaultState(), row, 1, coloum, structureBoundingBox);
BlockPos pos = new BlockPos(this.getXWithOffset(row, coloum), this.getYWithOffset(1), this.getZWithOffset(row, coloum));
@ -105,8 +105,8 @@ public class VillageComponentRubberPlantaion extends VillagePieces.Field1 {
}
}
private boolean isCrop(IBlockState state) {
if (state.getBlock() instanceof BlockCrops) {
private boolean isCrop(BlockState state) {
if (state.getBlock() instanceof CropBlock) {
return true;
}
return false;

View file

@ -24,10 +24,10 @@
package techreborn.world.village;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.gen.feature.structure.StructurePiece;
import net.minecraft.world.gen.feature.structure.VillagePieces;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
import net.minecraft.structure.StructurePiece;
import net.minecraft.structure.VillageGenerator;
import net.minecraft.util.math.Direction;
import java.util.List;
import java.util.Random;
@ -35,8 +35,8 @@ import java.util.Random;
public class VillagePlantaionHandler implements VillagerRegistry.IVillageCreationHandler {
@Override
public VillagePieces.PieceWeight getVillagePieceWeight(Random random, int i) {
return new VillagePieces.PieceWeight(VillageComponentRubberPlantaion.class, 5, 1);
public VillageGenerator.PieceWeight getVillagePieceWeight(Random random, int i) {
return new VillageGenerator.PieceWeight(VillageComponentRubberPlantaion.class, 5, 1);
}
@Override
@ -46,7 +46,7 @@ public class VillagePlantaionHandler implements VillagerRegistry.IVillageCreatio
@Override
public VillagePieces.Village buildComponent(VillagePieces.PieceWeight villagePiece, VillagePieces.Start startPiece, List<StructurePiece> pieces, Random random, int p1, int p2, int p3, EnumFacing facing, int p5) {
public VillageGenerator.Piece buildComponent(VillageGenerator.PieceWeight villagePiece, VillageGenerator.Start startPiece, List<StructurePiece> pieces, Random random, int p1, int p2, int p3, Direction facing, int p5) {
return VillageComponentRubberPlantaion.buildComponent(villagePiece, startPiece, pieces, random, p1, p2, p3, facing, p5);
}
}