public interface NbtCompound extends NbtBase<java.util.Map<java.lang.String,NbtBase<?>>>, java.lang.Iterable<NbtBase<?>>
Use NbtFactory to load or create an instance.
The NbtBase.getValue() method returns a Map that will return the full content
of this NBT compound, but may throw an UnsupportedOperationException for any of the write operations.
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(java.lang.String key)
Determine if an entry with the given key exists or not.
|
byte |
getByte(java.lang.String key)
Retrieve the byte value of an entry identified by a given key.
|
byte[] |
getByteArray(java.lang.String key)
Retrieve the byte array value of an entry identified by a given key.
|
byte |
getByteOrDefault(java.lang.String key)
Retrieve the byte value of an existing entry, or from a new default entry if it doesn't exist.
|
NbtCompound |
getCompound(java.lang.String key)
Retrieve the compound (map) value of an entry identified by a given key.
|
NbtCompound |
getCompoundOrDefault(java.lang.String key)
Retrieve a compound (map) value by its key, or create a new compound if it doesn't exist.
|
double |
getDouble(java.lang.String key)
Retrieve the double value of an entry identified by a given key.
|
double |
getDoubleOrDefault(java.lang.String key)
Retrieve the double value of an existing entry, or from a new default entry if it doesn't exist.
|
float |
getFloat(java.lang.String key)
Retrieve the float value of an entry identified by a given key.
|
float |
getFloatOrDefault(java.lang.String key)
Retrieve the float value of an existing entry, or from a new default entry if it doesn't exist.
|
int |
getInteger(java.lang.String key)
Retrieve the integer value of an entry identified by a given key.
|
int[] |
getIntegerArray(java.lang.String key)
Retrieve the integer array value of an entry identified by a given key.
|
int |
getIntegerOrDefault(java.lang.String key)
Retrieve the integer value of an existing entry, or from a new default entry if it doesn't exist.
|
java.util.Set<java.lang.String> |
getKeys()
Retrieve a Set view of the keys of each entry in this compound.
|
<T> NbtList<T> |
getList(java.lang.String key)
Retrieve the NBT list value of an entry identified by a given key.
|
<T> NbtList<T> |
getListOrDefault(java.lang.String key)
Retrieve a NBT list value by its key, or create a new list if it doesn't exist.
|
long |
getLong(java.lang.String key)
Retrieve the long value of an entry identified by a given key.
|
long |
getLongOrDefault(java.lang.String key)
Retrieve the long value of an existing entry, or from a new default entry if it doesn't exist.
|
java.lang.Object |
getObject(java.lang.String key)
Retrieve the primitive object, NbtList or NbtCompound associated with the given key.
|
java.lang.Short |
getShort(java.lang.String key)
Retrieve the short value of an entry identified by a given key.
|
short |
getShortOrDefault(java.lang.String key)
Retrieve the short value of an existing entry, or from a new default entry if it doesn't exist.
|
java.lang.String |
getString(java.lang.String key)
Retrieve the string value of an entry identified by a given key.
|
java.lang.String |
getStringOrDefault(java.lang.String key)
Retrieve the string value of an existing entry, or from a new default entry if it doesn't exist.
|
java.util.Map<java.lang.String,NbtBase<?>> |
getValue()
Deprecated.
|
<T> NbtBase<T> |
getValue(java.lang.String key)
Retrieve the value of a given entry.
|
NbtBase<?> |
getValueOrDefault(java.lang.String key,
NbtType type)
Retrieve a value by its key, or assign and return a new NBT element if it doesn't exist.
|
java.util.Iterator<NbtBase<?>> |
iterator()
Retrieve an iterator view of the NBT tags stored in this compound.
|
<T> NbtCompound |
put(NbtBase<T> entry)
Set a entry based on its name.
|
NbtCompound |
put(NbtCompound compound)
Associate a NBT compound with its name as key.
|
<T> NbtCompound |
put(NbtList<T> list)
Associate a NBT list with the given key.
|
NbtCompound |
put(java.lang.String key,
byte value)
Associate a NBT byte value with the given key.
|
NbtCompound |
put(java.lang.String key,
byte[] value)
Associate a NBT byte array value with the given key.
|
<T> NbtCompound |
put(java.lang.String key,
java.util.Collection<? extends NbtBase<T>> list)
Associate a new NBT list with the given key.
|
NbtCompound |
put(java.lang.String key,
double value)
Associate a NBT double value with the given key.
|
NbtCompound |
put(java.lang.String key,
float value)
Associate a NBT float value with the given key.
|
NbtCompound |
put(java.lang.String key,
int value)
Associate a NBT integer value with the given key.
|
NbtCompound |
put(java.lang.String key,
int[] value)
Associate a NBT integer array value with the given key.
|
NbtCompound |
put(java.lang.String key,
long value)
Associate a NBT long value with the given key.
|
NbtCompound |
put(java.lang.String key,
NbtBase<?> entry)
Inserts an entry after cloning it and renaming it to "key".
|
NbtCompound |
put(java.lang.String key,
short value)
Associate a NBT short value with the given key.
|
NbtCompound |
put(java.lang.String key,
java.lang.String value)
Associate a NBT string value with the given key.
|
NbtCompound |
putObject(java.lang.String key,
java.lang.Object value)
Associates a given Java primitive value, list, map or NbtBase> with a certain key.
|
<T> NbtBase<?> |
remove(java.lang.String key)
Remove the NBT element that is associated with the given key.
|
@Deprecated java.util.Map<java.lang.String,NbtBase<?>> getValue()
NbtBase
Is either a primitive wrapper, String,
List or a Map.
Users are encouraged to cast an NBT compound to NbtCompound and use its put and get-methods
instead of accessing its content from getValue().
All operations that modify collections directly, such as List.add(Object) or
Map.clear(), are considered optional. This also include members in Iterator and
ListIterator. Operations that are not implemented throw a
UnsupportedOperationException.
boolean containsKey(java.lang.String key)
key - - the key to lookup.java.util.Set<java.lang.String> getKeys()
<T> NbtBase<T> getValue(java.lang.String key)
key - - key of the entry to retrieve.NbtBase<?> getValueOrDefault(java.lang.String key, NbtType type)
key - - the key of the entry to find or create.type - - the NBT element we will create if not found.<T> NbtCompound put(@Nonnull NbtBase<T> entry)
entry - - entry with a name and value.java.lang.IllegalArgumentException - If entry is NULL.java.lang.String getString(java.lang.String key)
key - - the key of the entry.java.lang.IllegalArgumentException - If the key doesn't exist.java.lang.String getStringOrDefault(java.lang.String key)
key - - the key of the entry.NbtCompound put(java.lang.String key, java.lang.String value)
key - - the key and NBT name.value - - the value.NbtCompound put(java.lang.String key, NbtBase<?> entry)
key - - the name of the entry.entry - - the entry to insert.byte getByte(java.lang.String key)
key - - the key of the entry.java.lang.IllegalArgumentException - If the key doesn't exist.byte getByteOrDefault(java.lang.String key)
key - - the key of the entry.NbtCompound put(java.lang.String key, byte value)
key - - the key and NBT name.value - - the value.java.lang.Short getShort(java.lang.String key)
key - - the key of the entry.java.lang.IllegalArgumentException - If the key doesn't exist.short getShortOrDefault(java.lang.String key)
key - - the key of the entry.NbtCompound put(java.lang.String key, short value)
key - - the key and NBT name.value - - the value.int getInteger(java.lang.String key)
key - - the key of the entry.java.lang.IllegalArgumentException - If the key doesn't exist.int getIntegerOrDefault(java.lang.String key)
key - - the key of the entry.NbtCompound put(java.lang.String key, int value)
key - - the key and NBT name.value - - the value.long getLong(java.lang.String key)
key - - the key of the entry.java.lang.IllegalArgumentException - If the key doesn't exist.long getLongOrDefault(java.lang.String key)
key - - the key of the entry.NbtCompound put(java.lang.String key, long value)
key - - the key and NBT name.value - - the value.float getFloat(java.lang.String key)
key - - the key of the entry.java.lang.IllegalArgumentException - If the key doesn't exist.float getFloatOrDefault(java.lang.String key)
key - - the key of the entry.NbtCompound put(java.lang.String key, float value)
key - - the key and NBT name.value - - the value.double getDouble(java.lang.String key)
key - - the key of the entry.java.lang.IllegalArgumentException - If the key doesn't exist.double getDoubleOrDefault(java.lang.String key)
key - - the key of the entry.NbtCompound put(java.lang.String key, double value)
key - - the key and NBT name.value - - the value.byte[] getByteArray(java.lang.String key)
key - - the key of the entry.java.lang.IllegalArgumentException - If the key doesn't exist.NbtCompound put(java.lang.String key, byte[] value)
key - - the key and NBT name.value - - the value.int[] getIntegerArray(java.lang.String key)
key - - the key of the entry.java.lang.IllegalArgumentException - If the key doesn't exist.NbtCompound put(java.lang.String key, int[] value)
key - - the key and NBT name.value - - the value.NbtCompound putObject(java.lang.String key, java.lang.Object value)
If the value is NULL, the corresponding key is removed. Any Map or List will be converted to a corresponding NbtCompound or NbtList.
key - - the name of the new entry,value - - the value of the new entry, or NULL to remove the current value.java.lang.Object getObject(java.lang.String key)
key - - the key of the object to find.NbtCompound getCompound(java.lang.String key)
key - - the key of the entry.java.lang.IllegalArgumentException - If the key doesn't exist.NbtCompound getCompoundOrDefault(java.lang.String key)
key - - the key of the entry to find or create.NbtCompound put(NbtCompound compound)
compound - - the compound value.<T> NbtList<T> getList(java.lang.String key)
key - - the key of the entry.java.lang.IllegalArgumentException - If the key doesn't exist.<T> NbtList<T> getListOrDefault(java.lang.String key)
key - - the key of the entry to find or create.<T> NbtCompound put(NbtList<T> list)
list - - the list value.<T> NbtCompound put(java.lang.String key, java.util.Collection<? extends NbtBase<T>> list)
key - - the key and name of the new NBT list.list - - the list of NBT elements.<T> NbtBase<?> remove(java.lang.String key)
key - - the key of the element to remove.