Class NbtCompound
- All Implemented Interfaces:
NbtElement
HashMap<String, NbtElement>. Note that this does not implement
Map. Its type is 0xa.
There are two ways to use this compound; one is to create NBT instances yourself and use
get(String) or put(String, NbtElement). Manual casting is required in
this case. The other, easier way is to use methods with type names, such as
getInt(String) or putInt(String, int). Where applicable, these methods
return and accept Java types (e.g. int, long[]) instead of NbtElement
subclasses. Note that there is no putCompound method, since you can just use the
put method. These getters also have the advantage of providing type safety, because if
type mismatch occurs or there is no such element in the compound, it returns the default
value for that type instead of throwing or returning null.
- Mappings:
Namespace Name named net/minecraft/nbt/NbtCompoundintermediary net/minecraft/class_2487official ua
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<NbtCompound> private final Map<String, NbtElement> private static final intprivate static final Loggerprivate static final intstatic final NbtType<NbtCompound> Fields inherited from interface net.minecraft.nbt.NbtElement
BYTE_ARRAY_TYPE, BYTE_TYPE, COMPOUND_TYPE, DOUBLE_TYPE, END_TYPE, field_33246, field_33247, field_33248, field_33249, FLOAT_TYPE, INT_ARRAY_TYPE, INT_TYPE, LIST_TYPE, LONG_ARRAY_TYPE, LONG_TYPE, MAX_DEPTH, SHORT_TYPE, STRING_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(NbtElementVisitor visitor) booleanDetermines whether the NBT compound object contains the specified key.copy()Returns an NBT element of equal value that won't change with this element.copyFrom(NbtCompound source) Merges the entries ofsourceto this compound.<T> voidcopyFromCodec(com.mojang.serialization.MapCodec<T> codec, com.mojang.serialization.DynamicOps<NbtElement> ops, T value) <T> voidcopyFromCodec(com.mojang.serialization.MapCodec<T> codec, T value) <T> Optional<T> decode(com.mojang.serialization.MapCodec<T> codec) <T> Optional<T> decode(com.mojang.serialization.MapCodec<T> codec, com.mojang.serialization.DynamicOps<NbtElement> ops) doAccept(NbtScanner visitor) entrySet()booleanvoidforEach(BiConsumer<String, NbtElement> entryConsumer) Returns the element associated with the key from this compound, ornullif there is none.<T> Optional<T> <T> Optional<T> get(String key, com.mojang.serialization.Codec<T> codec, com.mojang.serialization.DynamicOps<NbtElement> ops) getBoolean(String key) Returns the boolean value stored with thekey.booleangetBoolean(String key, boolean fallback) Returns thebyteassociated withkey, or0if there is no number stored with the key.byteReturns thebyteassociated withkey, orfallbackif there is no number stored with the key.Optional<byte[]> getByteArray(String key) Returns the byte array associated withkey, or an empty byte array if there is no byte array stored with the key.getCompound(String key) Returns the compound associated withkey, or an empty compound if there is no compound stored with the key.getCompoundOrEmpty(String key) Returns thedoubleassociated withkey, or0.0if there is no number stored with the key.doubleReturns thedoubleassociated withkey, orfallbackif there is no number stored with the key.Returns thefloatassociated withkey, or0.0fif there is no number stored with the key.floatReturns thefloatassociated withkey, orfallbackif there is no number stored with the key.Returns theintassociated withkey, or0if there is no number stored with the key.intReturns theintassociated withkey, orfallbackif there is no number stored with the key.Optional<int[]> getIntArray(String key) Returns the int array associated withkey, or an empty int array if there is no int array stored with the key.getKeys()Returns the set of keys in this compound.Returns the list associated withkey, or an empty list if there is no list stored with the key and the type.getListOrEmpty(String key) Returns thelongassociated withkey, or0Lif there is no number stored with the key.longReturns thelongassociated withkey, orfallbackif there is no number stored with the key.Optional<long[]> getLongArray(String key) Returns the long array associated withkey, or an empty long array if there is no long array stored with the key.Returns the NBT type definition of this NBT element.private Optional<NbtElement> getOptional(String key) Returns theshortassociated withkey, or0if there is no number stored with the key.shortReturns theshortassociated withkey, orfallbackif there is no number stored with the key.intgetSize()Returns the size of this compound.intReturns theStringassociated withkey, or an empty string if there is no string stored with the key.bytegetType()Returns the type of this NBT element.inthashCode()booleanisEmpty()Returns whether the compound has no entries.<T> voidput(String key, com.mojang.serialization.Codec<T> codec, com.mojang.serialization.DynamicOps<NbtElement> ops, T value) <T> voidput(String key, NbtElement element) Puts an element to this compound.voidputBoolean(String key, boolean value) Puts abooleanto this compound.voidPuts abyteto this compound.voidputByteArray(String key, byte[] value) Puts a byte array to this compound.voidPuts adoubleto this compound.voidPuts afloatto this compound.voidPuts anintto this compound.voidputIntArray(String key, int[] value) Puts an int array to this compound.voidPuts alongto this compound.voidputLongArray(String key, long[] value) Puts a long array to this compound.<T> voidputNullable(String key, com.mojang.serialization.Codec<T> codec, com.mojang.serialization.DynamicOps<NbtElement> ops, T value) <T> voidputNullable(String key, com.mojang.serialization.Codec<T> codec, T value) voidPuts ashortto this compound.voidPuts aStringto this compound.(package private) static NbtElementread(NbtType<?> reader, String key, DataInput input, NbtSizeTracker tracker) voidRemoves the entry with the specifiedkey.protected NbtCompoundtoString()values()voidwrite(DataOutput output) Writes the NBT element tooutput.private static voidwrite(String key, NbtElement element, DataOutput output) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.nbt.NbtElement
accept, asBoolean, asByte, asByteArray, asDouble, asFloat, asInt, asIntArray, asLong, asLongArray, asNbtList, asNumber, asShort, asString
-
Field Details
-
LOGGER
- Mappings:
Namespace Name Mixin selector named LOGGERLnet/minecraft/nbt/NbtCompound;LOGGER:Lorg/slf4j/Logger;intermediary field_56522Lnet/minecraft/class_2487;field_56522:Lorg/slf4j/Logger;official cLua;c:Lorg/slf4j/Logger;
-
CODEC
- Mappings:
Namespace Name Mixin selector named CODECLnet/minecraft/nbt/NbtCompound;CODEC:Lcom/mojang/serialization/Codec;intermediary field_25128Lnet/minecraft/class_2487;field_25128:Lcom/mojang/serialization/Codec;official aLua;a:Lcom/mojang/serialization/Codec;
-
SIZE
private static final int SIZE- See Also:
- Mappings:
Namespace Name Mixin selector named SIZELnet/minecraft/nbt/NbtCompound;SIZE:Iintermediary field_41718Lnet/minecraft/class_2487;field_41718:Iofficial vLua;v:I
-
field_41719
private static final int field_41719- See Also:
- Mappings:
Namespace Name Mixin selector named field_41719Lnet/minecraft/nbt/NbtCompound;field_41719:Iintermediary field_41719Lnet/minecraft/class_2487;field_41719:Iofficial wLua;w:I
-
TYPE
- Mappings:
Namespace Name Mixin selector named TYPELnet/minecraft/nbt/NbtCompound;TYPE:Lnet/minecraft/nbt/NbtType;intermediary field_21029Lnet/minecraft/class_2487;field_21029:Lnet/minecraft/class_4614;official bLua;b:Lvc;
-
entries
- Mappings:
Namespace Name Mixin selector named entriesLnet/minecraft/nbt/NbtCompound;entries:Ljava/util/Map;intermediary field_11515Lnet/minecraft/class_2487;field_11515:Ljava/util/Map;official xLua;x:Ljava/util/Map;
-
-
Constructor Details
-
NbtCompound
NbtCompound(Map<String, NbtElement> entries) - Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/nbt/NbtCompound;<init>(Ljava/util/Map;)Vintermediary <init>Lnet/minecraft/class_2487;<init>(Ljava/util/Map;)Vofficial <init>Lua;<init>(Ljava/util/Map;)V
-
NbtCompound
public NbtCompound()
-
-
Method Details
-
write
Writes the NBT element tooutput.- Specified by:
writein interfaceNbtElement- Throws:
IOException- API Note:
- This is a low-level method for serializing NBT elements; consider using
NbtIo,NbtOps, orPacketByteBuf.writeNbt(net.minecraft.nbt.NbtElement)instead. - Mappings:
Namespace Name Mixin selector named writeLnet/minecraft/nbt/NbtElement;write(Ljava/io/DataOutput;)Vintermediary method_10713Lnet/minecraft/class_2520;method_10713(Ljava/io/DataOutput;)Vofficial aLva;a(Ljava/io/DataOutput;)V
-
getSizeInBytes
public int getSizeInBytes()- Specified by:
getSizeInBytesin interfaceNbtElement- Mappings:
Namespace Name Mixin selector named getSizeInBytesLnet/minecraft/nbt/NbtElement;getSizeInBytes()Iintermediary method_47988Lnet/minecraft/class_2520;method_47988()Iofficial aLva;a()I
-
getKeys
Returns the set of keys in this compound.- Returns:
- the set of keys in this compound
- Mappings:
Namespace Name Mixin selector named getKeysLnet/minecraft/nbt/NbtCompound;getKeys()Ljava/util/Set;intermediary method_10541Lnet/minecraft/class_2487;method_10541()Ljava/util/Set;official eLua;e()Ljava/util/Set;
-
entrySet
- Mappings:
Namespace Name Mixin selector named entrySetLnet/minecraft/nbt/NbtCompound;entrySet()Ljava/util/Set;intermediary method_59874Lnet/minecraft/class_2487;method_59874()Ljava/util/Set;official gLua;g()Ljava/util/Set;
-
values
- Mappings:
Namespace Name Mixin selector named valuesLnet/minecraft/nbt/NbtCompound;values()Ljava/util/Collection;intermediary method_68567Lnet/minecraft/class_2487;method_68567()Ljava/util/Collection;official hLua;h()Ljava/util/Collection;
-
forEach
- Mappings:
Namespace Name Mixin selector named forEachLnet/minecraft/nbt/NbtCompound;forEach(Ljava/util/function/BiConsumer;)Vintermediary method_68561Lnet/minecraft/class_2487;method_68561(Ljava/util/function/BiConsumer;)Vofficial aLua;a(Ljava/util/function/BiConsumer;)V
-
getType
public byte getType()Returns the type of this NBT element.- Specified by:
getTypein interfaceNbtElement- Returns:
- the type of this NBT element
- Mappings:
Namespace Name Mixin selector named getTypeLnet/minecraft/nbt/NbtElement;getType()Bintermediary method_10711Lnet/minecraft/class_2520;method_10711()Bofficial bLva;b()B
-
getNbtType
Returns the NBT type definition of this NBT element.- Specified by:
getNbtTypein interfaceNbtElement- Returns:
- the NBT type definition of this NBT element
- Mappings:
Namespace Name Mixin selector named getNbtTypeLnet/minecraft/nbt/NbtElement;getNbtType()Lnet/minecraft/nbt/NbtType;intermediary method_23258Lnet/minecraft/class_2520;method_23258()Lnet/minecraft/class_4614;official cLva;c()Lvc;
-
getSize
public int getSize()Returns the size of this compound.- Returns:
- the size of this compound
- Mappings:
Namespace Name Mixin selector named getSizeLnet/minecraft/nbt/NbtCompound;getSize()Iintermediary method_10546Lnet/minecraft/class_2487;method_10546()Iofficial iLua;i()I
-
put
Puts an element to this compound.- Returns:
- the previous value, or
nullif there was none - See Also:
- Mappings:
Namespace Name Mixin selector named putLnet/minecraft/nbt/NbtCompound;put(Ljava/lang/String;Lnet/minecraft/nbt/NbtElement;)Lnet/minecraft/nbt/NbtElement;intermediary method_10566Lnet/minecraft/class_2487;method_10566(Ljava/lang/String;Lnet/minecraft/class_2520;)Lnet/minecraft/class_2520;official aLua;a(Ljava/lang/String;Lva;)Lva;
-
putByte
Puts abyteto this compound.- See Also:
- Mappings:
Namespace Name Mixin selector named putByteLnet/minecraft/nbt/NbtCompound;putByte(Ljava/lang/String;B)Vintermediary method_10567Lnet/minecraft/class_2487;method_10567(Ljava/lang/String;B)Vofficial aLua;a(Ljava/lang/String;B)V
-
putShort
Puts ashortto this compound.- See Also:
- Mappings:
Namespace Name Mixin selector named putShortLnet/minecraft/nbt/NbtCompound;putShort(Ljava/lang/String;S)Vintermediary method_10575Lnet/minecraft/class_2487;method_10575(Ljava/lang/String;S)Vofficial aLua;a(Ljava/lang/String;S)V
-
putInt
Puts anintto this compound.- See Also:
- Mappings:
Namespace Name Mixin selector named putIntLnet/minecraft/nbt/NbtCompound;putInt(Ljava/lang/String;I)Vintermediary method_10569Lnet/minecraft/class_2487;method_10569(Ljava/lang/String;I)Vofficial aLua;a(Ljava/lang/String;I)V
-
putLong
Puts alongto this compound.- See Also:
- Mappings:
Namespace Name Mixin selector named putLongLnet/minecraft/nbt/NbtCompound;putLong(Ljava/lang/String;J)Vintermediary method_10544Lnet/minecraft/class_2487;method_10544(Ljava/lang/String;J)Vofficial aLua;a(Ljava/lang/String;J)V
-
putFloat
Puts afloatto this compound.- See Also:
- Mappings:
Namespace Name Mixin selector named putFloatLnet/minecraft/nbt/NbtCompound;putFloat(Ljava/lang/String;F)Vintermediary method_10548Lnet/minecraft/class_2487;method_10548(Ljava/lang/String;F)Vofficial aLua;a(Ljava/lang/String;F)V
-
putDouble
Puts adoubleto this compound.- See Also:
- Mappings:
Namespace Name Mixin selector named putDoubleLnet/minecraft/nbt/NbtCompound;putDouble(Ljava/lang/String;D)Vintermediary method_10549Lnet/minecraft/class_2487;method_10549(Ljava/lang/String;D)Vofficial aLua;a(Ljava/lang/String;D)V
-
putString
Puts aStringto this compound.- See Also:
- Mappings:
Namespace Name Mixin selector named putStringLnet/minecraft/nbt/NbtCompound;putString(Ljava/lang/String;Ljava/lang/String;)Vintermediary method_10582Lnet/minecraft/class_2487;method_10582(Ljava/lang/String;Ljava/lang/String;)Vofficial aLua;a(Ljava/lang/String;Ljava/lang/String;)V
-
putByteArray
Puts a byte array to this compound. This does not copy the array.- See Also:
- Mappings:
Namespace Name Mixin selector named putByteArrayLnet/minecraft/nbt/NbtCompound;putByteArray(Ljava/lang/String;[B)Vintermediary method_10570Lnet/minecraft/class_2487;method_10570(Ljava/lang/String;[B)Vofficial aLua;a(Ljava/lang/String;[B)V
-
putIntArray
Puts an int array to this compound. This does not copy the array.- See Also:
- Mappings:
Namespace Name Mixin selector named putIntArrayLnet/minecraft/nbt/NbtCompound;putIntArray(Ljava/lang/String;[I)Vintermediary method_10539Lnet/minecraft/class_2487;method_10539(Ljava/lang/String;[I)Vofficial aLua;a(Ljava/lang/String;[I)V
-
putLongArray
Puts a long array to this compound. This does not copy the array.- See Also:
- Mappings:
Namespace Name Mixin selector named putLongArrayLnet/minecraft/nbt/NbtCompound;putLongArray(Ljava/lang/String;[J)Vintermediary method_10564Lnet/minecraft/class_2487;method_10564(Ljava/lang/String;[J)Vofficial aLua;a(Ljava/lang/String;[J)V
-
putBoolean
Puts abooleanto this compound. The value is stored asNbtByte.- See Also:
- Mappings:
Namespace Name Mixin selector named putBooleanLnet/minecraft/nbt/NbtCompound;putBoolean(Ljava/lang/String;Z)Vintermediary method_10556Lnet/minecraft/class_2487;method_10556(Ljava/lang/String;Z)Vofficial aLua;a(Ljava/lang/String;Z)V
-
get
Returns the element associated with the key from this compound, ornullif there is none.- Returns:
- the element associated with the key from this compound, or
nullif there is none - See Also:
- API Note:
- This method does not provide type safety; if the type is known, it is recommended to use other type-specific methods instead.
- Mappings:
Namespace Name Mixin selector named getLnet/minecraft/nbt/NbtCompound;get(Ljava/lang/String;)Lnet/minecraft/nbt/NbtElement;intermediary method_10580Lnet/minecraft/class_2487;method_10580(Ljava/lang/String;)Lnet/minecraft/class_2520;official aLua;a(Ljava/lang/String;)Lva;
-
contains
Determines whether the NBT compound object contains the specified key.- Returns:
trueif the key exists, elsefalse- Mappings:
Namespace Name Mixin selector named containsLnet/minecraft/nbt/NbtCompound;contains(Ljava/lang/String;)Zintermediary method_10545Lnet/minecraft/class_2487;method_10545(Ljava/lang/String;)Zofficial bLua;b(Ljava/lang/String;)Z
-
getOptional
- Mappings:
Namespace Name Mixin selector named getOptionalLnet/minecraft/nbt/NbtCompound;getOptional(Ljava/lang/String;)Ljava/util/Optional;intermediary method_68570Lnet/minecraft/class_2487;method_68570(Ljava/lang/String;)Ljava/util/Optional;official sLua;s(Ljava/lang/String;)Ljava/util/Optional;
-
getByte
Returns thebyteassociated withkey, or0if there is no number stored with the key.If a non-byte numeric value is stored, this will cast the value.
- Returns:
- the
byteassociated withkey, or0if there is no number stored with the key - See Also:
- Mappings:
Namespace Name Mixin selector named getByteLnet/minecraft/nbt/NbtCompound;getByte(Ljava/lang/String;)Ljava/util/Optional;intermediary method_10571Lnet/minecraft/class_2487;method_10571(Ljava/lang/String;)Ljava/util/Optional;official cLua;c(Ljava/lang/String;)Ljava/util/Optional;
-
getByte
Returns thebyteassociated withkey, orfallbackif there is no number stored with the key.If a non-byte numeric value is stored, this will cast the value.
- Returns:
- the
byteassociated withkey, orfallbackif there is no number stored with the key - See Also:
- Mappings:
Namespace Name Mixin selector named getByteLnet/minecraft/nbt/NbtCompound;getByte(Ljava/lang/String;B)Bintermediary method_68562Lnet/minecraft/class_2487;method_68562(Ljava/lang/String;B)Bofficial bLua;b(Ljava/lang/String;B)B
-
getShort
Returns theshortassociated withkey, or0if there is no number stored with the key.If a non-short numeric value is stored, this will cast the value.
- Returns:
- the
shortassociated withkey, or0if there is no number stored with the key - See Also:
- Mappings:
Namespace Name Mixin selector named getShortLnet/minecraft/nbt/NbtCompound;getShort(Ljava/lang/String;)Ljava/util/Optional;intermediary method_10568Lnet/minecraft/class_2487;method_10568(Ljava/lang/String;)Ljava/util/Optional;official dLua;d(Ljava/lang/String;)Ljava/util/Optional;
-
getShort
Returns theshortassociated withkey, orfallbackif there is no number stored with the key.If a non-short numeric value is stored, this will cast the value.
- Returns:
- the
shortassociated withkey, orfallbackif there is no number stored with the key - See Also:
- Mappings:
Namespace Name Mixin selector named getShortLnet/minecraft/nbt/NbtCompound;getShort(Ljava/lang/String;S)Sintermediary method_68565Lnet/minecraft/class_2487;method_68565(Ljava/lang/String;S)Sofficial bLua;b(Ljava/lang/String;S)S
-
getInt
Returns theintassociated withkey, or0if there is no number stored with the key.If a non-integer numeric value is stored, this will cast the value.
- Returns:
- the
intassociated withkey, or0if there is no number stored with the key - See Also:
- Mappings:
Namespace Name Mixin selector named getIntLnet/minecraft/nbt/NbtCompound;getInt(Ljava/lang/String;)Ljava/util/Optional;intermediary method_10550Lnet/minecraft/class_2487;method_10550(Ljava/lang/String;)Ljava/util/Optional;official eLua;e(Ljava/lang/String;)Ljava/util/Optional;
-
getInt
Returns theintassociated withkey, orfallbackif there is no number stored with the key.If a non-integer numeric value is stored, this will cast the value.
- Returns:
- the
intassociated withkey, orfallbackif there is no number stored with the key - See Also:
- Mappings:
Namespace Name Mixin selector named getIntLnet/minecraft/nbt/NbtCompound;getInt(Ljava/lang/String;I)Iintermediary method_68083Lnet/minecraft/class_2487;method_68083(Ljava/lang/String;I)Iofficial bLua;b(Ljava/lang/String;I)I
-
getLong
Returns thelongassociated withkey, or0Lif there is no number stored with the key.If a non-long numeric value is stored, this will cast the value.
- Returns:
- the
longassociated withkey, or0Lif there is no number stored with the key - See Also:
- Mappings:
Namespace Name Mixin selector named getLongLnet/minecraft/nbt/NbtCompound;getLong(Ljava/lang/String;)Ljava/util/Optional;intermediary method_10537Lnet/minecraft/class_2487;method_10537(Ljava/lang/String;)Ljava/util/Optional;official fLua;f(Ljava/lang/String;)Ljava/util/Optional;
-
getLong
Returns thelongassociated withkey, orfallbackif there is no number stored with the key.If a non-long numeric value is stored, this will cast the value.
- Returns:
- the
longassociated withkey, orfallbackif there is no number stored with the key - See Also:
- Mappings:
Namespace Name Mixin selector named getLongLnet/minecraft/nbt/NbtCompound;getLong(Ljava/lang/String;J)Jintermediary method_68080Lnet/minecraft/class_2487;method_68080(Ljava/lang/String;J)Jofficial bLua;b(Ljava/lang/String;J)J
-
getFloat
Returns thefloatassociated withkey, or0.0fif there is no number stored with the key.If a non-float numeric value is stored, this will cast the value.
- Returns:
- the
floatassociated withkey, or0.0fif there is no number stored with the key - See Also:
- Mappings:
Namespace Name Mixin selector named getFloatLnet/minecraft/nbt/NbtCompound;getFloat(Ljava/lang/String;)Ljava/util/Optional;intermediary method_10583Lnet/minecraft/class_2487;method_10583(Ljava/lang/String;)Ljava/util/Optional;official gLua;g(Ljava/lang/String;)Ljava/util/Optional;
-
getFloat
Returns thefloatassociated withkey, orfallbackif there is no number stored with the key.If a non-float numeric value is stored, this will cast the value.
- Returns:
- the
floatassociated withkey, orfallbackif there is no number stored with the key - See Also:
- Mappings:
Namespace Name Mixin selector named getFloatLnet/minecraft/nbt/NbtCompound;getFloat(Ljava/lang/String;F)Fintermediary method_66563Lnet/minecraft/class_2487;method_66563(Ljava/lang/String;F)Fofficial bLua;b(Ljava/lang/String;F)F
-
getDouble
Returns thedoubleassociated withkey, or0.0if there is no number stored with the key.If a non-double numeric value is stored, this will cast the value.
- Returns:
- the
doubleassociated withkey, or0.0if there is no number stored with the key - See Also:
- Mappings:
Namespace Name Mixin selector named getDoubleLnet/minecraft/nbt/NbtCompound;getDouble(Ljava/lang/String;)Ljava/util/Optional;intermediary method_10574Lnet/minecraft/class_2487;method_10574(Ljava/lang/String;)Ljava/util/Optional;official hLua;h(Ljava/lang/String;)Ljava/util/Optional;
-
getDouble
Returns thedoubleassociated withkey, orfallbackif there is no number stored with the key.If a non-double numeric value is stored, this will cast the value.
- Returns:
- the
doubleassociated withkey, orfallbackif there is no number stored with the key - See Also:
- Mappings:
Namespace Name Mixin selector named getDoubleLnet/minecraft/nbt/NbtCompound;getDouble(Ljava/lang/String;D)Dintermediary method_68563Lnet/minecraft/class_2487;method_68563(Ljava/lang/String;D)Dofficial bLua;b(Ljava/lang/String;D)D
-
getString
Returns theStringassociated withkey, or an empty string if there is no string stored with the key.- Returns:
- the
Stringassociated withkey, or an empty string if there is no string stored with the key - See Also:
- Mappings:
Namespace Name Mixin selector named getStringLnet/minecraft/nbt/NbtCompound;getString(Ljava/lang/String;)Ljava/util/Optional;intermediary method_10558Lnet/minecraft/class_2487;method_10558(Ljava/lang/String;)Ljava/util/Optional;official iLua;i(Ljava/lang/String;)Ljava/util/Optional;
-
getString
- Returns:
- the
Stringassociated withkey, orfallbackif there is no string stored with the key - See Also:
- Mappings:
Namespace Name Mixin selector named getStringLnet/minecraft/nbt/NbtCompound;getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;intermediary method_68564Lnet/minecraft/class_2487;method_68564(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;official bLua;b(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
-
getByteArray
Returns the byte array associated withkey, or an empty byte array if there is no byte array stored with the key.- Returns:
- the byte array associated with
key, or an empty byte array if there is no byte array stored with the key - See Also:
- API Note:
- Modifying the returned array also modifies the NBT byte array.
- Mappings:
Namespace Name Mixin selector named getByteArrayLnet/minecraft/nbt/NbtCompound;getByteArray(Ljava/lang/String;)Ljava/util/Optional;intermediary method_10547Lnet/minecraft/class_2487;method_10547(Ljava/lang/String;)Ljava/util/Optional;official jLua;j(Ljava/lang/String;)Ljava/util/Optional;
-
getIntArray
Returns the int array associated withkey, or an empty int array if there is no int array stored with the key.- Returns:
- the int array associated with
key, or an empty int array if there is no int array stored with the key - See Also:
- API Note:
- Modifying the returned array also modifies the NBT int array.
- Mappings:
Namespace Name Mixin selector named getIntArrayLnet/minecraft/nbt/NbtCompound;getIntArray(Ljava/lang/String;)Ljava/util/Optional;intermediary method_10561Lnet/minecraft/class_2487;method_10561(Ljava/lang/String;)Ljava/util/Optional;official kLua;k(Ljava/lang/String;)Ljava/util/Optional;
-
getLongArray
Returns the long array associated withkey, or an empty long array if there is no long array stored with the key.- Returns:
- the long array associated with
key, or an empty long array if there is no long array stored with the key - See Also:
- API Note:
- Modifying the returned array also modifies the NBT long array.
- Mappings:
Namespace Name Mixin selector named getLongArrayLnet/minecraft/nbt/NbtCompound;getLongArray(Ljava/lang/String;)Ljava/util/Optional;intermediary method_10565Lnet/minecraft/class_2487;method_10565(Ljava/lang/String;)Ljava/util/Optional;official lLua;l(Ljava/lang/String;)Ljava/util/Optional;
-
getCompound
Returns the compound associated withkey, or an empty compound if there is no compound stored with the key.- Returns:
- the compound associated with
key, or an empty compound if there is no compound stored with the key - See Also:
- Mappings:
Namespace Name Mixin selector named getCompoundLnet/minecraft/nbt/NbtCompound;getCompound(Ljava/lang/String;)Ljava/util/Optional;intermediary method_10562Lnet/minecraft/class_2487;method_10562(Ljava/lang/String;)Ljava/util/Optional;official mLua;m(Ljava/lang/String;)Ljava/util/Optional;
-
getCompoundOrEmpty
- Mappings:
Namespace Name Mixin selector named getCompoundOrEmptyLnet/minecraft/nbt/NbtCompound;getCompoundOrEmpty(Ljava/lang/String;)Lnet/minecraft/nbt/NbtCompound;intermediary method_68568Lnet/minecraft/class_2487;method_68568(Ljava/lang/String;)Lnet/minecraft/class_2487;official nLua;n(Ljava/lang/String;)Lua;
-
getList
Returns the list associated withkey, or an empty list if there is no list stored with the key and the type.- Returns:
- the list associated with
key, or an empty list if there is no list stored with the key and the type - See Also:
- Mappings:
Namespace Name Mixin selector named getListLnet/minecraft/nbt/NbtCompound;getList(Ljava/lang/String;)Ljava/util/Optional;intermediary method_10554Lnet/minecraft/class_2487;method_10554(Ljava/lang/String;)Ljava/util/Optional;official oLua;o(Ljava/lang/String;)Ljava/util/Optional;
-
getListOrEmpty
- Mappings:
Namespace Name Mixin selector named getListOrEmptyLnet/minecraft/nbt/NbtCompound;getListOrEmpty(Ljava/lang/String;)Lnet/minecraft/nbt/NbtList;intermediary method_68569Lnet/minecraft/class_2487;method_68569(Ljava/lang/String;)Lnet/minecraft/class_2499;official pLua;p(Ljava/lang/String;)Lug;
-
getBoolean
Returns the boolean value stored with thekey.- Returns:
- the boolean value stored with the
key - Implementation Note:
- Since NBT does not have a boolean type,
NbtByteis used instead. This method returnstruefor any values which, after casting tobyteas described atgetByte(String), is not0. Since all non-numeric values become0during casting to bytes, this method returnsfalsefor those as well. This includes values often considered truthy in other languages, such as a non-empty string or list. - Mappings:
Namespace Name Mixin selector named getBooleanLnet/minecraft/nbt/NbtCompound;getBoolean(Ljava/lang/String;)Ljava/util/Optional;intermediary method_10577Lnet/minecraft/class_2487;method_10577(Ljava/lang/String;)Ljava/util/Optional;official qLua;q(Ljava/lang/String;)Ljava/util/Optional;
-
getBoolean
- Mappings:
Namespace Name Mixin selector named getBooleanLnet/minecraft/nbt/NbtCompound;getBoolean(Ljava/lang/String;Z)Zintermediary method_68566Lnet/minecraft/class_2487;method_68566(Ljava/lang/String;Z)Zofficial bLua;b(Ljava/lang/String;Z)Z
-
remove
Removes the entry with the specifiedkey. Does nothing if there is none.- Mappings:
Namespace Name Mixin selector named removeLnet/minecraft/nbt/NbtCompound;remove(Ljava/lang/String;)Vintermediary method_10551Lnet/minecraft/class_2487;method_10551(Ljava/lang/String;)Vofficial rLua;r(Ljava/lang/String;)V
-
toString
- Specified by:
toStringin interfaceNbtElement- Overrides:
toStringin classObject
-
isEmpty
public boolean isEmpty()Returns whether the compound has no entries.- Returns:
- whether the compound has no entries
- Mappings:
Namespace Name Mixin selector named isEmptyLnet/minecraft/nbt/NbtCompound;isEmpty()Zintermediary method_33133Lnet/minecraft/class_2487;method_33133()Zofficial jLua;j()Z
-
shallowCopy
- Mappings:
Namespace Name Mixin selector named shallowCopyLnet/minecraft/nbt/NbtCompound;shallowCopy()Lnet/minecraft/nbt/NbtCompound;intermediary method_59873Lnet/minecraft/class_2487;method_59873()Lnet/minecraft/class_2487;official kLua;k()Lua;
-
copy
Description copied from interface:NbtElementReturns an NBT element of equal value that won't change with this element.- Specified by:
copyin interfaceNbtElement- Returns:
- an NBT element of equal value that won't change with this element
- Mappings:
Namespace Name Mixin selector named copyLnet/minecraft/nbt/NbtCompound;copy()Lnet/minecraft/nbt/NbtCompound;intermediary method_10553Lnet/minecraft/class_2487;method_10553()Lnet/minecraft/class_2487;official lLua;l()Lua;
-
asCompound
- Specified by:
asCompoundin interfaceNbtElement- Mappings:
Namespace Name Mixin selector named asCompoundLnet/minecraft/nbt/NbtElement;asCompound()Ljava/util/Optional;intermediary method_68571Lnet/minecraft/class_2520;method_68571()Ljava/util/Optional;official s_Lva;s_()Ljava/util/Optional;
-
equals
-
hashCode
public int hashCode() -
write
- Throws:
IOException- Mappings:
Namespace Name Mixin selector named writeLnet/minecraft/nbt/NbtCompound;write(Ljava/lang/String;Lnet/minecraft/nbt/NbtElement;Ljava/io/DataOutput;)Vintermediary method_10555Lnet/minecraft/class_2487;method_10555(Ljava/lang/String;Lnet/minecraft/class_2520;Ljava/io/DataOutput;)Vofficial aLua;a(Ljava/lang/String;Lva;Ljava/io/DataOutput;)V
-
read
- Mappings:
Namespace Name Mixin selector named readLnet/minecraft/nbt/NbtCompound;read(Lnet/minecraft/nbt/NbtType;Ljava/lang/String;Ljava/io/DataInput;Lnet/minecraft/nbt/NbtSizeTracker;)Lnet/minecraft/nbt/NbtElement;intermediary method_10581Lnet/minecraft/class_2487;method_10581(Lnet/minecraft/class_4614;Ljava/lang/String;Ljava/io/DataInput;Lnet/minecraft/class_2505;)Lnet/minecraft/class_2520;official aLua;a(Lvc;Ljava/lang/String;Ljava/io/DataInput;Luj;)Lva;
-
copyFrom
Merges the entries ofsourceto this compound. The passed compound will not be modified. If both compounds contain a compound with the same key, they will be merged; otherwise the values of this compound will be overwritten.- Returns:
- this compound with entries merged
- Mappings:
Namespace Name Mixin selector named copyFromLnet/minecraft/nbt/NbtCompound;copyFrom(Lnet/minecraft/nbt/NbtCompound;)Lnet/minecraft/nbt/NbtCompound;intermediary method_10543Lnet/minecraft/class_2487;method_10543(Lnet/minecraft/class_2487;)Lnet/minecraft/class_2487;official aLua;a(Lua;)Lua;
-
accept
- Specified by:
acceptin interfaceNbtElement- Mappings:
Namespace Name Mixin selector named acceptLnet/minecraft/nbt/NbtElement;accept(Lnet/minecraft/nbt/visitor/NbtElementVisitor;)Vintermediary method_32289Lnet/minecraft/class_2520;method_32289(Lnet/minecraft/class_5627;)Vofficial aLva;a(Lve;)V
-
doAccept
- Specified by:
doAcceptin interfaceNbtElement- Mappings:
Namespace Name Mixin selector named doAcceptLnet/minecraft/nbt/NbtElement;doAccept(Lnet/minecraft/nbt/scanner/NbtScanner;)Lnet/minecraft/nbt/scanner/NbtScanner$Result;intermediary method_39850Lnet/minecraft/class_2520;method_39850(Lnet/minecraft/class_6836;)Lnet/minecraft/class_6836$class_6838;official aLva;a(Lux;)Lux$b;
-
put
- Mappings:
Namespace Name Mixin selector named putLnet/minecraft/nbt/NbtCompound;put(Ljava/lang/String;Lcom/mojang/serialization/Codec;Ljava/lang/Object;)Vintermediary method_67494Lnet/minecraft/class_2487;method_67494(Ljava/lang/String;Lcom/mojang/serialization/Codec;Ljava/lang/Object;)Vofficial aLua;a(Ljava/lang/String;Lcom/mojang/serialization/Codec;Ljava/lang/Object;)V
-
putNullable
- Mappings:
Namespace Name Mixin selector named putNullableLnet/minecraft/nbt/NbtCompound;putNullable(Ljava/lang/String;Lcom/mojang/serialization/Codec;Ljava/lang/Object;)Vintermediary method_68082Lnet/minecraft/class_2487;method_68082(Ljava/lang/String;Lcom/mojang/serialization/Codec;Ljava/lang/Object;)Vofficial bLua;b(Ljava/lang/String;Lcom/mojang/serialization/Codec;Ljava/lang/Object;)V
-
put
public <T> void put(String key, com.mojang.serialization.Codec<T> codec, com.mojang.serialization.DynamicOps<NbtElement> ops, T value) - Mappings:
Namespace Name Mixin selector named putLnet/minecraft/nbt/NbtCompound;put(Ljava/lang/String;Lcom/mojang/serialization/Codec;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)Vintermediary method_67493Lnet/minecraft/class_2487;method_67493(Ljava/lang/String;Lcom/mojang/serialization/Codec;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)Vofficial aLua;a(Ljava/lang/String;Lcom/mojang/serialization/Codec;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)V
-
putNullable
public <T> void putNullable(String key, com.mojang.serialization.Codec<T> codec, com.mojang.serialization.DynamicOps<NbtElement> ops, @Nullable T value) - Mappings:
Namespace Name Mixin selector named putNullableLnet/minecraft/nbt/NbtCompound;putNullable(Ljava/lang/String;Lcom/mojang/serialization/Codec;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)Vintermediary method_68081Lnet/minecraft/class_2487;method_68081(Ljava/lang/String;Lcom/mojang/serialization/Codec;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)Vofficial bLua;b(Ljava/lang/String;Lcom/mojang/serialization/Codec;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)V
-
copyFromCodec
public <T> void copyFromCodec(com.mojang.serialization.MapCodec<T> codec, T value) - Mappings:
Namespace Name Mixin selector named copyFromCodecLnet/minecraft/nbt/NbtCompound;copyFromCodec(Lcom/mojang/serialization/MapCodec;Ljava/lang/Object;)Vintermediary method_67490Lnet/minecraft/class_2487;method_67490(Lcom/mojang/serialization/MapCodec;Ljava/lang/Object;)Vofficial aLua;a(Lcom/mojang/serialization/MapCodec;Ljava/lang/Object;)V
-
copyFromCodec
public <T> void copyFromCodec(com.mojang.serialization.MapCodec<T> codec, com.mojang.serialization.DynamicOps<NbtElement> ops, T value) - Mappings:
Namespace Name Mixin selector named copyFromCodecLnet/minecraft/nbt/NbtCompound;copyFromCodec(Lcom/mojang/serialization/MapCodec;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)Vintermediary method_67489Lnet/minecraft/class_2487;method_67489(Lcom/mojang/serialization/MapCodec;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)Vofficial aLua;a(Lcom/mojang/serialization/MapCodec;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)V
-
get
- Mappings:
Namespace Name Mixin selector named getLnet/minecraft/nbt/NbtCompound;get(Ljava/lang/String;Lcom/mojang/serialization/Codec;)Ljava/util/Optional;intermediary method_67491Lnet/minecraft/class_2487;method_67491(Ljava/lang/String;Lcom/mojang/serialization/Codec;)Ljava/util/Optional;official aLua;a(Ljava/lang/String;Lcom/mojang/serialization/Codec;)Ljava/util/Optional;
-
get
public <T> Optional<T> get(String key, com.mojang.serialization.Codec<T> codec, com.mojang.serialization.DynamicOps<NbtElement> ops) - Mappings:
Namespace Name Mixin selector named getLnet/minecraft/nbt/NbtCompound;get(Ljava/lang/String;Lcom/mojang/serialization/Codec;Lcom/mojang/serialization/DynamicOps;)Ljava/util/Optional;intermediary method_67492Lnet/minecraft/class_2487;method_67492(Ljava/lang/String;Lcom/mojang/serialization/Codec;Lcom/mojang/serialization/DynamicOps;)Ljava/util/Optional;official aLua;a(Ljava/lang/String;Lcom/mojang/serialization/Codec;Lcom/mojang/serialization/DynamicOps;)Ljava/util/Optional;
-
decode
- Mappings:
Namespace Name Mixin selector named decodeLnet/minecraft/nbt/NbtCompound;decode(Lcom/mojang/serialization/MapCodec;)Ljava/util/Optional;intermediary method_67487Lnet/minecraft/class_2487;method_67487(Lcom/mojang/serialization/MapCodec;)Ljava/util/Optional;official aLua;a(Lcom/mojang/serialization/MapCodec;)Ljava/util/Optional;
-
decode
public <T> Optional<T> decode(com.mojang.serialization.MapCodec<T> codec, com.mojang.serialization.DynamicOps<NbtElement> ops) - Mappings:
Namespace Name Mixin selector named decodeLnet/minecraft/nbt/NbtCompound;decode(Lcom/mojang/serialization/MapCodec;Lcom/mojang/serialization/DynamicOps;)Ljava/util/Optional;intermediary method_67488Lnet/minecraft/class_2487;method_67488(Lcom/mojang/serialization/MapCodec;Lcom/mojang/serialization/DynamicOps;)Ljava/util/Optional;official aLua;a(Lcom/mojang/serialization/MapCodec;Lcom/mojang/serialization/DynamicOps;)Ljava/util/Optional;
-