Package net.minecraft.nbt
Class CompoundTag
java.lang.Object
net.minecraft.nbt.CompoundTag
- All Implemented Interfaces:
Tag
public class CompoundTag extends Object implements Tag
-
Field Summary
Fields Modifier and Type Field Description static com.mojang.serialization.Codec<CompoundTag>CODECstatic TagReader<CompoundTag>READERprivate Map<String,Tag>tags -
Constructor Summary
Constructors Modifier Constructor Description CompoundTag()protectedCompoundTag(Map<String,Tag> tags) -
Method Summary
Modifier and Type Method Description voidaccept(NbtTagVisitor visitor)booleancontains(String key)booleancontains(String key, int type)booleancontainsUuid(String key)Returnstrueif thisCompoundTagcontains a valid UUID representation associated with the given key.CompoundTagcopy()CompoundTagcopyFrom(CompoundTag source)private CrashReportcreateCrashReport(String key, TagReader<?> tagReader, ClassCastException classCastException)booleanequals(Object o)Tagget(String key)booleangetBoolean(String key)bytegetByte(String key)byte[]getByteArray(String key)CompoundTaggetCompound(String key)doublegetDouble(String key)floatgetFloat(String key)intgetInt(String key)int[]getIntArray(String key)Set<String>getKeys()ListTaggetList(String key, int type)longgetLong(String key)long[]getLongArray(String key)TagReader<CompoundTag>getReader()shortgetShort(String key)intgetSize()StringgetString(String key)bytegetType()bytegetType(String key)UUIDgetUuid(String key)Reads aUUIDfrom its NBT representation in thisCompoundTag.inthashCode()booleanisEmpty()Tagput(String key, Tag tag)voidputBoolean(String key, boolean value)voidputByte(String key, byte value)voidputByteArray(String key, byte[] value)voidputDouble(String key, double value)voidputFloat(String key, float value)voidputInt(String key, int value)voidputIntArray(String key, int[] value)voidputIntArray(String key, List<Integer> value)voidputLong(String key, long value)voidputLongArray(String key, long[] value)voidputLongArray(String key, List<Long> value)voidputShort(String key, short value)voidputString(String key, String value)voidputUuid(String key, UUID value)Writes aUUIDto its NBT representation in thisCompoundTag.private static Tagread(TagReader<?> reader, String key, DataInput input, int depth, PositionTracker tracker)private static bytereadByte(DataInput input, PositionTracker tracker)private static StringreadString(DataInput input, PositionTracker tracker)voidremove(String key)protected Map<String,Tag>toMap()StringtoString()voidwrite(DataOutput output)private static voidwrite(String key, Tag tag, DataOutput output)
-
Field Details
-
CODEC
-
READER
-
tags
-
-
Constructor Details
-
CompoundTag
-
CompoundTag
public CompoundTag()
-
-
Method Details
-
write
- Specified by:
writein interfaceTag- Throws:
IOException
-
getKeys
-
getType
public byte getType() -
getReader
-
getSize
public int getSize() -
put
-
putByte
-
putShort
-
putInt
-
putLong
-
putUuid
Writes aUUIDto its NBT representation in thisCompoundTag. -
getUuid
Reads aUUIDfrom its NBT representation in thisCompoundTag. -
containsUuid
Returnstrueif thisCompoundTagcontains a valid UUID representation associated with the given key. A valid UUID is represented by an int array of length 4. -
putFloat
-
putDouble
-
putString
-
putByteArray
-
putIntArray
-
putIntArray
-
putLongArray
-
putLongArray
-
putBoolean
-
get
-
getType
-
contains
-
contains
-
getByte
-
getShort
-
getInt
-
getLong
-
getFloat
-
getDouble
-
getString
-
getByteArray
-
getIntArray
-
getLongArray
-
getCompound
-
getList
-
getBoolean
-
remove
-
toString
-
isEmpty
public boolean isEmpty() -
createCrashReport
private CrashReport createCrashReport(String key, TagReader<?> tagReader, ClassCastException classCastException) -
copy
-
equals
-
hashCode
public int hashCode() -
write
- Throws:
IOException
-
readByte
- Throws:
IOException
-
readString
- Throws:
IOException
-
read
private static Tag read(TagReader<?> reader, String key, DataInput input, int depth, PositionTracker tracker) -
copyFrom
-
accept
-
toMap
-