9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2026-01-04 15:41:40 +00:00

Cleanup cache chunk key

Reuse existing chunk key field instead of making new one, also prevent unnecessary increase of ChunkPos object size
This commit is contained in:
Dreeam
2025-02-11 11:27:17 -05:00
parent 1046685bbf
commit 19fbe8ce15
2 changed files with 33 additions and 41 deletions

View File

@@ -9,10 +9,10 @@ This patch didn't cahce SectionPos or BlockPos to chunkKey, since it needs to co
TODO: Cache block pos and section pos, whether need?
diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/CoordinateUtils.java b/src/main/java/ca/spottedleaf/moonrise/common/util/CoordinateUtils.java
index 036c1a287db04c0191e5f84b027ea68d31447cbc..753c3e99e2f677ee1704b206a3196eb05c83f4ea 100644
index 036c1a287db04c0191e5f84b027ea68d31447cbc..3cda726b5ef7419da512889d3edd1fb6935e6a54 100644
--- a/src/main/java/ca/spottedleaf/moonrise/common/util/CoordinateUtils.java
+++ b/src/main/java/ca/spottedleaf/moonrise/common/util/CoordinateUtils.java
@@ -20,15 +20,15 @@ public final class CoordinateUtils {
@@ -20,7 +20,7 @@ public final class CoordinateUtils {
}
public static long getChunkKey(final ChunkPos pos) {
@@ -21,13 +21,3 @@ index 036c1a287db04c0191e5f84b027ea68d31447cbc..753c3e99e2f677ee1704b206a3196eb0
}
public static long getChunkKey(final SectionPos pos) {
- return ((long)pos.getZ() << 32) | (pos.getX() & 0xFFFFFFFFL);
+ return ((long)pos.getZ() << 32) | (pos.getX() & 0xFFFFFFFFL); // Leaf - Cache chunk key
}
public static long getChunkKey(final int x, final int z) {
- return ((long)z << 32) | (x & 0xFFFFFFFFL);
+ return ((long)z << 32) | (x & 0xFFFFFFFFL); // Leaf - Cache chunk key
}
public static int getChunkX(final long chunkKey) {