tweak highest block check

This commit is contained in:
Jesse Boyd 2017-01-31 16:45:02 +11:00
parent e7990a06e2
commit aa7b770c03
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -181,8 +181,19 @@ public class BukkitUtil extends WorldUtil {
World bukkitWorld = getWorld(world); World bukkitWorld = getWorld(world);
for (int y = bukkitWorld.getMaxHeight() - 1; y > 0; y--) { for (int y = bukkitWorld.getMaxHeight() - 1; y > 0; y--) {
Block block = bukkitWorld.getBlockAt(x, y, z); Block block = bukkitWorld.getBlockAt(x, y, z);
if (block != null && block.getType().isSolid()) { if (block != null) {
Material type = block.getType();
if (type.isSolid()) {
return y + 1; return y + 1;
} else {
switch (type) {
case WATER:
case LAVA:
case STATIONARY_LAVA:
case STATIONARY_WATER:
return y;
}
}
} }
} }
return 0; return 0;