public abstract class NBTCompoundTag extends NBTBaseTag<NBTCompoundTag>
NBTBaseTag
in the sense that its value (returned by NBTBaseTag.get()
)
is itself. This is generally the top level tag for most operations.Modifier and Type | Method and Description |
---|---|
NBTCompoundTag |
get() |
abstract <T> T |
get(java.lang.String key,
NBTType<T> type)
Retrieve a value from this map at the given key.
|
abstract boolean |
getBoolean(java.lang.String key)
Get a boolean value from this tag at the given key.
|
byte |
getByte(java.lang.String key)
Retrieve a byte value from the map.
|
byte[] |
getByteArray(java.lang.String key)
Retrieve a byte[] value from the map.
|
NBTCompoundTag |
getCompound(java.lang.String key)
Retrieve a compound value from the map.
|
double |
getDouble(java.lang.String key)
Retrieve a double value from the map.
|
float |
getFloat(java.lang.String key)
Retrieve a float value from the map.
|
int |
getInt(java.lang.String key)
Retrieve a int value from the map.
|
int[] |
getIntArray(java.lang.String key)
Retrieve a int[] value from the map.
|
NBTListTag |
getList(java.lang.String key)
Retrieve a list value from the map.
|
long |
getLong(java.lang.String key)
Retrieve a long value from the map.
|
short |
getShort(java.lang.String key)
Retrieve a short value from the map.
|
java.lang.String |
getString(java.lang.String key)
Retrieve a String value from the map.
|
abstract NBTBaseTag |
getTag(java.lang.String key)
Retrieve a tag from this map at the given key.
|
java.util.UUID |
getUUID(java.lang.String key)
Retrieve a UUID value from the map.
|
abstract boolean |
hasKey(java.lang.String key)
Check if the key is a mapping to a non-null value in this map.
|
abstract boolean |
hasKeyOfType(java.lang.String key,
NBTType type)
Check if the key is a mapping to a non-null value of the given
type.
|
boolean |
hasKeyOfUUID(java.lang.String key)
Check if there is a UUID stored in this mapping at the given key.
|
abstract java.util.Set<java.lang.String> |
keys()
Get a
Set containing the names of all of the named tags inside
this tag. |
java.lang.String |
prettyPrint()
Print this tag with newline and tabs for an easier to read
string for a human.
|
abstract void |
put(java.lang.String key,
NBTBaseTag value)
Put a new mapping into this tag.
|
abstract void |
putAll(NBTCompoundTag tag)
Put all of the mappings from
tag into this tag. |
abstract void |
putBoolean(java.lang.String key,
boolean value)
Put a boolean in the map at the specified key.
|
void |
putByte(java.lang.String key,
byte value)
Put a byte in the map that can be retrieved with
getByte(String) . |
void |
putByteArray(java.lang.String key,
byte[] value)
Put a byte[] in the map that can be retrieved with
getByteArray(String) . |
void |
putCompound(java.lang.String key,
NBTCompoundTag value)
Put a compound tag in the map that can be retrieved with
getCompound(String) . |
void |
putDouble(java.lang.String key,
double value)
Put a double in the map that can be retrieved with
getDouble(String) . |
void |
putFloat(java.lang.String key,
float value)
Put a float in the map that can be retrieved with
getFloat(String) . |
void |
putInt(java.lang.String key,
int value)
Put an int in the map that can be retrieved with
getInt(String) . |
void |
putIntArray(java.lang.String key,
int[] value)
Put an int[] in the map that can be retrieved with
getIntArray(String) . |
void |
putList(java.lang.String key,
NBTListTag value)
Put a list of tags in the map that can be retrieved with
getList(String) . |
void |
putLong(java.lang.String key,
long value)
Put a long in the map that can be retrieved with
getLong(String) . |
void |
putShort(java.lang.String key,
short value)
Put a short in the map that can be retrieved with
getShort(String) . |
void |
putString(java.lang.String key,
java.lang.String value)
Put a String in the map that can be retrieved with
getString(String) . |
void |
putUUID(java.lang.String key,
java.util.UUID value)
Put a UUID in the map that can be retrieved with
getUUID(String) . |
abstract void |
remove(java.lang.String key)
Remove the mapping for the given key.
|
void |
removeUUID(java.lang.String key)
Remove the mapping for a UUID key.
|
abstract int |
size()
Get the number of tags inside this tag.
|
NBTType<NBTCompoundTag> |
type() |
equals, getHandle, hashCode, isCompound, isNumber, toString
public final java.lang.String prettyPrint()
public abstract void put(java.lang.String key, NBTBaseTag value)
key
- the key of the mapping that can be used later to retrieve the
value
via one of the get methods.value
- the value to put at the specified keypublic abstract void putAll(NBTCompoundTag tag)
tag
into this tag.tag
- thepublic abstract <T> T get(java.lang.String key, NBTType<T> type)
T
- the return type of the value tagkey
- the key that the value is located at.type
- the expected type of the value tag.public abstract NBTBaseTag getTag(java.lang.String key)
key
- the key that the desired value is located at.public abstract void remove(java.lang.String key)
removeUUID(String)
.key
- the key of the mapping to remove from this tag.public abstract boolean hasKey(java.lang.String key)
key
- the key who's existence is being checkedgetTag(String)
will not return null for the checked key.public abstract boolean hasKeyOfType(java.lang.String key, NBTType type)
key
- the key who's existence is being checked.type
- the type that the key should point toget(String, NBTType)
will not return null for the checked key and type.public abstract int size()
public abstract java.util.Set<java.lang.String> keys()
Set
containing the names of all of the named tags inside
this tag.public abstract void putBoolean(java.lang.String key, boolean value)
key
- the key pointing to the booleanvalue
- the value to storepublic abstract boolean getBoolean(java.lang.String key)
key
- the key pointing to the boolean to retrieve.key
. This
will return false if the key doesn't exist in the map or points
to a tag of an incompatible type.public NBTType<NBTCompoundTag> type()
type
in class NBTBaseTag<NBTCompoundTag>
public NBTCompoundTag get()
get
in class NBTBaseTag<NBTCompoundTag>
public void putByte(java.lang.String key, byte value)
getByte(String)
.
This will overwrite any existing mappings for the given key.key
- the key at which to store the valuevalue
- the byte value to store.public byte getByte(java.lang.String key)
but returning a 0 byte instead of null.get
(key,NBTType.BYTE
)
key
- the key that the byte value was put at.public void putShort(java.lang.String key, short value)
getShort(String)
.
This will overwrite any existing mappings for the given key.key
- the key at which to store the valuevalue
- the short value to store.public short getShort(java.lang.String key)
but returning a 0 short instead of null.get
(key,NBTType.SHORT
)
key
- the key that the short value was put at.public void putInt(java.lang.String key, int value)
getInt(String)
.
This will overwrite any existing mappings for the given key.key
- the key at which to store the valuevalue
- the int value to store.public int getInt(java.lang.String key)
but returning a 0 int instead of null.get
(key,NBTType.INT
)
key
- the key that the int value was put at.public void putLong(java.lang.String key, long value)
getLong(String)
.
This will overwrite any existing mappings for the given key.key
- the key at which to store the valuevalue
- the long value to store.public long getLong(java.lang.String key)
but returning a 0 long instead of null.get
(key,NBTType.LONG
)
key
- the key that the long value was put at.public void putFloat(java.lang.String key, float value)
getFloat(String)
.
This will overwrite any existing mappings for the given key.key
- the key at which to store the valuevalue
- the float value to store.public float getFloat(java.lang.String key)
but returning a 0 float instead of null.get
(key,NBTType.FLOAT
)
key
- the key that the float value was put at.public void putDouble(java.lang.String key, double value)
getDouble(String)
.
This will overwrite any existing mappings for the given key.key
- the key at which to store the valuevalue
- the double value to store.public double getDouble(java.lang.String key)
but returning a 0 double instead of null.get
(key,NBTType.DOUBLE
)
key
- the key that the double value was put at.public void putByteArray(java.lang.String key, byte[] value)
getByteArray(String)
.
This will overwrite any existing mappings for the given key.key
- the key at which to store the valuevalue
- the byte[] value to store.public byte[] getByteArray(java.lang.String key)
but returning an empty byte array instead of null.get
(key,NBTType.BYTE_ARRAY
)
key
- the key that the byte[] value was put at.public void putString(java.lang.String key, java.lang.String value)
getString(String)
.
This will overwrite any existing mappings for the given key.key
- the key at which to store the valuevalue
- the String value to store.public java.lang.String getString(java.lang.String key)
but returning an empty String instead of null. (get
(key,NBTType.STRING
)
""
)key
- the key that the String value was put at.public void putList(java.lang.String key, NBTListTag value)
getList(String)
.
This will overwrite any existing mappings for the given key.key
- the key at which to store the valuevalue
- the list value to store.public NBTListTag getList(java.lang.String key)
but returning a new list instead of null.get
(key,NBTType.LIST
)
key
- the key that the list value was put at.public void putCompound(java.lang.String key, NBTCompoundTag value)
getCompound(String)
.
This will overwrite any existing mappings for the given key.key
- the key at which to store the valuevalue
- the compound value to store.public NBTCompoundTag getCompound(java.lang.String key)
but returning a new compound instead of null.get
(key,NBTType.COMPOUND
)
key
- the key that the compound value was put at.public void putIntArray(java.lang.String key, int[] value)
getIntArray(String)
.
This will overwrite any existing mappings for the given key.key
- the key at which to store the valuevalue
- the int[] value to store.public int[] getIntArray(java.lang.String key)
but returning an empty int array instead of null.get
(key,NBTType.INT_ARRAY
)
key
- the key that the int[] value was put at.public void putUUID(java.lang.String key, java.util.UUID value)
getUUID(String)
.
This will overwrite any existing mappings for the given key. This is really
just putting 2 longs in the map that can be used to reconstruct the UUID.key
- the key at which to store the valuevalue
- the UUID value to store.hasKeyOfUUID(String)
public java.util.UUID getUUID(java.lang.String key)
getLong(String)
calls to build the UUID. If parts of the serialized UUID are missing this method
will still return a UUID with 0 for the least significant bits, most significant
bits or both. Check the existence of a UUID with hasKeyOfUUID(String)
to be
safe.key
- the key that the UUID value was put at.public boolean hasKeyOfUUID(java.lang.String key)
key
- the key that the UUID was put into the map with.public void removeUUID(java.lang.String key)
remove(String)
.key
- the key of the mapping to remove from this tag.