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