    001    package net.minecraft.src;
    002
    003    import java.io.DataInput;
    004    import java.io.DataOutput;
    005    import java.io.IOException;
    006    import java.util.Arrays;
    007
    008    public class NBTTagIntArray extends NBTBase
    009    {
    010        /** The array of saved integers */
    011        public int[] intArray;
    012
    013        public NBTTagIntArray(String par1Str)
    014        {
    015            super(par1Str);
    016        }
    017
    018        public NBTTagIntArray(String par1Str, int[] par2ArrayOfInteger)
    019        {
    020            super(par1Str);
    021            this.intArray = par2ArrayOfInteger;
    022        }
    023
    024        /**
    025         * Write the actual data contents of the tag, implemented in NBT extension classes
    026         */
    027        void write(DataOutput par1DataOutput) throws IOException
    028        {
    029            par1DataOutput.writeInt(this.intArray.length);
    030            int[] var2 = this.intArray;
    031            int var3 = var2.length;
    032
    033            for (int var4 = 0; var4 < var3; ++var4)
    034            {
    035                int var5 = var2[var4];
    036                par1DataOutput.writeInt(var5);
    037            }
    038        }
    039
    040        /**
    041         * Read the actual data contents of the tag, implemented in NBT extension classes
    042         */
    043        void load(DataInput par1DataInput) throws IOException
    044        {
    045            int var2 = par1DataInput.readInt();
    046            this.intArray = new int[var2];
    047
    048            for (int var3 = 0; var3 < var2; ++var3)
    049            {
    050                this.intArray[var3] = par1DataInput.readInt();
    051            }
    052        }
    053
    054        /**
    055         * Gets the type byte for the tag.
    056         */
    057        public byte getId()
    058        {
    059            return (byte)11;
    060        }
    061
    062        public String toString()
    063        {
    064            return "[" + this.intArray.length + " bytes]";
    065        }
    066
    067        /**
    068         * Creates a clone of the tag.
    069         */
    070        public NBTBase copy()
    071        {
    072            int[] var1 = new int[this.intArray.length];
    073            System.arraycopy(this.intArray, 0, var1, 0, this.intArray.length);
    074            return new NBTTagIntArray(this.getName(), var1);
    075        }
    076
    077        public boolean equals(Object par1Obj)
    078        {
    079            if (!super.equals(par1Obj))
    080            {
    081                return false;
    082            }
    083            else
    084            {
    085                NBTTagIntArray var2 = (NBTTagIntArray)par1Obj;
    086                return this.intArray == null && var2.intArray == null || this.intArray != null && Arrays.equals(this.intArray, var2.intArray);
    087            }
    088        }
    089
    090        public int hashCode()
    091        {
    092            return super.hashCode() ^ Arrays.hashCode(this.intArray);
    093        }
    094    }