diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java index 2125ce16b..cfc2c624c 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java @@ -285,8 +285,11 @@ public abstract class WorldGenArboriculture extends WorldGenBase { wood.setDirection(branchDirection); } } - addWood(world, x, y, z, EnumReplaceMode.SOFT); - branchEnds.add(new ChunkCoordinates(x, y, z)); + if (addWood(world, x, y, z, EnumReplaceMode.SOFT)) { + branchEnds.add(new ChunkCoordinates(x, y, z)); + } else { + break; + } } } } @@ -295,28 +298,30 @@ public abstract class WorldGenArboriculture extends WorldGenBase { } @Override - protected void addBlock(World world, int x, int y, int z, ITreeBlockType type, EnumReplaceMode replace) { + protected boolean addBlock(World world, int x, int y, int z, ITreeBlockType type, EnumReplaceMode replace) { if (replace == EnumReplaceMode.ALL || (replace == EnumReplaceMode.SOFT && BlockUtil.isReplaceableBlock(world, startX + x, startY + y, startZ + z)) || world.isAirBlock(startX + x, startY + y, startZ + z)) { type.setBlock(world, tree, startX + x, startY + y, startZ + z); + return true; } + return false; } protected final void clearBlock(World world, int x, int y, int z) { air.setBlock(world, startX + x, startY + y, startZ + z); } - protected final void addWood(World world, int x, int y, int z, EnumReplaceMode replace) { - addBlock(world, x, y, z, wood, replace); + protected final boolean addWood(World world, int x, int y, int z, EnumReplaceMode replace) { + return addBlock(world, x, y, z, wood, replace); } - protected final void addLeaf(World world, int x, int y, int z, EnumReplaceMode replace) { - addBlock(world, x, y, z, leaf, replace); + protected final boolean addLeaf(World world, int x, int y, int z, EnumReplaceMode replace) { + return addBlock(world, x, y, z, leaf, replace); } - protected final void addVine(World world, int x, int y, int z, ITreeBlockType vine) { - addBlock(world, x, y, z, vine, EnumReplaceMode.NONE); + protected final boolean addVine(World world, int x, int y, int z, ITreeBlockType vine) { + return addBlock(world, x, y, z, vine, EnumReplaceMode.NONE); } protected final void addVines(World world, int x, int y, int z, float chance) { diff --git a/src/main/java/forestry/core/worldgen/WorldGenBase.java b/src/main/java/forestry/core/worldgen/WorldGenBase.java index 76764e222..a83cca5c5 100755 --- a/src/main/java/forestry/core/worldgen/WorldGenBase.java +++ b/src/main/java/forestry/core/worldgen/WorldGenBase.java @@ -66,7 +66,7 @@ public abstract class WorldGenBase extends WorldGenerator { return false; } - protected abstract void addBlock(World world, int x, int y, int z, ITreeBlockType type, EnumReplaceMode replace); + protected abstract boolean addBlock(World world, int x, int y, int z, ITreeBlockType type, EnumReplaceMode replace); protected final void generateCuboid(World world, Vector start, Vector area, ITreeBlockType block, EnumReplaceMode replace) { for (int x = (int) start.x; x < (int) start.x + area.x; x++) { diff --git a/src/main/java/forestry/farming/logic/FarmLogicArboreal.java b/src/main/java/forestry/farming/logic/FarmLogicArboreal.java index b6cbe9217..d7f47c7a2 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicArboreal.java +++ b/src/main/java/forestry/farming/logic/FarmLogicArboreal.java @@ -40,6 +40,7 @@ import forestry.core.utils.vect.VectUtil; import forestry.plugins.PluginCore; public class FarmLogicArboreal extends FarmLogicHomogeneous { + private static final int BRANCH_RANGE = 20; public FarmLogicArboreal(IFarmHousing housing, ItemStack resource, ItemStack ground, Iterable germlings) { super(housing, resource, ground, germlings); @@ -172,10 +173,10 @@ public class FarmLogicArboreal extends FarmLogicHomogeneous { if (candidate.equals(position)) { continue; } - if (Math.abs(candidate.x - start.x) > 10) { + if (Math.abs(candidate.x - start.x) > BRANCH_RANGE) { continue; } - if (Math.abs(candidate.z - start.z) > 10) { + if (Math.abs(candidate.z - start.z) > BRANCH_RANGE) { continue; }