2016-03-29 02:55:47 +02:00
|
|
|
--- a/net/minecraft/world/level/ChunkPos.java
|
|
|
|
+++ b/net/minecraft/world/level/ChunkPos.java
|
2024-12-15 00:42:27 +01:00
|
|
|
@@ -46,6 +_,7 @@
|
2016-03-29 02:55:47 +02:00
|
|
|
public static final int REGION_MAX_INDEX = 31;
|
|
|
|
public final int x;
|
|
|
|
public final int z;
|
|
|
|
+ public final long longKey; // Paper
|
|
|
|
private static final int HASH_A = 1664525;
|
|
|
|
private static final int HASH_C = 1013904223;
|
|
|
|
private static final int HASH_Z_XOR = -559038737;
|
2024-12-15 00:42:27 +01:00
|
|
|
@@ -53,16 +_,19 @@
|
|
|
|
public ChunkPos(int x, int y) {
|
2016-03-29 02:55:47 +02:00
|
|
|
this.x = x;
|
2024-12-15 00:42:27 +01:00
|
|
|
this.z = y;
|
2016-03-29 02:55:47 +02:00
|
|
|
+ this.longKey = asLong(this.x, this.z); // Paper
|
|
|
|
}
|
|
|
|
|
|
|
|
public ChunkPos(BlockPos pos) {
|
|
|
|
this.x = SectionPos.blockToSectionCoord(pos.getX());
|
|
|
|
this.z = SectionPos.blockToSectionCoord(pos.getZ());
|
|
|
|
+ this.longKey = asLong(this.x, this.z); // Paper
|
|
|
|
}
|
|
|
|
|
2024-12-15 00:42:27 +01:00
|
|
|
public ChunkPos(long packedPos) {
|
|
|
|
this.x = (int)packedPos;
|
|
|
|
this.z = (int)(packedPos >> 32);
|
2016-03-29 02:55:47 +02:00
|
|
|
+ this.longKey = asLong(this.x, this.z); // Paper
|
|
|
|
}
|
|
|
|
|
2024-12-15 00:42:27 +01:00
|
|
|
public static ChunkPos minFromRegion(int chunkX, int chunkZ) {
|
2024-12-15 16:11:42 +01:00
|
|
|
@@ -74,7 +_,7 @@
|
|
|
|
}
|
|
|
|
|
|
|
|
public long toLong() {
|
|
|
|
- return asLong(this.x, this.z);
|
|
|
|
+ return this.longKey; // Paper
|
|
|
|
}
|
|
|
|
|
|
|
|
public static long asLong(int x, int z) {
|