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