From 7c48fe198d145c9c84bf37364ecbec2e15075d7f Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Wed, 9 Feb 2022 14:25:02 +0000 Subject: [PATCH] Layer index utility method in LocalChunk --- .../main/java/com/plotsquared/core/queue/LocalChunk.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; + } + }