Lazy heightmap range fix

This commit is contained in:
dordsor21 2020-07-03 16:29:27 +01:00
parent 9e25c736a0
commit f7d375c76c
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B

View File

@ -286,7 +286,12 @@ public class HeightMap {
if (existing.getBlockType().getMaterial().isMovementBlocker()) { if (existing.getBlockType().getMaterial().isMovementBlocker()) {
int y0 = newHeight - 1; int y0 = newHeight - 1;
for (int setY = y0, getY = curHeight - 1; setY >= curHeight; setY--, getY--) { for (int setY = y0, getY = curHeight - 1; setY >= curHeight; setY--, getY--) {
BlockState get = session.getBlock(xr, getY, zr); BlockState get;
if (getY >= 0 && getY < 256) {
get = session.getBlock(xr, getY, zr);
} else {
get = BlockTypes.AIR.getDefaultState();
}
if (get != BlockTypes.AIR.getDefaultState()) tmpBlock = get; if (get != BlockTypes.AIR.getDefaultState()) tmpBlock = get;
session.setBlock(xr, setY, zr, tmpBlock); session.setBlock(xr, setY, zr, tmpBlock);
++blocksChanged; ++blocksChanged;