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.Logger
private static final int
private static final int
static 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 pVisitor) void
accept
(TagVisitor pVisitor) boolean
copy()
entrySet()
boolean
void
forEach
(BiConsumer<String, Tag> pAction) getBoolean
(String pKey) boolean
getBooleanOr
(String pKey, boolean pDefaultValue) Optional
<byte[]> getByteArray
(String pKey) byte
getCompound
(String pKey) getCompoundOrEmpty
(String pKey) double
getDoubleOr
(String pKey, double pDefaultValue) float
getFloatOr
(String pKey, float pDefaultValue) byte
getId()
Optional
<int[]> getIntArray
(String pKey) int
getListOrEmpty
(String pKey) Optional
<long[]> getLongArray
(String pKey) long
getOptional
(String pKey) short
getShortOr
(String pKey, short pDefaultValue) getStringOr
(String pKey, String pDefaultValue) getType()
int
hashCode()
boolean
isEmpty()
keySet()
merge
(CompoundTag pOther) Copies all the tags ofother
into this tag, then returns itself.void
putBoolean
(String pKey, boolean pValue) void
void
putByteArray
(String pKey, byte[] pValue) void
void
void
void
putIntArray
(String pKey, int[] pValue) void
void
putLongArray
(String pKey, long[] pValue) void
void
<T> Optional
<T> read
(com.mojang.serialization.MapCodec<T> p_401035_) <T> Optional
<T> read
(com.mojang.serialization.MapCodec<T> p_401418_, com.mojang.serialization.DynamicOps<Tag> p_401213_) <T> Optional
<T> <T> Optional
<T> read
(String p_401362_, com.mojang.serialization.Codec<T> p_401434_, com.mojang.serialization.DynamicOps<Tag> p_401431_) (package private) static Tag
readNamedTagData
(TagType<?> pType, String pName, DataInput pInput, NbtAccounter pAccounter) void
protected CompoundTag
int
size()
int
<T> void
store
(com.mojang.serialization.MapCodec<T> p_401165_, com.mojang.serialization.DynamicOps<Tag> p_401224_, T p_401226_) <T> void
store
(com.mojang.serialization.MapCodec<T> p_401258_, T p_401416_) <T> void
store
(String p_401002_, com.mojang.serialization.Codec<T> p_401379_, com.mojang.serialization.DynamicOps<Tag> p_401063_, T p_401119_) <T> void
<T> void
storeNullable
(String p_404778_, com.mojang.serialization.Codec<T> p_405437_, com.mojang.serialization.DynamicOps<Tag> p_405108_, T p_405353_) <T> void
storeNullable
(String p_405110_, com.mojang.serialization.Codec<T> p_405799_, T p_405604_) toString()
values()
void
write
(DataOutput pOutput) private static void
writeNamedTag
(String pName, Tag pTag, DataOutput pOutput) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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:
write
in interfaceTag
- Throws:
IOException
-
sizeInBytes
public int sizeInBytes()- Specified by:
sizeInBytes
in 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:
asCompound
in 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 ofother
into this tag, then returns itself.- See Also:
-
accept
-
accept
-
store
-
storeNullable
public <T> void storeNullable(String p_405110_, com.mojang.serialization.Codec<T> p_405799_, @Nullable T p_405604_) -
store
-
storeNullable
-
store
public <T> void store(com.mojang.serialization.MapCodec<T> p_401258_, T p_401416_) -
store
public <T> void store(com.mojang.serialization.MapCodec<T> p_401165_, com.mojang.serialization.DynamicOps<Tag> p_401224_, T p_401226_) -
read
-
read
-
read
-
read
-