mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-06 18:50:51 +01:00
39 lines
1.2 KiB
Diff
39 lines
1.2 KiB
Diff
--- a/net/minecraft/world/level/ChunkPos.java
|
|
+++ b/net/minecraft/world/level/ChunkPos.java
|
|
@@ -46,6 +_,7 @@
|
|
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;
|
|
@@ -53,16 +_,19 @@
|
|
public ChunkPos(int x, int y) {
|
|
this.x = x;
|
|
this.z = y;
|
|
+ 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
|
|
}
|
|
|
|
public ChunkPos(long packedPos) {
|
|
this.x = (int)packedPos;
|
|
this.z = (int)(packedPos >> 32);
|
|
+ this.longKey = asLong(this.x, this.z); // Paper
|
|
}
|
|
|
|
public static ChunkPos minFromRegion(int chunkX, int chunkZ) {
|
|
@@ -74,7 +_,7 @@
|
|
}
|
|
|
|
public long toLong() {
|
|
- return asLong(this.x, this.z);
|
|
+ return this.longKey; // Paper
|
|
}
|
|
|
|
public static long asLong(int x, int z) {
|