Package net.minecraft.nbt
Class CompoundTag
java.lang.Object
net.minecraft.nbt.CompoundTag
- All Implemented Interfaces:
Tag
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<CompoundTag> private static final org.slf4j.Loggerprivate static final intprivate static final intstatic final TagType<CompoundTag> Fields inherited from interface net.minecraft.nbt.Tag
ARRAY_HEADER, MAX_DEPTH, OBJECT_HEADER, OBJECT_REFERENCE, STRING_SIZE, TAG_BYTE, TAG_BYTE_ARRAY, TAG_COMPOUND, TAG_DOUBLE, TAG_END, TAG_FLOAT, TAG_INT, TAG_INT_ARRAY, TAG_LIST, TAG_LONG, TAG_LONG_ARRAY, TAG_SHORT, TAG_STRING -
Constructor Summary
ConstructorsConstructorDescriptionCompoundTag(int expectedEntries) Neo: create a compound tag that is generally suitable to hold the given amount of entries without needing to resize the internal map.CompoundTag(Map<String, Tag> pTags) -
Method Summary
Modifier and TypeMethodDescriptionaccept(StreamTagVisitor p_197442_) voidaccept(TagVisitor p_177857_) booleancopy()entrySet()booleanvoidforEach(BiConsumer<String, Tag> pAction) getBoolean(String pKey) booleangetBooleanOr(String pKey, boolean pDefaultValue) Optional<byte[]> getByteArray(String pKey) bytegetCompound(String pKey) getCompoundOrEmpty(String pKey) doublegetDoubleOr(String pKey, double pDefaultValue) floatgetFloatOr(String pKey, float pDefaultValue) bytegetId()Optional<int[]> getIntArray(String pKey) intgetListOrEmpty(String pKey) Optional<long[]> getLongArray(String pKey) longgetOptional(String pKey) shortgetShortOr(String pKey, short pDefaultValue) getStringOr(String pKey, String pDefaultValue) getType()inthashCode()booleanisEmpty()keySet()merge(CompoundTag pOther) Copies all the tags ofotherinto this tag, then returns itself.voidputBoolean(String pKey, boolean pValue) voidvoidputByteArray(String pKey, byte[] pValue) voidvoidvoidvoidputIntArray(String pKey, int[] pValue) voidvoidputLongArray(String pKey, long[] pValue) voidvoid<T> Optional<T> read(com.mojang.serialization.MapCodec<T> pMapCodec) <T> Optional<T> <T> Optional<T> <T> Optional<T> read(String pKey, com.mojang.serialization.Codec<T> pCodec, com.mojang.serialization.DynamicOps<Tag> pOps) (package private) static TagreadNamedTagData(TagType<?> pType, String pName, DataInput pInput, NbtAccounter pAccounter) voidprotected CompoundTagintsize()int<T> voidstore(com.mojang.serialization.MapCodec<T> pMapCodec, com.mojang.serialization.DynamicOps<Tag> pOps, T pData) <T> voidstore(com.mojang.serialization.MapCodec<T> pMapCodec, T pData) <T> voidstore(String pKey, com.mojang.serialization.Codec<T> pCodec, com.mojang.serialization.DynamicOps<Tag> pOps, T pData) <T> void<T> voidstoreNullable(String pKey, com.mojang.serialization.Codec<T> pCodec, com.mojang.serialization.DynamicOps<Tag> pOps, T pData) <T> voidstoreNullable(String pKey, com.mojang.serialization.Codec<T> pCodec, T pData) toString()values()voidwrite(DataOutput pOutput) private static voidwriteNamedTag(String pName, Tag pTag, DataOutput pOutput) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.nbt.Tag
acceptAsRoot, asBoolean, asByte, asByteArray, asDouble, asFloat, asInt, asIntArray, asList, asLong, asLongArray, asNumber, asShort, asString
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
CODEC
-
SELF_SIZE_IN_BYTES
private static final int SELF_SIZE_IN_BYTES- See Also:
-
MAP_ENTRY_SIZE_IN_BYTES
private static final int MAP_ENTRY_SIZE_IN_BYTES- See Also:
-
TYPE
-
tags
-
-
Constructor Details
-
CompoundTag
-
CompoundTag
public CompoundTag() -
CompoundTag
public CompoundTag(int expectedEntries) Neo: create a compound tag that is generally suitable to hold the given amount of entries without needing to resize the internal map.- Parameters:
expectedEntries- the expected number of entries that the compound tag will have- See Also:
-
-
Method Details
-
write
- Specified by:
writein interfaceTag- Throws:
IOException
-
sizeInBytes
public int sizeInBytes()- Specified by:
sizeInBytesin interfaceTag
-
keySet
-
entrySet
-
values
-
forEach
-
getId
public byte getId() -
getType
-
size
public int size() -
put
-
putByte
-
putShort
-
putInt
-
putLong
-
putFloat
-
putDouble
-
putString
-
putByteArray
-
putIntArray
-
putLongArray
-
putBoolean
-
get
-
contains
-
getOptional
-
getByte
-
getByteOr
-
getShort
-
getShortOr
-
getInt
-
getIntOr
-
getLong
-
getLongOr
-
getFloat
-
getFloatOr
-
getDouble
-
getDoubleOr
-
getString
-
getStringOr
-
getByteArray
-
getIntArray
-
getLongArray
-
getCompound
-
getCompoundOrEmpty
-
getList
-
getListOrEmpty
-
getBoolean
-
getBooleanOr
-
remove
-
toString
-
isEmpty
public boolean isEmpty() -
shallowCopy
-
copy
-
asCompound
- Specified by:
asCompoundin interfaceTag
-
equals
-
hashCode
public int hashCode() -
writeNamedTag
- Throws:
IOException
-
readNamedTagData
static Tag readNamedTagData(TagType<?> pType, String pName, DataInput pInput, NbtAccounter pAccounter) -
merge
Copies all the tags ofotherinto this tag, then returns itself.- See Also:
-
accept
-
accept
-
store
-
storeNullable
public <T> void storeNullable(String pKey, com.mojang.serialization.Codec<T> pCodec, @Nullable T pData) -
store
-
storeNullable
-
store
public <T> void store(com.mojang.serialization.MapCodec<T> pMapCodec, T pData) -
store
public <T> void store(com.mojang.serialization.MapCodec<T> pMapCodec, com.mojang.serialization.DynamicOps<Tag> pOps, T pData) -
read
-
read
-
read
-
read
-