From eb850bead2f85b6596211f2b23babd0510e78cd0 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Wed, 23 Oct 2024 20:55:44 +0800 Subject: [PATCH] feat: remove useless operation in HashUtils.hashChunkXYZ --- .../main/java/org/allaymc/api/utils/HashUtils.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/api/src/main/java/org/allaymc/api/utils/HashUtils.java b/api/src/main/java/org/allaymc/api/utils/HashUtils.java index 1222dcec2..3799d2eb5 100644 --- a/api/src/main/java/org/allaymc/api/utils/HashUtils.java +++ b/api/src/main/java/org/allaymc/api/utils/HashUtils.java @@ -145,18 +145,8 @@ public int hashChunkXYZ(int x, int y, int z) { Preconditions.checkArgument(x >= 0 && x <= 15); Preconditions.checkArgument(y >= -8388608 && y <= 8388607); Preconditions.checkArgument(z >= 0 && z <= 15); - //Make sure x and z are in the range of 0-15 - x &= 0xF; //4 bits - z &= 0xF; //4 bits - //Use the int type to store the result - int result = 0; - //Place x in the top 4 digits - result |= (x << 28); - //Place y in the middle 24 bits - result |= ((y + 8388608) & 0xFFFFFF) << 4; - //Place z in the lowest 4 digits - result |= z; - return result; + // Place x in the top 4 digits, y in the middle 24 bits, z in the lowest 4 digits + return (x << 28) | (((y + 8388608) & 0xFFFFFF) << 4) | z; } /**