Class NbtCompound

java.lang.Object
net.minecraft.nbt.NbtCompound
All Implemented Interfaces:
NbtElement

public final class NbtCompound extends Object implements NbtElement
Represents an NBT compound object. This mutable object holds unordered key-value pairs with distinct case-sensitive string keys. This can effectively be used like a 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/NbtCompound
intermediary net/minecraft/class_2487
official ua
  • Field Details Link icon

    • LOGGER Link icon

      private static final Logger LOGGER
      Mappings:
      Namespace Name Mixin selector
      named LOGGER Lnet/minecraft/nbt/NbtCompound;LOGGER:Lorg/slf4j/Logger;
      intermediary field_56522 Lnet/minecraft/class_2487;field_56522:Lorg/slf4j/Logger;
      official c Lua;c:Lorg/slf4j/Logger;
    • CODEC Link icon

      public static final com.mojang.serialization.Codec<NbtCompound> CODEC
      Mappings:
      Namespace Name Mixin selector
      named CODEC Lnet/minecraft/nbt/NbtCompound;CODEC:Lcom/mojang/serialization/Codec;
      intermediary field_25128 Lnet/minecraft/class_2487;field_25128:Lcom/mojang/serialization/Codec;
      official a Lua;a:Lcom/mojang/serialization/Codec;
    • SIZE Link icon

      private static final int SIZE
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named SIZE Lnet/minecraft/nbt/NbtCompound;SIZE:I
      intermediary field_41718 Lnet/minecraft/class_2487;field_41718:I
      official v Lua;v:I
    • field_41719 Link icon

      private static final int field_41719
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named field_41719 Lnet/minecraft/nbt/NbtCompound;field_41719:I
      intermediary field_41719 Lnet/minecraft/class_2487;field_41719:I
      official w Lua;w:I
    • TYPE Link icon

      public static final NbtType<NbtCompound> TYPE
      Mappings:
      Namespace Name Mixin selector
      named TYPE Lnet/minecraft/nbt/NbtCompound;TYPE:Lnet/minecraft/nbt/NbtType;
      intermediary field_21029 Lnet/minecraft/class_2487;field_21029:Lnet/minecraft/class_4614;
      official b Lua;b:Lvc;
    • entries Link icon

      private final Map<String,NbtElement> entries
      Mappings:
      Namespace Name Mixin selector
      named entries Lnet/minecraft/nbt/NbtCompound;entries:Ljava/util/Map;
      intermediary field_11515 Lnet/minecraft/class_2487;field_11515:Ljava/util/Map;
      official x Lua;x:Ljava/util/Map;
  • Constructor Details Link icon

    • NbtCompound Link icon

      NbtCompound(Map<String,NbtElement> entries)
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/nbt/NbtCompound;<init>(Ljava/util/Map;)V
      intermediary <init> Lnet/minecraft/class_2487;<init>(Ljava/util/Map;)V
      official <init> Lua;<init>(Ljava/util/Map;)V
    • NbtCompound Link icon

      public NbtCompound()
  • Method Details Link icon

    • write Link icon

      public void write(DataOutput output) throws IOException
      Writes the NBT element to output.
      Specified by:
      write in interface NbtElement
      Throws:
      IOException
      API Note:
      This is a low-level method for serializing NBT elements; consider using NbtIo, NbtOps, or PacketByteBuf.writeNbt(net.minecraft.nbt.NbtElement) instead.
      Mappings:
      Namespace Name Mixin selector
      named write Lnet/minecraft/nbt/NbtElement;write(Ljava/io/DataOutput;)V
      intermediary method_10713 Lnet/minecraft/class_2520;method_10713(Ljava/io/DataOutput;)V
      official a Lva;a(Ljava/io/DataOutput;)V
    • getSizeInBytes Link icon

      public int getSizeInBytes()
      Specified by:
      getSizeInBytes in interface NbtElement
      Mappings:
      Namespace Name Mixin selector
      named getSizeInBytes Lnet/minecraft/nbt/NbtElement;getSizeInBytes()I
      intermediary method_47988 Lnet/minecraft/class_2520;method_47988()I
      official a Lva;a()I
    • getKeys Link icon

      public Set<String> getKeys()
      Returns the set of keys in this compound.
      Returns:
      the set of keys in this compound
      Mappings:
      Namespace Name Mixin selector
      named getKeys Lnet/minecraft/nbt/NbtCompound;getKeys()Ljava/util/Set;
      intermediary method_10541 Lnet/minecraft/class_2487;method_10541()Ljava/util/Set;
      official e Lua;e()Ljava/util/Set;
    • entrySet Link icon

      public Set<Map.Entry<String,NbtElement>> entrySet()
      Mappings:
      Namespace Name Mixin selector
      named entrySet Lnet/minecraft/nbt/NbtCompound;entrySet()Ljava/util/Set;
      intermediary method_59874 Lnet/minecraft/class_2487;method_59874()Ljava/util/Set;
      official g Lua;g()Ljava/util/Set;
    • values Link icon

      public Collection<NbtElement> values()
      Mappings:
      Namespace Name Mixin selector
      named values Lnet/minecraft/nbt/NbtCompound;values()Ljava/util/Collection;
      intermediary method_68567 Lnet/minecraft/class_2487;method_68567()Ljava/util/Collection;
      official h Lua;h()Ljava/util/Collection;
    • forEach Link icon

      public void forEach(BiConsumer<String,NbtElement> entryConsumer)
      Mappings:
      Namespace Name Mixin selector
      named forEach Lnet/minecraft/nbt/NbtCompound;forEach(Ljava/util/function/BiConsumer;)V
      intermediary method_68561 Lnet/minecraft/class_2487;method_68561(Ljava/util/function/BiConsumer;)V
      official a Lua;a(Ljava/util/function/BiConsumer;)V
    • getType Link icon

      public byte getType()
      Returns the type of this NBT element.
      Specified by:
      getType in interface NbtElement
      Returns:
      the type of this NBT element
      Mappings:
      Namespace Name Mixin selector
      named getType Lnet/minecraft/nbt/NbtElement;getType()B
      intermediary method_10711 Lnet/minecraft/class_2520;method_10711()B
      official b Lva;b()B
    • getNbtType Link icon

      public NbtType<NbtCompound> getNbtType()
      Returns the NBT type definition of this NBT element.
      Specified by:
      getNbtType in interface NbtElement
      Returns:
      the NBT type definition of this NBT element
      Mappings:
      Namespace Name Mixin selector
      named getNbtType Lnet/minecraft/nbt/NbtElement;getNbtType()Lnet/minecraft/nbt/NbtType;
      intermediary method_23258 Lnet/minecraft/class_2520;method_23258()Lnet/minecraft/class_4614;
      official c Lva;c()Lvc;
    • getSize Link icon

      public int getSize()
      Returns the size of this compound.
      Returns:
      the size of this compound
      Mappings:
      Namespace Name Mixin selector
      named getSize Lnet/minecraft/nbt/NbtCompound;getSize()I
      intermediary method_10546 Lnet/minecraft/class_2487;method_10546()I
      official i Lua;i()I
    • put Link icon

      @Nullable public @Nullable NbtElement put(String key, NbtElement element)
      Puts an element to this compound.
      Returns:
      the previous value, or null if there was none
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named put Lnet/minecraft/nbt/NbtCompound;put(Ljava/lang/String;Lnet/minecraft/nbt/NbtElement;)Lnet/minecraft/nbt/NbtElement;
      intermediary method_10566 Lnet/minecraft/class_2487;method_10566(Ljava/lang/String;Lnet/minecraft/class_2520;)Lnet/minecraft/class_2520;
      official a Lua;a(Ljava/lang/String;Lva;)Lva;
    • putByte Link icon

      public void putByte(String key, byte value)
      Puts a byte to this compound.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named putByte Lnet/minecraft/nbt/NbtCompound;putByte(Ljava/lang/String;B)V
      intermediary method_10567 Lnet/minecraft/class_2487;method_10567(Ljava/lang/String;B)V
      official a Lua;a(Ljava/lang/String;B)V
    • putShort Link icon

      public void putShort(String key, short value)
      Puts a short to this compound.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named putShort Lnet/minecraft/nbt/NbtCompound;putShort(Ljava/lang/String;S)V
      intermediary method_10575 Lnet/minecraft/class_2487;method_10575(Ljava/lang/String;S)V
      official a Lua;a(Ljava/lang/String;S)V
    • putInt Link icon

      public void putInt(String key, int value)
      Puts an int to this compound.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named putInt Lnet/minecraft/nbt/NbtCompound;putInt(Ljava/lang/String;I)V
      intermediary method_10569 Lnet/minecraft/class_2487;method_10569(Ljava/lang/String;I)V
      official a Lua;a(Ljava/lang/String;I)V
    • putLong Link icon

      public void putLong(String key, long value)
      Puts a long to this compound.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named putLong Lnet/minecraft/nbt/NbtCompound;putLong(Ljava/lang/String;J)V
      intermediary method_10544 Lnet/minecraft/class_2487;method_10544(Ljava/lang/String;J)V
      official a Lua;a(Ljava/lang/String;J)V
    • putFloat Link icon

      public void putFloat(String key, float value)
      Puts a float to this compound.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named putFloat Lnet/minecraft/nbt/NbtCompound;putFloat(Ljava/lang/String;F)V
      intermediary method_10548 Lnet/minecraft/class_2487;method_10548(Ljava/lang/String;F)V
      official a Lua;a(Ljava/lang/String;F)V
    • putDouble Link icon

      public void putDouble(String key, double value)
      Puts a double to this compound.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named putDouble Lnet/minecraft/nbt/NbtCompound;putDouble(Ljava/lang/String;D)V
      intermediary method_10549 Lnet/minecraft/class_2487;method_10549(Ljava/lang/String;D)V
      official a Lua;a(Ljava/lang/String;D)V
    • putString Link icon

      public void putString(String key, String value)
      Puts a String to this compound.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named putString Lnet/minecraft/nbt/NbtCompound;putString(Ljava/lang/String;Ljava/lang/String;)V
      intermediary method_10582 Lnet/minecraft/class_2487;method_10582(Ljava/lang/String;Ljava/lang/String;)V
      official a Lua;a(Ljava/lang/String;Ljava/lang/String;)V
    • putByteArray Link icon

      public void putByteArray(String key, byte[] value)
      Puts a byte array to this compound. This does not copy the array.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named putByteArray Lnet/minecraft/nbt/NbtCompound;putByteArray(Ljava/lang/String;[B)V
      intermediary method_10570 Lnet/minecraft/class_2487;method_10570(Ljava/lang/String;[B)V
      official a Lua;a(Ljava/lang/String;[B)V
    • putIntArray Link icon

      public void putIntArray(String key, int[] value)
      Puts an int array to this compound. This does not copy the array.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named putIntArray Lnet/minecraft/nbt/NbtCompound;putIntArray(Ljava/lang/String;[I)V
      intermediary method_10539 Lnet/minecraft/class_2487;method_10539(Ljava/lang/String;[I)V
      official a Lua;a(Ljava/lang/String;[I)V
    • putLongArray Link icon

      public void putLongArray(String key, long[] value)
      Puts a long array to this compound. This does not copy the array.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named putLongArray Lnet/minecraft/nbt/NbtCompound;putLongArray(Ljava/lang/String;[J)V
      intermediary method_10564 Lnet/minecraft/class_2487;method_10564(Ljava/lang/String;[J)V
      official a Lua;a(Ljava/lang/String;[J)V
    • putBoolean Link icon

      public void putBoolean(String key, boolean value)
      Puts a boolean to this compound. The value is stored as NbtByte.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named putBoolean Lnet/minecraft/nbt/NbtCompound;putBoolean(Ljava/lang/String;Z)V
      intermediary method_10556 Lnet/minecraft/class_2487;method_10556(Ljava/lang/String;Z)V
      official a Lua;a(Ljava/lang/String;Z)V
    • get Link icon

      Returns the element associated with the key from this compound, or null if there is none.
      Returns:
      the element associated with the key from this compound, or null if 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 get Lnet/minecraft/nbt/NbtCompound;get(Ljava/lang/String;)Lnet/minecraft/nbt/NbtElement;
      intermediary method_10580 Lnet/minecraft/class_2487;method_10580(Ljava/lang/String;)Lnet/minecraft/class_2520;
      official a Lua;a(Ljava/lang/String;)Lva;
    • contains Link icon

      public boolean contains(String key)
      Determines whether the NBT compound object contains the specified key.
      Returns:
      true if the key exists, else false
      Mappings:
      Namespace Name Mixin selector
      named contains Lnet/minecraft/nbt/NbtCompound;contains(Ljava/lang/String;)Z
      intermediary method_10545 Lnet/minecraft/class_2487;method_10545(Ljava/lang/String;)Z
      official b Lua;b(Ljava/lang/String;)Z
    • getOptional Link icon

      private Optional<NbtElement> getOptional(String key)
      Mappings:
      Namespace Name Mixin selector
      named getOptional Lnet/minecraft/nbt/NbtCompound;getOptional(Ljava/lang/String;)Ljava/util/Optional;
      intermediary method_68570 Lnet/minecraft/class_2487;method_68570(Ljava/lang/String;)Ljava/util/Optional;
      official s Lua;s(Ljava/lang/String;)Ljava/util/Optional;
    • getByte Link icon

      public Optional<Byte> getByte(String key)
      Returns the byte associated with key, or 0 if there is no number stored with the key.

      If a non-byte numeric value is stored, this will cast the value.

      Returns:
      the byte associated with key, or 0 if there is no number stored with the key
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named getByte Lnet/minecraft/nbt/NbtCompound;getByte(Ljava/lang/String;)Ljava/util/Optional;
      intermediary method_10571 Lnet/minecraft/class_2487;method_10571(Ljava/lang/String;)Ljava/util/Optional;
      official c Lua;c(Ljava/lang/String;)Ljava/util/Optional;
    • getByte Link icon

      public byte getByte(String key, byte fallback)
      Returns the byte associated with key, or fallback if there is no number stored with the key.

      If a non-byte numeric value is stored, this will cast the value.

      Returns:
      the byte associated with key, or fallback if there is no number stored with the key
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named getByte Lnet/minecraft/nbt/NbtCompound;getByte(Ljava/lang/String;B)B
      intermediary method_68562 Lnet/minecraft/class_2487;method_68562(Ljava/lang/String;B)B
      official b Lua;b(Ljava/lang/String;B)B
    • getShort Link icon

      public Optional<Short> getShort(String key)
      Returns the short associated with key, or 0 if there is no number stored with the key.

      If a non-short numeric value is stored, this will cast the value.

      Returns:
      the short associated with key, or 0 if there is no number stored with the key
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named getShort Lnet/minecraft/nbt/NbtCompound;getShort(Ljava/lang/String;)Ljava/util/Optional;
      intermediary method_10568 Lnet/minecraft/class_2487;method_10568(Ljava/lang/String;)Ljava/util/Optional;
      official d Lua;d(Ljava/lang/String;)Ljava/util/Optional;
    • getShort Link icon

      public short getShort(String key, short fallback)
      Returns the short associated with key, or fallback if there is no number stored with the key.

      If a non-short numeric value is stored, this will cast the value.

      Returns:
      the short associated with key, or fallback if there is no number stored with the key
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named getShort Lnet/minecraft/nbt/NbtCompound;getShort(Ljava/lang/String;S)S
      intermediary method_68565 Lnet/minecraft/class_2487;method_68565(Ljava/lang/String;S)S
      official b Lua;b(Ljava/lang/String;S)S
    • getInt Link icon

      public Optional<Integer> getInt(String key)
      Returns the int associated with key, or 0 if there is no number stored with the key.

      If a non-integer numeric value is stored, this will cast the value.

      Returns:
      the int associated with key, or 0 if there is no number stored with the key
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named getInt Lnet/minecraft/nbt/NbtCompound;getInt(Ljava/lang/String;)Ljava/util/Optional;
      intermediary method_10550 Lnet/minecraft/class_2487;method_10550(Ljava/lang/String;)Ljava/util/Optional;
      official e Lua;e(Ljava/lang/String;)Ljava/util/Optional;
    • getInt Link icon

      public int getInt(String key, int fallback)
      Returns the int associated with key, or fallback if there is no number stored with the key.

      If a non-integer numeric value is stored, this will cast the value.

      Returns:
      the int associated with key, or fallback if there is no number stored with the key
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named getInt Lnet/minecraft/nbt/NbtCompound;getInt(Ljava/lang/String;I)I
      intermediary method_68083 Lnet/minecraft/class_2487;method_68083(Ljava/lang/String;I)I
      official b Lua;b(Ljava/lang/String;I)I
    • getLong Link icon

      public Optional<Long> getLong(String key)
      Returns the long associated with key, or 0L if there is no number stored with the key.

      If a non-long numeric value is stored, this will cast the value.

      Returns:
      the long associated with key, or 0L if there is no number stored with the key
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named getLong Lnet/minecraft/nbt/NbtCompound;getLong(Ljava/lang/String;)Ljava/util/Optional;
      intermediary method_10537 Lnet/minecraft/class_2487;method_10537(Ljava/lang/String;)Ljava/util/Optional;
      official f Lua;f(Ljava/lang/String;)Ljava/util/Optional;
    • getLong Link icon

      public long getLong(String key, long fallback)
      Returns the long associated with key, or fallback if there is no number stored with the key.

      If a non-long numeric value is stored, this will cast the value.

      Returns:
      the long associated with key, or fallback if there is no number stored with the key
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named getLong Lnet/minecraft/nbt/NbtCompound;getLong(Ljava/lang/String;J)J
      intermediary method_68080 Lnet/minecraft/class_2487;method_68080(Ljava/lang/String;J)J
      official b Lua;b(Ljava/lang/String;J)J
    • getFloat Link icon

      public Optional<Float> getFloat(String key)
      Returns the float associated with key, or 0.0f if there is no number stored with the key.

      If a non-float numeric value is stored, this will cast the value.

      Returns:
      the float associated with key, or 0.0f if there is no number stored with the key
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named getFloat Lnet/minecraft/nbt/NbtCompound;getFloat(Ljava/lang/String;)Ljava/util/Optional;
      intermediary method_10583 Lnet/minecraft/class_2487;method_10583(Ljava/lang/String;)Ljava/util/Optional;
      official g Lua;g(Ljava/lang/String;)Ljava/util/Optional;
    • getFloat Link icon

      public float getFloat(String key, float fallback)
      Returns the float associated with key, or fallback if there is no number stored with the key.

      If a non-float numeric value is stored, this will cast the value.

      Returns:
      the float associated with key, or fallback if there is no number stored with the key
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named getFloat Lnet/minecraft/nbt/NbtCompound;getFloat(Ljava/lang/String;F)F
      intermediary method_66563 Lnet/minecraft/class_2487;method_66563(Ljava/lang/String;F)F
      official b Lua;b(Ljava/lang/String;F)F
    • getDouble Link icon

      public Optional<Double> getDouble(String key)
      Returns the double associated with key, or 0.0 if there is no number stored with the key.

      If a non-double numeric value is stored, this will cast the value.

      Returns:
      the double associated with key, or 0.0 if there is no number stored with the key
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named getDouble Lnet/minecraft/nbt/NbtCompound;getDouble(Ljava/lang/String;)Ljava/util/Optional;
      intermediary method_10574 Lnet/minecraft/class_2487;method_10574(Ljava/lang/String;)Ljava/util/Optional;
      official h Lua;h(Ljava/lang/String;)Ljava/util/Optional;
    • getDouble Link icon

      public double getDouble(String key, double fallback)
      Returns the double associated with key, or fallback if there is no number stored with the key.

      If a non-double numeric value is stored, this will cast the value.

      Returns:
      the double associated with key, or fallback if there is no number stored with the key
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named getDouble Lnet/minecraft/nbt/NbtCompound;getDouble(Ljava/lang/String;D)D
      intermediary method_68563 Lnet/minecraft/class_2487;method_68563(Ljava/lang/String;D)D
      official b Lua;b(Ljava/lang/String;D)D
    • getString Link icon

      public Optional<String> getString(String key)
      Returns the String associated with key, or an empty string if there is no string stored with the key.
      Returns:
      the String associated with key, or an empty string if there is no string stored with the key
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named getString Lnet/minecraft/nbt/NbtCompound;getString(Ljava/lang/String;)Ljava/util/Optional;
      intermediary method_10558 Lnet/minecraft/class_2487;method_10558(Ljava/lang/String;)Ljava/util/Optional;
      official i Lua;i(Ljava/lang/String;)Ljava/util/Optional;
    • getString Link icon

      public String getString(String key, String fallback)
      Returns the String associated with key, or fallback if there is no string stored with the key.
      Returns:
      the String associated with key, or fallback if there is no string stored with the key
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named getString Lnet/minecraft/nbt/NbtCompound;getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
      intermediary method_68564 Lnet/minecraft/class_2487;method_68564(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
      official b Lua;b(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    • getByteArray Link icon

      public Optional<byte[]> getByteArray(String key)
      Returns the byte array associated with key, 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 getByteArray Lnet/minecraft/nbt/NbtCompound;getByteArray(Ljava/lang/String;)Ljava/util/Optional;
      intermediary method_10547 Lnet/minecraft/class_2487;method_10547(Ljava/lang/String;)Ljava/util/Optional;
      official j Lua;j(Ljava/lang/String;)Ljava/util/Optional;
    • getIntArray Link icon

      public Optional<int[]> getIntArray(String key)
      Returns the int array associated with key, 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 getIntArray Lnet/minecraft/nbt/NbtCompound;getIntArray(Ljava/lang/String;)Ljava/util/Optional;
      intermediary method_10561 Lnet/minecraft/class_2487;method_10561(Ljava/lang/String;)Ljava/util/Optional;
      official k Lua;k(Ljava/lang/String;)Ljava/util/Optional;
    • getLongArray Link icon

      public Optional<long[]> getLongArray(String key)
      Returns the long array associated with key, 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 getLongArray Lnet/minecraft/nbt/NbtCompound;getLongArray(Ljava/lang/String;)Ljava/util/Optional;
      intermediary method_10565 Lnet/minecraft/class_2487;method_10565(Ljava/lang/String;)Ljava/util/Optional;
      official l Lua;l(Ljava/lang/String;)Ljava/util/Optional;
    • getCompound Link icon

      public Optional<NbtCompound> getCompound(String key)
      Returns the compound associated with key, 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 getCompound Lnet/minecraft/nbt/NbtCompound;getCompound(Ljava/lang/String;)Ljava/util/Optional;
      intermediary method_10562 Lnet/minecraft/class_2487;method_10562(Ljava/lang/String;)Ljava/util/Optional;
      official m Lua;m(Ljava/lang/String;)Ljava/util/Optional;
    • getCompoundOrEmpty Link icon

      public NbtCompound getCompoundOrEmpty(String key)
      Mappings:
      Namespace Name Mixin selector
      named getCompoundOrEmpty Lnet/minecraft/nbt/NbtCompound;getCompoundOrEmpty(Ljava/lang/String;)Lnet/minecraft/nbt/NbtCompound;
      intermediary method_68568 Lnet/minecraft/class_2487;method_68568(Ljava/lang/String;)Lnet/minecraft/class_2487;
      official n Lua;n(Ljava/lang/String;)Lua;
    • getList Link icon

      public Optional<NbtList> getList(String key)
      Returns the list associated with key, 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 getList Lnet/minecraft/nbt/NbtCompound;getList(Ljava/lang/String;)Ljava/util/Optional;
      intermediary method_10554 Lnet/minecraft/class_2487;method_10554(Ljava/lang/String;)Ljava/util/Optional;
      official o Lua;o(Ljava/lang/String;)Ljava/util/Optional;
    • getListOrEmpty Link icon

      public NbtList getListOrEmpty(String key)
      Mappings:
      Namespace Name Mixin selector
      named getListOrEmpty Lnet/minecraft/nbt/NbtCompound;getListOrEmpty(Ljava/lang/String;)Lnet/minecraft/nbt/NbtList;
      intermediary method_68569 Lnet/minecraft/class_2487;method_68569(Ljava/lang/String;)Lnet/minecraft/class_2499;
      official p Lua;p(Ljava/lang/String;)Lug;
    • getBoolean Link icon

      public Optional<Boolean> getBoolean(String key)
      Returns the boolean value stored with the key.
      Returns:
      the boolean value stored with the key
      Implementation Note:
      Since NBT does not have a boolean type, NbtByte is used instead. This method returns true for any values which, after casting to byte as described at getByte(String), is not 0. Since all non-numeric values become 0 during casting to bytes, this method returns false for 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 getBoolean Lnet/minecraft/nbt/NbtCompound;getBoolean(Ljava/lang/String;)Ljava/util/Optional;
      intermediary method_10577 Lnet/minecraft/class_2487;method_10577(Ljava/lang/String;)Ljava/util/Optional;
      official q Lua;q(Ljava/lang/String;)Ljava/util/Optional;
    • getBoolean Link icon

      public boolean getBoolean(String key, boolean fallback)
      Mappings:
      Namespace Name Mixin selector
      named getBoolean Lnet/minecraft/nbt/NbtCompound;getBoolean(Ljava/lang/String;Z)Z
      intermediary method_68566 Lnet/minecraft/class_2487;method_68566(Ljava/lang/String;Z)Z
      official b Lua;b(Ljava/lang/String;Z)Z
    • remove Link icon

      public void remove(String key)
      Removes the entry with the specified key. Does nothing if there is none.
      Mappings:
      Namespace Name Mixin selector
      named remove Lnet/minecraft/nbt/NbtCompound;remove(Ljava/lang/String;)V
      intermediary method_10551 Lnet/minecraft/class_2487;method_10551(Ljava/lang/String;)V
      official r Lua;r(Ljava/lang/String;)V
    • toString Link icon

      public String toString()
      Specified by:
      toString in interface NbtElement
      Overrides:
      toString in class Object
    • isEmpty Link icon

      public boolean isEmpty()
      Returns whether the compound has no entries.
      Returns:
      whether the compound has no entries
      Mappings:
      Namespace Name Mixin selector
      named isEmpty Lnet/minecraft/nbt/NbtCompound;isEmpty()Z
      intermediary method_33133 Lnet/minecraft/class_2487;method_33133()Z
      official j Lua;j()Z
    • shallowCopy Link icon

      protected NbtCompound shallowCopy()
      Mappings:
      Namespace Name Mixin selector
      named shallowCopy Lnet/minecraft/nbt/NbtCompound;shallowCopy()Lnet/minecraft/nbt/NbtCompound;
      intermediary method_59873 Lnet/minecraft/class_2487;method_59873()Lnet/minecraft/class_2487;
      official k Lua;k()Lua;
    • copy Link icon

      public NbtCompound copy()
      Description copied from interface: NbtElement
      Returns an NBT element of equal value that won't change with this element.
      Specified by:
      copy in interface NbtElement
      Returns:
      an NBT element of equal value that won't change with this element
      Mappings:
      Namespace Name Mixin selector
      named copy Lnet/minecraft/nbt/NbtCompound;copy()Lnet/minecraft/nbt/NbtCompound;
      intermediary method_10553 Lnet/minecraft/class_2487;method_10553()Lnet/minecraft/class_2487;
      official l Lua;l()Lua;
    • asCompound Link icon

      public Optional<NbtCompound> asCompound()
      Specified by:
      asCompound in interface NbtElement
      Mappings:
      Namespace Name Mixin selector
      named asCompound Lnet/minecraft/nbt/NbtElement;asCompound()Ljava/util/Optional;
      intermediary method_68571 Lnet/minecraft/class_2520;method_68571()Ljava/util/Optional;
      official s_ Lva;s_()Ljava/util/Optional;
    • equals Link icon

      public boolean equals(Object o)
      Overrides:
      equals in class Object
      Mappings:
      Namespace Name Mixin selector
      named equals Lnet/minecraft/nbt/NbtCompound;equals(Ljava/lang/Object;)Z
      intermediary equals Lnet/minecraft/class_2487;equals(Ljava/lang/Object;)Z
      official equals Lua;equals(Ljava/lang/Object;)Z
    • hashCode Link icon

      public int hashCode()
      Overrides:
      hashCode in class Object
    • write Link icon

      private static void write(String key, NbtElement element, DataOutput output) throws IOException
      Throws:
      IOException
      Mappings:
      Namespace Name Mixin selector
      named write Lnet/minecraft/nbt/NbtCompound;write(Ljava/lang/String;Lnet/minecraft/nbt/NbtElement;Ljava/io/DataOutput;)V
      intermediary method_10555 Lnet/minecraft/class_2487;method_10555(Ljava/lang/String;Lnet/minecraft/class_2520;Ljava/io/DataOutput;)V
      official a Lua;a(Ljava/lang/String;Lva;Ljava/io/DataOutput;)V
    • read Link icon

      static NbtElement read(NbtType<?> reader, String key, DataInput input, NbtSizeTracker tracker)
      Mappings:
      Namespace Name Mixin selector
      named read Lnet/minecraft/nbt/NbtCompound;read(Lnet/minecraft/nbt/NbtType;Ljava/lang/String;Ljava/io/DataInput;Lnet/minecraft/nbt/NbtSizeTracker;)Lnet/minecraft/nbt/NbtElement;
      intermediary method_10581 Lnet/minecraft/class_2487;method_10581(Lnet/minecraft/class_4614;Ljava/lang/String;Ljava/io/DataInput;Lnet/minecraft/class_2505;)Lnet/minecraft/class_2520;
      official a Lua;a(Lvc;Ljava/lang/String;Ljava/io/DataInput;Luj;)Lva;
    • copyFrom Link icon

      public NbtCompound copyFrom(NbtCompound source)
      Merges the entries of source to 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 copyFrom Lnet/minecraft/nbt/NbtCompound;copyFrom(Lnet/minecraft/nbt/NbtCompound;)Lnet/minecraft/nbt/NbtCompound;
      intermediary method_10543 Lnet/minecraft/class_2487;method_10543(Lnet/minecraft/class_2487;)Lnet/minecraft/class_2487;
      official a Lua;a(Lua;)Lua;
    • accept Link icon

      public void accept(NbtElementVisitor visitor)
      Specified by:
      accept in interface NbtElement
      Mappings:
      Namespace Name Mixin selector
      named accept Lnet/minecraft/nbt/NbtElement;accept(Lnet/minecraft/nbt/visitor/NbtElementVisitor;)V
      intermediary method_32289 Lnet/minecraft/class_2520;method_32289(Lnet/minecraft/class_5627;)V
      official a Lva;a(Lve;)V
    • doAccept Link icon

      public NbtScanner.Result doAccept(NbtScanner visitor)
      Specified by:
      doAccept in interface NbtElement
      Mappings:
      Namespace Name Mixin selector
      named doAccept Lnet/minecraft/nbt/NbtElement;doAccept(Lnet/minecraft/nbt/scanner/NbtScanner;)Lnet/minecraft/nbt/scanner/NbtScanner$Result;
      intermediary method_39850 Lnet/minecraft/class_2520;method_39850(Lnet/minecraft/class_6836;)Lnet/minecraft/class_6836$class_6838;
      official a Lva;a(Lux;)Lux$b;
    • put Link icon

      public <T> void put(String key, com.mojang.serialization.Codec<T> codec, T value)
      Mappings:
      Namespace Name Mixin selector
      named put Lnet/minecraft/nbt/NbtCompound;put(Ljava/lang/String;Lcom/mojang/serialization/Codec;Ljava/lang/Object;)V
      intermediary method_67494 Lnet/minecraft/class_2487;method_67494(Ljava/lang/String;Lcom/mojang/serialization/Codec;Ljava/lang/Object;)V
      official a Lua;a(Ljava/lang/String;Lcom/mojang/serialization/Codec;Ljava/lang/Object;)V
    • putNullable Link icon

      public <T> void putNullable(String key, com.mojang.serialization.Codec<T> codec, @Nullable T value)
      Mappings:
      Namespace Name Mixin selector
      named putNullable Lnet/minecraft/nbt/NbtCompound;putNullable(Ljava/lang/String;Lcom/mojang/serialization/Codec;Ljava/lang/Object;)V
      intermediary method_68082 Lnet/minecraft/class_2487;method_68082(Ljava/lang/String;Lcom/mojang/serialization/Codec;Ljava/lang/Object;)V
      official b Lua;b(Ljava/lang/String;Lcom/mojang/serialization/Codec;Ljava/lang/Object;)V
    • put Link icon

      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 put Lnet/minecraft/nbt/NbtCompound;put(Ljava/lang/String;Lcom/mojang/serialization/Codec;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)V
      intermediary method_67493 Lnet/minecraft/class_2487;method_67493(Ljava/lang/String;Lcom/mojang/serialization/Codec;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)V
      official a Lua;a(Ljava/lang/String;Lcom/mojang/serialization/Codec;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)V
    • putNullable Link icon

      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 putNullable Lnet/minecraft/nbt/NbtCompound;putNullable(Ljava/lang/String;Lcom/mojang/serialization/Codec;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)V
      intermediary method_68081 Lnet/minecraft/class_2487;method_68081(Ljava/lang/String;Lcom/mojang/serialization/Codec;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)V
      official b Lua;b(Ljava/lang/String;Lcom/mojang/serialization/Codec;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)V
    • copyFromCodec Link icon

      public <T> void copyFromCodec(com.mojang.serialization.MapCodec<T> codec, T value)
      Mappings:
      Namespace Name Mixin selector
      named copyFromCodec Lnet/minecraft/nbt/NbtCompound;copyFromCodec(Lcom/mojang/serialization/MapCodec;Ljava/lang/Object;)V
      intermediary method_67490 Lnet/minecraft/class_2487;method_67490(Lcom/mojang/serialization/MapCodec;Ljava/lang/Object;)V
      official a Lua;a(Lcom/mojang/serialization/MapCodec;Ljava/lang/Object;)V
    • copyFromCodec Link icon

      public <T> void copyFromCodec(com.mojang.serialization.MapCodec<T> codec, com.mojang.serialization.DynamicOps<NbtElement> ops, T value)
      Mappings:
      Namespace Name Mixin selector
      named copyFromCodec Lnet/minecraft/nbt/NbtCompound;copyFromCodec(Lcom/mojang/serialization/MapCodec;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)V
      intermediary method_67489 Lnet/minecraft/class_2487;method_67489(Lcom/mojang/serialization/MapCodec;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)V
      official a Lua;a(Lcom/mojang/serialization/MapCodec;Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)V
    • get Link icon

      public <T> Optional<T> get(String key, com.mojang.serialization.Codec<T> codec)
      Mappings:
      Namespace Name Mixin selector
      named get Lnet/minecraft/nbt/NbtCompound;get(Ljava/lang/String;Lcom/mojang/serialization/Codec;)Ljava/util/Optional;
      intermediary method_67491 Lnet/minecraft/class_2487;method_67491(Ljava/lang/String;Lcom/mojang/serialization/Codec;)Ljava/util/Optional;
      official a Lua;a(Ljava/lang/String;Lcom/mojang/serialization/Codec;)Ljava/util/Optional;
    • get Link icon

      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 get Lnet/minecraft/nbt/NbtCompound;get(Ljava/lang/String;Lcom/mojang/serialization/Codec;Lcom/mojang/serialization/DynamicOps;)Ljava/util/Optional;
      intermediary method_67492 Lnet/minecraft/class_2487;method_67492(Ljava/lang/String;Lcom/mojang/serialization/Codec;Lcom/mojang/serialization/DynamicOps;)Ljava/util/Optional;
      official a Lua;a(Ljava/lang/String;Lcom/mojang/serialization/Codec;Lcom/mojang/serialization/DynamicOps;)Ljava/util/Optional;
    • decode Link icon

      public <T> Optional<T> decode(com.mojang.serialization.MapCodec<T> codec)
      Mappings:
      Namespace Name Mixin selector
      named decode Lnet/minecraft/nbt/NbtCompound;decode(Lcom/mojang/serialization/MapCodec;)Ljava/util/Optional;
      intermediary method_67487 Lnet/minecraft/class_2487;method_67487(Lcom/mojang/serialization/MapCodec;)Ljava/util/Optional;
      official a Lua;a(Lcom/mojang/serialization/MapCodec;)Ljava/util/Optional;
    • decode Link icon

      public <T> Optional<T> decode(com.mojang.serialization.MapCodec<T> codec, com.mojang.serialization.DynamicOps<NbtElement> ops)
      Mappings:
      Namespace Name Mixin selector
      named decode Lnet/minecraft/nbt/NbtCompound;decode(Lcom/mojang/serialization/MapCodec;Lcom/mojang/serialization/DynamicOps;)Ljava/util/Optional;
      intermediary method_67488 Lnet/minecraft/class_2487;method_67488(Lcom/mojang/serialization/MapCodec;Lcom/mojang/serialization/DynamicOps;)Ljava/util/Optional;
      official a Lua;a(Lcom/mojang/serialization/MapCodec;Lcom/mojang/serialization/DynamicOps;)Ljava/util/Optional;