diff --git a/src/main/java/forestry/api/arboriculture/ITree.java b/src/main/java/forestry/api/arboriculture/ITree.java index fe8cba972..7a3c1b873 100644 --- a/src/main/java/forestry/api/arboriculture/ITree.java +++ b/src/main/java/forestry/api/arboriculture/ITree.java @@ -84,7 +84,7 @@ public interface ITree extends IIndividual, ITreeGenData { * @return Integer denoting the size of the tree trunk. */ @Override - int getGirth(World world, BlockPos pos); + int getGirth(); /** * @return Growth conditions at the given position. diff --git a/src/main/java/forestry/api/world/ITreeGenData.java b/src/main/java/forestry/api/world/ITreeGenData.java index 5049e54b3..b5fec434c 100644 --- a/src/main/java/forestry/api/world/ITreeGenData.java +++ b/src/main/java/forestry/api/world/ITreeGenData.java @@ -18,7 +18,7 @@ import forestry.api.arboriculture.ITreeGenome; public interface ITreeGenData { - int getGirth(World world, BlockPos pos); + int getGirth(); float getHeightModifier(); diff --git a/src/main/java/forestry/arboriculture/genetics/Tree.java b/src/main/java/forestry/arboriculture/genetics/Tree.java index a533aa3a2..1bae06222 100755 --- a/src/main/java/forestry/arboriculture/genetics/Tree.java +++ b/src/main/java/forestry/arboriculture/genetics/Tree.java @@ -203,7 +203,7 @@ public class Tree extends Individual implements ITree, IPlantable { } @Override - public int getGirth(World world, BlockPos pos) { + public int getGirth() { return genome.getGirth(); } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java index 36d623aa7..ff4884478 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java @@ -18,6 +18,7 @@ import java.util.List; import java.util.Random; import java.util.Set; +import forestry.arboriculture.blocks.BlockSapling; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -61,6 +62,7 @@ public abstract class WorldGenArboriculture extends WorldGenBase { } if (genPos != null) { + clearSaplings(world, genPos); List branchEnds = new ArrayList<>(generateTrunk(world, rand, wood, genPos)); Collections.sort(branchEnds, TopDownBlockPosComparator.INSTANCE); generateLeaves(world, rand, leaf, branchEnds, genPos); @@ -96,6 +98,18 @@ public abstract class WorldGenArboriculture extends WorldGenBase { @Nullable public abstract BlockPos getValidGrowthPos(World world, BlockPos pos); + public void clearSaplings(World world, BlockPos genPos) { + int treeGirth = tree.getGirth(); + for (int x = 0; x < treeGirth; x++) { + for (int z = 0; z < treeGirth; z++) { + BlockPos saplingPos = genPos.add(x, 0, z); + if (world.getBlockState(saplingPos).getBlock() instanceof BlockSapling) { + world.setBlockToAir(saplingPos); + } + } + } + } + public boolean hasPods() { return tree.allowsFruitBlocks(); } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenTree.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenTree.java index 6d04792b3..4cb75077e 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenTree.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenTree.java @@ -74,7 +74,7 @@ public abstract class WorldGenTree extends WorldGenArboriculture { public final void preGenerate(World world, Random rand, BlockPos startPos) { super.preGenerate(world, rand, startPos); height = determineHeight(world, rand, baseHeight, heightVariation); - girth = tree.getGirth(world, startPos); + girth = tree.getGirth(); } protected int modifyByHeight(World world, int val, int min, int max) {