NBTTagFloat .java

net.minecraft.nbt.NBTTagFloat (class): members: getShort, getByte, getLong, getDouble, getFloat, getInt, copy, data, getId, hashCode, equals, toString.

net.minecraft.nbtclass105 linescommonextends NBTBase.NBTPrimitive1.9 KB

API Surface (11)

byte getId()
String toString()
NBTBase copy()
boolean equals(Object p_equals_1_)
int hashCode()
long getLong()
int getInt()
short getShort()
byte getByte()
double getDouble()
float getFloat()

Fields & Constants (1)

data

Code Graph: Dependencies (3)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

NBTTagFloat.java105 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.nbt;
2
3
import java.io.DataInput;
4
import java.io.DataOutput;
5
import java.io.IOException;
6
import net.minecraft.util.MathHelper;
7
8
public class NBTTagFloat extends NBTBase.NBTPrimitive
9
{
10
    /** The float value for the tag. */
11
    private float data;
12
13
    NBTTagFloat()
14
    {
15
    }
16
17
    public NBTTagFloat(float data)
18
    {
19
        this.data = data;
20
    }
21
22
    /**
23
     * Write the actual data contents of the tag, implemented in NBT extension classes
24
     */
25
    void write(DataOutput output) throws IOException
26
    {
27
        output.writeFloat(this.data);
28
    }
29
30
    void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException
31
    {
32
        sizeTracker.read(96L);
33
        this.data = input.readFloat();
34
    }
35
36
    /**
37
     * Gets the type byte for the tag.
38
     */
39
    public byte getId()
40
    {
41
        return (byte)5;
42
    }
43
44
    public String toString()
45
    {
46
        return "" + this.data + "f";
47
    }
48
49
    /**
50
     * Creates a clone of the tag.
51
     */
52
    public NBTBase copy()
53
    {
54
        return new NBTTagFloat(this.data);
55
    }
56
57
    public boolean equals(Object p_equals_1_)
58
    {
59
        if (super.equals(p_equals_1_))
60
        {
61
            NBTTagFloat nbttagfloat = (NBTTagFloat)p_equals_1_;
62
            return this.data == nbttagfloat.data;
63
        }
64
        else
65
        {
66
            return false;
67
        }
68
    }
69
70
    public int hashCode()
71
    {
72
        return super.hashCode() ^ Float.floatToIntBits(this.data);
73
    }
74
75
    public long getLong()
76
    {
77
        return (long)this.data;
78
    }
79
80
    public int getInt()
81
    {
82
        return MathHelper.floor_float(this.data);
83
    }
84
85
    public short getShort()
86
    {
87
        return (short)(MathHelper.floor_float(this.data) & 65535);
88
    }
89
90
    public byte getByte()
91
    {
92
        return (byte)(MathHelper.floor_float(this.data) & 255);
93
    }
94
95
    public double getDouble()
96
    {
97
        return (double)this.data;
98
    }
99
100
    public float getFloat()
101
    {
102
        return this.data;
103
    }
104
}
105

Deobfuscated MCP 1.8.9 source of NBTTagFloat from Marcelektro/MavenMCP-1.8.9 (net/minecraft/nbt/NBTTagFloat.java), stored verbatim.