Fix issue when entities populator could check position outside world bounds for roofless and floorless worlds.

This commit is contained in:
BONNe1704 2019-02-01 11:05:47 +02:00
parent a14f076c65
commit ce6c85aef6

View File

@ -221,6 +221,8 @@ public class EntitiesPopulator extends BlockPopulator
break; break;
} }
if (block.getY() > 1 && block.getY() < world.getMaxHeight() - 2)
{
Block otherBlock = world.getBlockAt(block.getX(), block.getY() + 1, block.getZ()); Block otherBlock = world.getBlockAt(block.getX(), block.getY() + 1, block.getZ());
if (!otherBlock.getType().equals(originalMaterial)) if (!otherBlock.getType().equals(originalMaterial))
@ -243,6 +245,7 @@ public class EntitiesPopulator extends BlockPopulator
} }
} }
} }
}
else else
{ {
block.setType(Material.CAVE_AIR); block.setType(Material.CAVE_AIR);