34 lines
607 B
Java
Executable file
34 lines
607 B
Java
Executable file
package game.world;
|
|
|
|
public class ChunkPos {
|
|
public final int x;
|
|
public final int z;
|
|
|
|
public ChunkPos(int x, int z) {
|
|
this.x = x;
|
|
this.z = z;
|
|
}
|
|
|
|
public int hashCode() {
|
|
int i = 1664525 * this.x + 1013904223;
|
|
int j = 1664525 * (this.z ^ -559038737) + 1013904223;
|
|
return i ^ j;
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if(this == obj) {
|
|
return true;
|
|
}
|
|
else if(!(obj instanceof ChunkPos)) {
|
|
return false;
|
|
}
|
|
else {
|
|
ChunkPos pos = (ChunkPos)obj;
|
|
return this.x == pos.x && this.z == pos.z;
|
|
}
|
|
}
|
|
|
|
public String toString() {
|
|
return "[" + this.x + ", " + this.z + "]";
|
|
}
|
|
}
|