public final class NbtFactory.NbtCompound
extends java.util.AbstractMap<java.lang.String,java.lang.Object>
All changes to this map will be reflected in the underlying NBT compound. Values may only be one of the following:
String
NbtFactory.NbtList
NbtFactory.NbtCompound
See also:
Modifier and Type | Method and Description |
---|---|
java.lang.Byte |
getByte(java.lang.String key,
java.lang.Byte defaultValue) |
byte[] |
getByteArray(java.lang.String key,
byte[] defaultValue) |
java.lang.Double |
getDouble(java.lang.String key,
java.lang.Double defaultValue) |
java.lang.Float |
getFloat(java.lang.String key,
java.lang.Float defaultValue) |
java.lang.Integer |
getInteger(java.lang.String key,
java.lang.Integer defaultValue) |
int[] |
getIntegerArray(java.lang.String key,
int[] defaultValue) |
NbtFactory.NbtList |
getList(java.lang.String key,
boolean createNew)
Retrieve the list by the given name.
|
java.lang.Long |
getLong(java.lang.String key,
java.lang.Long defaultValue) |
NbtFactory.NbtCompound |
getMap(java.lang.String key,
boolean createNew)
Retrieve the map by the given name.
|
<T> T |
getPath(java.lang.String path)
Retrieve the value of a given entry in the tree.
|
java.lang.Short |
getShort(java.lang.String key,
java.lang.Short defaultValue) |
java.lang.String |
getString(java.lang.String key,
java.lang.String defaultValue) |
NbtFactory.NbtCompound |
putPath(java.lang.String path,
java.lang.Object value)
Set the value of an entry at a given location.
|
NbtFactory.NbtCompound |
saveTo(com.google.common.io.ByteSink stream,
NbtFactory.StreamOptions option)
Save the content of a NBT compound to a stream.
|
public java.lang.Byte getByte(java.lang.String key, java.lang.Byte defaultValue)
public java.lang.Short getShort(java.lang.String key, java.lang.Short defaultValue)
public java.lang.Integer getInteger(java.lang.String key, java.lang.Integer defaultValue)
public java.lang.Long getLong(java.lang.String key, java.lang.Long defaultValue)
public java.lang.Float getFloat(java.lang.String key, java.lang.Float defaultValue)
public java.lang.Double getDouble(java.lang.String key, java.lang.Double defaultValue)
public java.lang.String getString(java.lang.String key, java.lang.String defaultValue)
public byte[] getByteArray(java.lang.String key, byte[] defaultValue)
public int[] getIntegerArray(java.lang.String key, int[] defaultValue)
public NbtFactory.NbtList getList(java.lang.String key, boolean createNew)
key
- - the name of the list.createNew
- - whether or not to create a new list if its missing.public NbtFactory.NbtCompound getMap(java.lang.String key, boolean createNew)
key
- - the name of the map.createNew
- - whether or not to create a new map if its missing.public NbtFactory.NbtCompound putPath(java.lang.String path, java.lang.Object value)
Every element of the path (except the end) are assumed to be compounds, and will be created if they are missing.
path
- - the path to the entry.value
- - the new value of this entry.public <T> T getPath(java.lang.String path)
Every element of the path (except the end) are assumed to be compounds. The retrieval operation will be cancelled if any of them are missing.
path
- - path to the entry.public NbtFactory.NbtCompound saveTo(com.google.common.io.ByteSink stream, NbtFactory.StreamOptions option) throws java.io.IOException
Use Files#newOutputStreamSupplier(java.io.File)
to provide a stream supplier to a file.
stream
- - the output stream.option
- - whether or not to compress the output.java.io.IOException
- If anything went wrong.