001 package net.minecraft.world;
002
003 import net.minecraft.util.MathHelper;
004 import net.minecraft.util.Vec3;
005
006 public class ChunkPosition
007 {
008 /** The x coordinate of this ChunkPosition */
009 public final int x;
010
011 /** The y coordinate of this ChunkPosition */
012 public final int y;
013
014 /** The z coordinate of this ChunkPosition */
015 public final int z;
016
017 public ChunkPosition(int par1, int par2, int par3)
018 {
019 this.x = par1;
020 this.y = par2;
021 this.z = par3;
022 }
023
024 public ChunkPosition(Vec3 par1Vec3)
025 {
026 this(MathHelper.floor_double(par1Vec3.xCoord), MathHelper.floor_double(par1Vec3.yCoord), MathHelper.floor_double(par1Vec3.zCoord));
027 }
028
029 public boolean equals(Object par1Obj)
030 {
031 if (!(par1Obj instanceof ChunkPosition))
032 {
033 return false;
034 }
035 else
036 {
037 ChunkPosition var2 = (ChunkPosition)par1Obj;
038 return var2.x == this.x && var2.y == this.y && var2.z == this.z;
039 }
040 }
041
042 public int hashCode()
043 {
044 return this.x * 8976890 + this.y * 981131 + this.z;
045 }
046 }