From c1f520143b3e6ea28be7d649843ecc5a89c4288f Mon Sep 17 00:00:00 2001 From: themode Date: Wed, 19 Aug 2020 01:51:22 +0200 Subject: [PATCH] Use chunk size constant instead of magic values --- .../java/net/minestom/server/utils/chunk/ChunkUtils.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/minestom/server/utils/chunk/ChunkUtils.java b/src/main/java/net/minestom/server/utils/chunk/ChunkUtils.java index c23ed5507..e12c14f97 100644 --- a/src/main/java/net/minestom/server/utils/chunk/ChunkUtils.java +++ b/src/main/java/net/minestom/server/utils/chunk/ChunkUtils.java @@ -89,8 +89,8 @@ public final class ChunkUtils { } public static short getLocalBlockPosAsShort(int x, int y, int z) { - x = x % 16; - z = z % 16; + x = x % Chunk.CHUNK_SIZE_X; + z = z % Chunk.CHUNK_SIZE_Z; return (short) (x << 8 | y << 4 | z); } @@ -196,7 +196,7 @@ public final class ChunkUtils { */ public static int blockIndexToPositionX(int index, int chunkX) { int x = (byte) (index & 0xF); - x += 16 * chunkX; + x += Chunk.CHUNK_SIZE_X * chunkX; return x; } @@ -219,7 +219,7 @@ public final class ChunkUtils { */ public static int blockIndexToPositionZ(int index, int chunkZ) { int z = (byte) (index >> 12 & 0xF); - z += 16 * chunkZ; + z += Chunk.CHUNK_SIZE_Z * chunkZ; return z; }