Class CompoundTag

java.lang.Object
net.minecraft.nbt.CompoundTag
All Implemented Interfaces:
Tag

public final class CompoundTag extends Object implements Tag
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • CODEC

      public static final com.mojang.serialization.Codec<CompoundTag> 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

      public static final TagType<CompoundTag> TYPE
    • tags

      private final Map<String,Tag> tags
  • Constructor Details

    • CompoundTag

      CompoundTag(Map<String,Tag> p_128333_)
    • CompoundTag

      public CompoundTag()
  • Method Details

    • write

      public void write(DataOutput p_128341_) throws IOException
      Specified by:
      write in interface Tag
      Throws:
      IOException
    • sizeInBytes

      public int sizeInBytes()
      Specified by:
      sizeInBytes in interface Tag
    • keySet

      public Set<String> keySet()
    • entrySet

      public Set<Map.Entry<String,Tag>> entrySet()
    • values

      public Collection<Tag> values()
    • forEach

      public void forEach(BiConsumer<String,Tag> p_409767_)
    • getId

      public byte getId()
      Specified by:
      getId in interface Tag
    • getType

      public TagType<CompoundTag> getType()
      Specified by:
      getType in interface Tag
    • size

      public int size()
    • put

      @Nullable public Tag put(String p_128366_, Tag p_128367_)
    • putByte

      public void putByte(String p_128345_, byte p_128346_)
    • putShort

      public void putShort(String p_128377_, short p_128378_)
    • putInt

      public void putInt(String p_128406_, int p_128407_)
    • putLong

      public void putLong(String p_128357_, long p_128358_)
    • putFloat

      public void putFloat(String p_128351_, float p_128352_)
    • putDouble

      public void putDouble(String p_128348_, double p_128349_)
    • putString

      public void putString(String p_128360_, String p_128361_)
    • putByteArray

      public void putByteArray(String p_128383_, byte[] p_128384_)
    • putIntArray

      public void putIntArray(String p_128386_, int[] p_128387_)
    • putLongArray

      public void putLongArray(String p_128389_, long[] p_128390_)
    • putBoolean

      public void putBoolean(String p_128380_, boolean p_128381_)
    • get

      @Nullable public Tag get(String p_128424_)
    • contains

      public boolean contains(String p_128442_)
    • getOptional

      private Optional<Tag> getOptional(String p_409622_)
    • getByte

      public Optional<Byte> getByte(String p_128446_)
    • getByteOr

      public byte getByteOr(String p_410151_, byte p_409929_)
    • getShort

      public Optional<Short> getShort(String p_128449_)
    • getShortOr

      public short getShortOr(String p_409927_, short p_410172_)
    • getInt

      public Optional<Integer> getInt(String p_128452_)
    • getIntOr

      public int getIntOr(String p_410742_, int p_410613_)
    • getLong

      public Optional<Long> getLong(String p_128455_)
    • getLongOr

      public long getLongOr(String p_409903_, long p_409891_)
    • getFloat

      public Optional<Float> getFloat(String p_128458_)
    • getFloatOr

      public float getFloatOr(String p_410440_, float p_410371_)
    • getDouble

      public Optional<Double> getDouble(String p_128460_)
    • getDoubleOr

      public double getDoubleOr(String p_410157_, double p_410495_)
    • getString

      public Optional<String> getString(String p_128462_)
    • getStringOr

      public String getStringOr(String p_410368_, String p_410785_)
    • getByteArray

      public Optional<byte[]> getByteArray(String p_128464_)
    • getIntArray

      public Optional<int[]> getIntArray(String p_128466_)
    • getLongArray

      public Optional<long[]> getLongArray(String p_128468_)
    • getCompound

      public Optional<CompoundTag> getCompound(String p_128470_)
    • getCompoundOrEmpty

      public CompoundTag getCompoundOrEmpty(String p_410263_)
    • getList

      public Optional<ListTag> getList(String p_128438_)
    • getListOrEmpty

      public ListTag getListOrEmpty(String p_409758_)
    • getBoolean

      public Optional<Boolean> getBoolean(String p_128472_)
    • getBooleanOr

      public boolean getBooleanOr(String p_409730_, boolean p_410716_)
    • remove

      public void remove(String p_128474_)
    • toString

      public String toString()
      Specified by:
      toString in interface Tag
      Overrides:
      toString in class Object
    • isEmpty

      public boolean isEmpty()
    • shallowCopy

      protected CompoundTag shallowCopy()
    • copy

      public CompoundTag copy()
      Specified by:
      copy in interface Tag
    • asCompound

      public Optional<CompoundTag> asCompound()
      Specified by:
      asCompound in interface Tag
    • equals

      public boolean equals(Object p_128444_)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • writeNamedTag

      private static void writeNamedTag(String p_128369_, Tag p_128370_, DataOutput p_128371_) throws IOException
      Throws:
      IOException
    • readNamedTagData

      static Tag readNamedTagData(TagType<?> p_128414_, String p_128415_, DataInput p_128416_, NbtAccounter p_128418_)
    • merge

      public CompoundTag merge(CompoundTag p_128392_)
    • accept

      public void accept(TagVisitor p_177857_)
      Specified by:
      accept in interface Tag
    • accept

      Specified by:
      accept in interface Tag
    • store

      public <T> void store(String p_401096_, com.mojang.serialization.Codec<T> p_401071_, T p_401333_)
    • storeNullable

      public <T> void storeNullable(String p_405110_, com.mojang.serialization.Codec<T> p_405799_, @Nullable T p_405604_)
    • store

      public <T> void store(String p_401002_, com.mojang.serialization.Codec<T> p_401379_, com.mojang.serialization.DynamicOps<Tag> p_401063_, T p_401119_)
    • storeNullable

      public <T> void storeNullable(String p_404778_, com.mojang.serialization.Codec<T> p_405437_, com.mojang.serialization.DynamicOps<Tag> p_405108_, @Nullable T p_405353_)
    • 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

      public <T> Optional<T> read(String p_401324_, com.mojang.serialization.Codec<T> p_401364_)
    • read

      public <T> Optional<T> read(String p_401362_, com.mojang.serialization.Codec<T> p_401434_, com.mojang.serialization.DynamicOps<Tag> p_401431_)
    • read

      public <T> Optional<T> read(com.mojang.serialization.MapCodec<T> p_401035_)
    • read

      public <T> Optional<T> read(com.mojang.serialization.MapCodec<T> p_401418_, com.mojang.serialization.DynamicOps<Tag> p_401213_)