    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
    025        /** The id of the tick entry */
    026        private long tickEntryID;
    027
    028        public NextTickListEntry(int par1, int par2, int par3, int par4)
    029        {
    030            this.tickEntryID = (long)(nextTickEntryID++);
    031            this.xCoord = par1;
    032            this.yCoord = par2;
    033            this.zCoord = par3;
    034            this.blockID = par4;
    035        }
    036
    037        public boolean equals(Object par1Obj)
    038        {
    039            if (!(par1Obj instanceof NextTickListEntry))
    040            {
    041                return false;
    042            }
    043            else
    044            {
    045                NextTickListEntry var2 = (NextTickListEntry)par1Obj;
    046                return this.xCoord == var2.xCoord && this.yCoord == var2.yCoord && this.zCoord == var2.zCoord && this.blockID == var2.blockID;
    047            }
    048        }
    049
    050        public int hashCode()
    051        {
    052            return (this.xCoord * 1024 * 1024 + this.zCoord * 1024 + this.yCoord) * 256 + this.blockID;
    053        }
    054
    055        /**
    056         * Sets the scheduled time for this tick entry
    057         */
    058        public NextTickListEntry setScheduledTime(long par1)
    059        {
    060            this.scheduledTime = par1;
    061            return this;
    062        }
    063
    064        /**
    065         * Compares this tick entry to another tick entry for sorting purposes. Compared first based on the scheduled time
    066         * and second based on tickEntryID.
    067         */
    068        public int comparer(NextTickListEntry par1NextTickListEntry)
    069        {
    070            return this.scheduledTime < par1NextTickListEntry.scheduledTime ? -1 : (this.scheduledTime > par1NextTickListEntry.scheduledTime ? 1 : (this.tickEntryID < par1NextTickListEntry.tickEntryID ? -1 : (this.tickEntryID > par1NextTickListEntry.tickEntryID ? 1 : 0)));
    071        }
    072
    073        public int compareTo(Object par1Obj)
    074        {
    075            return this.comparer((NextTickListEntry)par1Obj);
    076        }
    077    }