change to stable hash
This commit is contained in:
@@ -27,7 +27,7 @@ public class WorldIdentifier {
|
|||||||
this.key = key;
|
this.key = key;
|
||||||
this.biomeSeed = biomeSeed;
|
this.biomeSeed = biomeSeed;
|
||||||
this.dimension = dimension;
|
this.dimension = dimension;
|
||||||
this.hashCode = mixStafford13(key.hashCode()^biomeSeed)^mixStafford13(dimension.hashCode()^biomeSeed);
|
this.hashCode = mixStafford13(registryKeyHashCode(key))^mixStafford13(registryKeyHashCode(dimension))^mixStafford13(biomeSeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -105,4 +105,12 @@ public class WorldIdentifier {
|
|||||||
public long getLongHash() {
|
public long getLongHash() {
|
||||||
return this.hashCode;
|
return this.hashCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static long registryKeyHashCode(RegistryKey<?> key) {
|
||||||
|
var A = key.getRegistry();
|
||||||
|
var B = key.getValue();
|
||||||
|
int a = A==null?0:A.hashCode();
|
||||||
|
int b = B==null?0:B.hashCode();
|
||||||
|
return (Integer.toUnsignedLong(a)<<32)|Integer.toUnsignedLong(b);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user