001 package net.minecraft.src;
002
003 public class NextTickListEntry implements Comparable
004 {
005 /** The id number for the next tick entry */
006 private static long nextTickEntryID = 0L;
007
008 /** X position this tick is occuring at */
009 public int xCoord;
010
011 /** Y position this tick is occuring at */
012 public int yCoord;
013
014 /** Z position this tick is occuring at */
015 public int zCoord;
016
017 /**
018 * blockID of the scheduled tick (ensures when the tick occurs its still for this block)
019 */
020 public int blockID;
021
022 /** Time this tick is scheduled to occur at */
023 public long scheduledTime;
024 public int field_82754_f;
025
026 /** The id of the tick entry */
027 private long tickEntryID;
028
029 public NextTickListEntry(int par1, int par2, int par3, int par4)
030 {
031 this.tickEntryID = (long)(nextTickEntryID++);
032 this.xCoord = par1;
033 this.yCoord = par2;
034 this.zCoord = par3;
035 this.blockID = par4;
036 }
037
038 public boolean equals(Object par1Obj)
039 {
040 if (!(par1Obj instanceof NextTickListEntry))
041 {
042 return false;
043 }
044 else
045 {
046 NextTickListEntry var2 = (NextTickListEntry)par1Obj;
047 return this.xCoord == var2.xCoord && this.yCoord == var2.yCoord && this.zCoord == var2.zCoord && this.blockID == var2.blockID;
048 }
049 }
050
051 public int hashCode()
052 {
053 return (this.xCoord * 1024 * 1024 + this.zCoord * 1024 + this.yCoord) * 256 + this.blockID;
054 }
055
056 /**
057 * Sets the scheduled time for this tick entry
058 */
059 public NextTickListEntry setScheduledTime(long par1)
060 {
061 this.scheduledTime = par1;
062 return this;
063 }
064
065 public void func_82753_a(int par1)
066 {
067 this.field_82754_f = par1;
068 }
069
070 /**
071 * Compares this tick entry to another tick entry for sorting purposes. Compared first based on the scheduled time
072 * and second based on tickEntryID.
073 */
074 public int comparer(NextTickListEntry par1NextTickListEntry)
075 {
076 return this.scheduledTime < par1NextTickListEntry.scheduledTime ? -1 : (this.scheduledTime > par1NextTickListEntry.scheduledTime ? 1 : (this.field_82754_f != par1NextTickListEntry.field_82754_f ? this.field_82754_f - par1NextTickListEntry.field_82754_f : (this.tickEntryID < par1NextTickListEntry.tickEntryID ? -1 : (this.tickEntryID > par1NextTickListEntry.tickEntryID ? 1 : 0))));
077 }
078
079 public int compareTo(Object par1Obj)
080 {
081 return this.comparer((NextTickListEntry)par1Obj);
082 }
083 }