public class NBTTagCompound extends NBTBase
NBTBase.NBTPrimitive
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,NBTBase> |
tagMap |
Constructor and Description |
---|
NBTTagCompound() |
Modifier and Type | Method and Description |
---|---|
NBTBase |
copy()
Creates a clone of the tag.
|
private CrashReport |
createCrashReport(java.lang.String key,
int expectedType,
java.lang.ClassCastException ex)
Create a crash report which indicates a NBT read error.
|
boolean |
equals(java.lang.Object p_equals_1_) |
boolean |
getBoolean(java.lang.String key)
Retrieves a boolean value using the specified key, or false if no such key was stored.
|
byte |
getByte(java.lang.String key)
Retrieves a byte value using the specified key, or 0 if no such key was stored.
|
byte[] |
getByteArray(java.lang.String key)
Retrieves a byte array using the specified key, or a zero-length array if no such key was stored.
|
NBTTagCompound |
getCompoundTag(java.lang.String key)
Retrieves a NBTTagCompound subtag matching the specified key, or a new empty NBTTagCompound if no such key was
stored.
|
double |
getDouble(java.lang.String key)
Retrieves a double value using the specified key, or 0 if no such key was stored.
|
float |
getFloat(java.lang.String key)
Retrieves a float value using the specified key, or 0 if no such key was stored.
|
byte |
getId()
Gets the type byte for the tag.
|
int[] |
getIntArray(java.lang.String key)
Retrieves an int array using the specified key, or a zero-length array if no such key was stored.
|
int |
getInteger(java.lang.String key)
Retrieves an integer value using the specified key, or 0 if no such key was stored.
|
java.util.Set<java.lang.String> |
getKeySet() |
long |
getLong(java.lang.String key)
Retrieves a long value using the specified key, or 0 if no such key was stored.
|
short |
getShort(java.lang.String key)
Retrieves a short value using the specified key, or 0 if no such key was stored.
|
java.lang.String |
getString(java.lang.String key)
Retrieves a string value using the specified key, or an empty string if no such key was stored.
|
NBTBase |
getTag(java.lang.String key)
gets a generic tag with the specified name
|
byte |
getTagId(java.lang.String key)
Gets the ID byte for the given tag key
|
NBTTagList |
getTagList(java.lang.String key,
int type)
Gets the NBTTagList object with the given name.
|
int |
hashCode() |
boolean |
hasKey(java.lang.String key)
Returns whether the given string has been previously stored as a key in the map.
|
boolean |
hasKey(java.lang.String key,
int type) |
boolean |
hasNoTags()
Return whether this compound has no tags.
|
void |
merge(NBTTagCompound other)
Merges this NBTTagCompound with the given compound.
|
(package private) void |
read(java.io.DataInput input,
int depth,
NBTSizeTracker sizeTracker) |
private static java.lang.String |
readKey(java.io.DataInput input,
NBTSizeTracker sizeTracker) |
(package private) static NBTBase |
readNBT(byte id,
java.lang.String key,
java.io.DataInput input,
int depth,
NBTSizeTracker sizeTracker) |
private static byte |
readType(java.io.DataInput input,
NBTSizeTracker sizeTracker) |
void |
removeTag(java.lang.String key)
Remove the specified tag.
|
void |
setBoolean(java.lang.String key,
boolean value)
Stores the given boolean value as a NBTTagByte, storing 1 for true and 0 for false, using the given string key.
|
void |
setByte(java.lang.String key,
byte value)
Stores a new NBTTagByte with the given byte value into the map with the given string key.
|
void |
setByteArray(java.lang.String key,
byte[] value)
Stores a new NBTTagByteArray with the given array as data into the map with the given string key.
|
void |
setDouble(java.lang.String key,
double value)
Stores a new NBTTagDouble with the given double value into the map with the given string key.
|
void |
setFloat(java.lang.String key,
float value)
Stores a new NBTTagFloat with the given float value into the map with the given string key.
|
void |
setIntArray(java.lang.String key,
int[] value)
Stores a new NBTTagIntArray with the given array as data into the map with the given string key.
|
void |
setInteger(java.lang.String key,
int value)
Stores a new NBTTagInt with the given integer value into the map with the given string key.
|
void |
setLong(java.lang.String key,
long value)
Stores a new NBTTagLong with the given long value into the map with the given string key.
|
void |
setShort(java.lang.String key,
short value)
Stores a new NBTTagShort with the given short value into the map with the given string key.
|
void |
setString(java.lang.String key,
java.lang.String value)
Stores a new NBTTagString with the given string value into the map with the given string key.
|
void |
setTag(java.lang.String key,
NBTBase value)
Stores the given tag into the map with the given string key.
|
java.lang.String |
toString() |
(package private) void |
write(java.io.DataOutput output)
Write the actual data contents of the tag, implemented in NBT extension classes
|
private static void |
writeEntry(java.lang.String name,
NBTBase data,
java.io.DataOutput output) |
createNewByType, getString
private java.util.Map<java.lang.String,NBTBase> tagMap
void write(java.io.DataOutput output) throws java.io.IOException
void read(java.io.DataInput input, int depth, NBTSizeTracker sizeTracker) throws java.io.IOException
public java.util.Set<java.lang.String> getKeySet()
public void setTag(java.lang.String key, NBTBase value)
public void setByte(java.lang.String key, byte value)
public void setShort(java.lang.String key, short value)
public void setInteger(java.lang.String key, int value)
public void setLong(java.lang.String key, long value)
public void setFloat(java.lang.String key, float value)
public void setDouble(java.lang.String key, double value)
public void setString(java.lang.String key, java.lang.String value)
public void setByteArray(java.lang.String key, byte[] value)
public void setIntArray(java.lang.String key, int[] value)
public void setBoolean(java.lang.String key, boolean value)
public NBTBase getTag(java.lang.String key)
public byte getTagId(java.lang.String key)
public boolean hasKey(java.lang.String key)
public boolean hasKey(java.lang.String key, int type)
public byte getByte(java.lang.String key)
public short getShort(java.lang.String key)
public int getInteger(java.lang.String key)
public long getLong(java.lang.String key)
public float getFloat(java.lang.String key)
public double getDouble(java.lang.String key)
public java.lang.String getString(java.lang.String key)
public byte[] getByteArray(java.lang.String key)
public int[] getIntArray(java.lang.String key)
public NBTTagCompound getCompoundTag(java.lang.String key)
public NBTTagList getTagList(java.lang.String key, int type)
public boolean getBoolean(java.lang.String key)
public void removeTag(java.lang.String key)
public boolean hasNoTags()
private CrashReport createCrashReport(java.lang.String key, int expectedType, java.lang.ClassCastException ex)
private static void writeEntry(java.lang.String name, NBTBase data, java.io.DataOutput output) throws java.io.IOException
java.io.IOException
private static byte readType(java.io.DataInput input, NBTSizeTracker sizeTracker) throws java.io.IOException
java.io.IOException
private static java.lang.String readKey(java.io.DataInput input, NBTSizeTracker sizeTracker) throws java.io.IOException
java.io.IOException
static NBTBase readNBT(byte id, java.lang.String key, java.io.DataInput input, int depth, NBTSizeTracker sizeTracker) throws java.io.IOException
java.io.IOException
public void merge(NBTTagCompound other)