public abstract class Tag
extends java.lang.Object
NBT is a tree structure. Compound and List tags are internal nodes in the tree, while other tag types are leafs.
| Modifier and Type | Field and Description |
|---|---|
static SpecificTag |
END |
static int |
TAG_BYTE |
static int |
TAG_BYTE_ARRAY |
static int |
TAG_COMPOUND |
static int |
TAG_DOUBLE |
static int |
TAG_END |
static int |
TAG_FLOAT |
static int |
TAG_INT |
static int |
TAG_INT_ARRAY |
static int |
TAG_LIST |
static int |
TAG_LONG |
static int |
TAG_LONG_ARRAY |
static int |
TAG_SHORT |
static int |
TAG_STRING |
| Modifier | Constructor and Description |
|---|---|
protected |
Tag() |
| Modifier and Type | Method and Description |
|---|---|
CompoundTag |
asCompound()
Returns this tag if it is a list tag, otherwise an empty list.
|
ListTag |
asList()
Returns this tag if it is a list tag, otherwise an empty list.
|
boolean |
boolValue() |
boolean |
boolValue(boolean defaultValue) |
byte[] |
byteArray() |
byte[] |
byteArray(byte[] defaultValue) |
int |
byteValue() |
int |
byteValue(int defaultValue) |
double |
doubleValue() |
double |
doubleValue(double defaultValue) |
java.lang.String |
dumpTree()
Builds a string representation of this NBT tag and its children.
|
java.lang.String |
error()
Gives the error message for an error tag.
|
java.lang.String |
extraInfo()
Extra information for this tag, printed in the tree dump.
|
float |
floatValue() |
float |
floatValue(float defaultValue) |
Tag |
get(int i) |
Tag |
get(java.lang.String name) |
int[] |
intArray() |
int[] |
intArray(int[] defaultValue) |
int |
intValue() |
int |
intValue(int defaultValue) |
boolean |
isByteArray(int size)
Test if this is an int array with a size greater or equal to the given size.
|
boolean |
isCompoundTag() |
boolean |
isEnd() |
boolean |
isError() |
boolean |
isIntArray(int size)
Test if this is an int array with a size greater or equal to the given size.
|
boolean |
isList() |
boolean |
isLongArray(int size)
Test if this is a long array with a size greater or equal to the given size.
|
boolean |
isNamed(java.lang.String name)
Test if this is a named tag with the given name.
|
long[] |
longArray() |
long[] |
longArray(long[] defaultValue) |
long |
longValue() |
long |
longValue(long defaultValue) |
void |
printTag(java.lang.StringBuilder buff,
java.lang.String indent)
Print a string representation of this tag to the argument buffer.
|
void |
printTagInfo(java.lang.StringBuilder buff)
Print a string representation of this tag to the argument buffer.
|
boolean |
same(java.lang.String name)
Test if this is a string tag that contains the given string.
|
void |
set(int i,
SpecificTag tag) |
void |
set(java.lang.String name,
Tag tag) |
short |
shortValue() |
short |
shortValue(short defaultValue) |
java.lang.String |
stringValue() |
java.lang.String |
stringValue(java.lang.String defaultValue) |
abstract java.lang.String |
tagName() |
java.lang.String |
toString() |
Tag |
unpack()
Unwraps a named tag.
|
abstract void |
write(java.io.DataOutputStream out) |
public static final int TAG_END
public static final int TAG_BYTE
public static final int TAG_SHORT
public static final int TAG_INT
public static final int TAG_LONG
public static final int TAG_FLOAT
public static final int TAG_DOUBLE
public static final int TAG_BYTE_ARRAY
public static final int TAG_STRING
public static final int TAG_LIST
public static final int TAG_COMPOUND
public static final int TAG_INT_ARRAY
public static final int TAG_LONG_ARRAY
public static final SpecificTag END
public abstract java.lang.String tagName()
public boolean isError()
public boolean isNamed(java.lang.String name)
true if this is a named tag with the given name.public boolean same(java.lang.String name)
public java.lang.String dumpTree()
public void printTagInfo(java.lang.StringBuilder buff)
public void printTag(java.lang.StringBuilder buff,
java.lang.String indent)
public java.lang.String extraInfo()
public abstract void write(java.io.DataOutputStream out)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean isEnd()
public Tag unpack()
public java.lang.String error()
public boolean boolValue()
public boolean boolValue(boolean defaultValue)
public int byteValue()
public int byteValue(int defaultValue)
public short shortValue()
public short shortValue(short defaultValue)
public int intValue()
public int intValue(int defaultValue)
public long longValue()
public long longValue(long defaultValue)
public float floatValue()
public float floatValue(float defaultValue)
public double doubleValue()
public double doubleValue(double defaultValue)
public java.lang.String stringValue()
public java.lang.String stringValue(java.lang.String defaultValue)
public byte[] byteArray()
public byte[] byteArray(byte[] defaultValue)
public int[] intArray()
public int[] intArray(int[] defaultValue)
public long[] longArray()
public long[] longArray(long[] defaultValue)
public boolean isCompoundTag()
public boolean isList()
public boolean isByteArray(int size)
public boolean isIntArray(int size)
public boolean isLongArray(int size)
public Tag get(java.lang.String name)
public void set(java.lang.String name,
Tag tag)
public void set(int i,
SpecificTag tag)
public Tag get(int i)
public ListTag asList()
public CompoundTag asCompound()