mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-27 23:33:00 +00:00
Integrate the terrain in the tree gen helper
This commit is contained in:
1 parent
1c1dd4918a
commit
8a40dd6d27
5 files changed
+65
-20
No files matched your search
@@ -22,10 +22,6 @@ public abstract class HiveGen implements IHiveGen {
|
||||
|
||||
@Override
|
||||
public boolean canReplace(World world, BlockPos pos) {
|
||||
Block block = BlockUtil.getBlock(world, pos);
|
||||
Material material = block.getMaterial();
|
||||
return block.isReplaceable(world, pos) && !material.isLiquid() ||
|
||||
block.isAir(world, pos) ||
|
||||
material == Material.plants;
|
||||
return BlockUtil.canReplace(world, pos);
|
||||
}
|
||||
}
|
||||
@@ -38,13 +38,13 @@ public class HiveGenGround extends HiveGen {
|
||||
|
||||
@Override
|
||||
public int getYForHive(World world, int x, int z) {
|
||||
int y = world.getHeight(new BlockPos(x, 0, z)).getY();
|
||||
|
||||
// get to the ground
|
||||
while (y >= 0 && (world.getBlockState(new BlockPos(x, y - 1, z)).getBlock().isLeaves(world, new BlockPos(x, y - 1, z)) || canReplace(world, new BlockPos(x, y - 1, z)))) {
|
||||
y--;
|
||||
BlockPos pos = world.getHeight(new BlockPos(x, 0, z));
|
||||
while (pos.getY() >= 0 && (world.getBlockState(pos).getBlock().isLeaves(world, pos) || canReplace(world, pos))) {
|
||||
pos = pos.add(0, -1, 0);
|
||||
}
|
||||
|
||||
return y;
|
||||
return pos.getY();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user