mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-20 12:09:39 +00:00
Fix #922 New tree branching generates non-connected logs
This commit is contained in:
1 parent
5d2aaea757
commit
178142bf7a
3 files changed
+18
-12
No files matched your search
@@ -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) {
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
@@ -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<IFarmable> 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user