improve fabric/forge getHeight impl

This commit is contained in:
dfsek
2021-05-27 19:46:05 -07:00
parent 5fbcdea9e7
commit 94d7f783c4
3 changed files with 3 additions and 3 deletions

View File

@@ -150,7 +150,7 @@ public class FabricChunkGeneratorWrapper extends ChunkGenerator implements Gener
public int getHeight(int x, int z, Heightmap.Type heightmapType) {
TerraWorld world = TerraFabricPlugin.getInstance().getWorld(dimensionType);
int height = world.getWorld().getMaxHeight();
while(height >= 0 && !heightmapType.getBlockPredicate().test(((FabricBlockData) world.getUngeneratedBlock(x, height - 1, z)).getHandle())) {
while(height >= 0 && !heightmapType.getBlockPredicate().test(((FabricBlockData) world.getUngeneratedBlock(x, height-1, z)).getHandle())) {
height--;
}
return height;

View File

@@ -146,7 +146,7 @@ public class ForgeChunkGeneratorWrapper extends ChunkGenerator implements Genera
public int getBaseHeight(int x, int z, Heightmap.@NotNull Type type) {
TerraWorld world = TerraForgePlugin.getInstance().getWorld(dimensionType);
int height = world.getWorld().getMaxHeight();
while(height >= 0 && !type.isOpaque().test(((ForgeBlockData) world.getUngeneratedBlock(x, height - 1, z)).getHandle())) {
while(height >= 0 && !type.isOpaque().test(((ForgeBlockData) world.getUngeneratedBlock(x, height-1, z)).getHandle())) {
height--;
}
return height;