001 package net.minecraft.world;
002
003 public class ChunkCoordIntPair
004 {
005 /** The X position of this Chunk Coordinate Pair */
006 public final int chunkXPos;
007
008 /** The Z position of this Chunk Coordinate Pair */
009 public final int chunkZPos;
010
011 public ChunkCoordIntPair(int par1, int par2)
012 {
013 this.chunkXPos = par1;
014 this.chunkZPos = par2;
015 }
016
017 /**
018 * converts a chunk coordinate pair to an integer (suitable for hashing)
019 */
020 public static long chunkXZ2Int(int par0, int par1)
021 {
022 return (long)par0 & 4294967295L | ((long)par1 & 4294967295L) << 32;
023 }
024
025 public int hashCode()
026 {
027 long var1 = chunkXZ2Int(this.chunkXPos, this.chunkZPos);
028 int var3 = (int)var1;
029 int var4 = (int)(var1 >> 32);
030 return var3 ^ var4;
031 }
032
033 public boolean equals(Object par1Obj)
034 {
035 ChunkCoordIntPair var2 = (ChunkCoordIntPair)par1Obj;
036 return var2.chunkXPos == this.chunkXPos && var2.chunkZPos == this.chunkZPos;
037 }
038
039 public int getCenterXPos()
040 {
041 return (this.chunkXPos << 4) + 8;
042 }
043
044 public int getCenterZPosition()
045 {
046 return (this.chunkZPos << 4) + 8;
047 }
048
049 public ChunkPosition getChunkPosition(int par1)
050 {
051 return new ChunkPosition(this.getCenterXPos(), par1, this.getCenterZPosition());
052 }
053
054 public String toString()
055 {
056 return "[" + this.chunkXPos + ", " + this.chunkZPos + "]";
057 }
058 }