NBTTagIntArray .java

net.minecraft.nbt.NBTTagIntArray (class, 93 lines): extends NBTBase. members: intArray, getIntArray, copy, getId, hashCode, equals, toString.

net.minecraft.nbtclass93 linescommonextends NBTBase1.9 KB

API Surface (6)

byte getId()
String toString()
NBTBase copy()
boolean equals(Object p_equals_1_)
int hashCode()
int[] getIntArray()

Fields & Constants (1)

intArray

Code Graph: Dependencies (2)

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

Full Source

NBTTagIntArray.java93 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 java.util.Arrays;
7
8
public class NBTTagIntArray extends NBTBase
9
{
10
    /** The array of saved integers */
11
    private int[] intArray;
12
13
    NBTTagIntArray()
14
    {
15
    }
16
17
    public NBTTagIntArray(int[] p_i45132_1_)
18
    {
19
        this.intArray = p_i45132_1_;
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.writeInt(this.intArray.length);
28
29
        for (int i = 0; i < this.intArray.length; ++i)
30
        {
31
            output.writeInt(this.intArray[i]);
32
        }
33
    }
34
35
    void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException
36
    {
37
        sizeTracker.read(192L);
38
        int i = input.readInt();
39
        sizeTracker.read((long)(32 * i));
40
        this.intArray = new int[i];
41
42
        for (int j = 0; j < i; ++j)
43
        {
44
            this.intArray[j] = input.readInt();
45
        }
46
    }
47
48
    /**
49
     * Gets the type byte for the tag.
50
     */
51
    public byte getId()
52
    {
53
        return (byte)11;
54
    }
55
56
    public String toString()
57
    {
58
        String s = "[";
59
60
        for (int i : this.intArray)
61
        {
62
            s = s + i + ",";
63
        }
64
65
        return s + "]";
66
    }
67
68
    /**
69
     * Creates a clone of the tag.
70
     */
71
    public NBTBase copy()
72
    {
73
        int[] aint = new int[this.intArray.length];
74
        System.arraycopy(this.intArray, 0, aint, 0, this.intArray.length);
75
        return new NBTTagIntArray(aint);
76
    }
77
78
    public boolean equals(Object p_equals_1_)
79
    {
80
        return super.equals(p_equals_1_) ? Arrays.equals(this.intArray, ((NBTTagIntArray)p_equals_1_).intArray) : false;
81
    }
82
83
    public int hashCode()
84
    {
85
        return super.hashCode() ^ Arrays.hashCode(this.intArray);
86
    }
87
88
    public int[] getIntArray()
89
    {
90
        return this.intArray;
91
    }
92
}
93

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