diff --git a/Core/src/main/java/com/plotsquared/core/queue/LocalChunk.java b/Core/src/main/java/com/plotsquared/core/queue/LocalChunk.java index f992b7e30..fc242692e 100644 --- a/Core/src/main/java/com/plotsquared/core/queue/LocalChunk.java +++ b/Core/src/main/java/com/plotsquared/core/queue/LocalChunk.java @@ -93,7 +93,7 @@ public class LocalChunk { } public void setBiome(final int x, final int y, final int z, final @NonNull BiomeType biomeType) { - final int i = (y >> 4) - minSection; + final int i = getLayerIndex(y); final int j = ChunkUtil.getJ(x, y, z); BiomeType[] array = this.biomes[i]; if (array == null) { @@ -108,7 +108,7 @@ public class LocalChunk { } public void setBlock(final int x, final int y, final int z, final @NonNull BaseBlock baseBlock) { - final int i = (y >> 4) - minSection; + final int i = getLayerIndex(y); final int j = ChunkUtil.getJ(x, y, z); BaseBlock[] array = baseblocks[i]; if (array == null) { @@ -129,4 +129,8 @@ public class LocalChunk { return this.entities; } + private int getLayerIndex(final int y) { + return (y >> 4) - minSection; + } + }