initial commit
This commit is contained in:
parent
3c9ee26b06
commit
22186c33b9
1458 changed files with 282792 additions and 0 deletions
34
java/src/game/world/ChunkPos.java
Executable file
34
java/src/game/world/ChunkPos.java
Executable file
|
@ -0,0 +1,34 @@
|
|||
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 + "]";
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue