Some tweaks / optimizations

This commit is contained in:
Jesse Boyd
2017-09-25 16:57:42 +10:00
parent 92f94ecedc
commit 0d608245f5
15 changed files with 173 additions and 30 deletions

View File

@ -332,7 +332,7 @@ public class SpongeUtil extends WorldUtil {
@Override
public Location getSpawn(String world) {
Location result = SpongeUtil.getLocation(world, SpongeUtil.getWorld(world).getSpawnLocation());
result.setY(getHighestBlock(world, result.getX(), result.getZ()));
result.setY(1 + getHighestBlock(world, result.getX(), result.getZ()));
return result;
}
@ -392,15 +392,15 @@ public class SpongeUtil extends WorldUtil {
public int getHighestBlock(String worldName, int x, int z) {
World world = SpongeUtil.getWorld(worldName);
if (world == null) {
return 64;
return 63;
}
for (int y = 255; y > 0; y--) {
BlockState block = world.getBlock(x, y, z);
if (block.getType() != BlockTypes.AIR) {
return y + 1;
return y;
}
}
return 64;
return 63;
}
@Override