001package net.minecraft.nbt;
002
003import java.io.DataInput;
004import java.io.DataOutput;
005import java.io.IOException;
006
007public class NBTTagFloat extends NBTBase
008{
009    /** The float value for the tag. */
010    public float data;
011
012    public NBTTagFloat(String par1Str)
013    {
014        super(par1Str);
015    }
016
017    public NBTTagFloat(String par1Str, float 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.writeFloat(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.readFloat();
037    }
038
039    /**
040     * Gets the type byte for the tag.
041     */
042    public byte getId()
043    {
044        return (byte)5;
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 NBTTagFloat(this.getName(), this.data);
058    }
059
060    public boolean equals(Object par1Obj)
061    {
062        if (super.equals(par1Obj))
063        {
064            NBTTagFloat nbttagfloat = (NBTTagFloat)par1Obj;
065            return this.data == nbttagfloat.data;
066        }
067        else
068        {
069            return false;
070        }
071    }
072
073    public int hashCode()
074    {
075        return super.hashCode() ^ Float.floatToIntBits(this.data);
076    }
077}