    001package net.minecraft.nbt;
    002
    003import java.io.DataInput;
    004import java.io.DataOutput;
    005import java.io.IOException;
    006
    007public class NBTTagByte extends NBTBase
    008{
    009    /** The byte value for the tag. */
    010    public byte data;
    011
    012    public NBTTagByte(String par1Str)
    013    {
    014        super(par1Str);
    015    }
    016
    017    public NBTTagByte(String par1Str, byte par2)
    018    {
    019        super(par1Str);
    020        this.data = par2;
    021    }
    022
    023    /**
    024     * Write the actual data contents of the tag, implemented in NBT extension classes
    025     */
    026    void write(DataOutput par1DataOutput) throws IOException
    027    {
    028        par1DataOutput.writeByte(this.data);
    029    }
    030
    031    /**
    032     * Read the actual data contents of the tag, implemented in NBT extension classes
    033     */
    034    void load(DataInput par1DataInput) throws IOException
    035    {
    036        this.data = par1DataInput.readByte();
    037    }
    038
    039    /**
    040     * Gets the type byte for the tag.
    041     */
    042    public byte getId()
    043    {
    044        return (byte)1;
    045    }
    046
    047    public String toString()
    048    {
    049        return "" + this.data;
    050    }
    051
    052    /**
    053     * Creates a clone of the tag.
    054     */
    055    public NBTBase copy()
    056    {
    057        return new NBTTagByte(this.getName(), this.data);
    058    }
    059
    060    public boolean equals(Object par1Obj)
    061    {
    062        if (super.equals(par1Obj))
    063        {
    064            NBTTagByte var2 = (NBTTagByte)par1Obj;
    065            return this.data == var2.data;
    066        }
    067        else
    068        {
    069            return false;
    070        }
    071    }
    072
    073    public int hashCode()
    074    {
    075        return super.hashCode() ^ this.data;
    076    }
    077}