Class CompoundTag

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

public class CompoundTag extends Object implements Tag
  • Field Details

  • Constructor Details

    • CompoundTag

      protected CompoundTag(Map<String,Tag> tags)
    • CompoundTag

      public CompoundTag()
  • Method Details

    • write

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

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

      public Set<String> getAllKeys()
    • 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 key, Tag value)
    • putByte

      public void putByte(String key, byte value)
    • putShort

      public void putShort(String key, short value)
    • putInt

      public void putInt(String key, int value)
    • putLong

      public void putLong(String key, long value)
    • putUUID

      public void putUUID(String key, UUID value)
    • getUUID

      public UUID getUUID(String key)
    • hasUUID

      public boolean hasUUID(String key)
    • putFloat

      public void putFloat(String key, float value)
    • putDouble

      public void putDouble(String key, double value)
    • putString

      public void putString(String key, String value)
    • putByteArray

      public void putByteArray(String key, byte[] value)
    • putByteArray

      public void putByteArray(String key, List<Byte> value)
    • putIntArray

      public void putIntArray(String key, int[] value)
    • putIntArray

      public void putIntArray(String key, List<Integer> value)
    • putLongArray

      public void putLongArray(String key, long[] value)
    • putLongArray

      public void putLongArray(String key, List<Long> value)
    • putBoolean

      public void putBoolean(String key, boolean value)
    • get

      @Nullable public Tag get(String key)
    • getTagType

      public byte getTagType(String key)
      Gets the byte identifier of the tag of the specified key, or 0 if no tag exists for the key.
    • contains

      public boolean contains(String key)
    • contains

      public boolean contains(String key, int tagType)
      Returns whether the tag of the specified key is a particular tagType. If the tagType is 99, all numeric tags will be checked against the type of the stored tag.
    • getByte

      public byte getByte(String key)
    • getShort

      public short getShort(String key)
    • getInt

      public int getInt(String key)
    • getLong

      public long getLong(String key)
    • getFloat

      public float getFloat(String key)
    • getDouble

      public double getDouble(String key)
    • getString

      public String getString(String key)
    • getByteArray

      public byte[] getByteArray(String key)
    • getIntArray

      public int[] getIntArray(String key)
    • getLongArray

      public long[] getLongArray(String key)
    • getCompound

      public CompoundTag getCompound(String key)
    • getList

      public ListTag getList(String key, int tagType)
    • getBoolean

      public boolean getBoolean(String key)
    • remove

      public void remove(String key)
    • toString

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

      public boolean isEmpty()
    • createReport

      private CrashReport createReport(String tagName, TagType<?> type, ClassCastException exception)
    • shallowCopy

      protected CompoundTag shallowCopy()
    • copy

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

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

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

      private static void writeNamedTag(String name, Tag tag, DataOutput output) throws IOException
      Throws:
      IOException
    • readNamedTagData

      static Tag readNamedTagData(TagType<?> type, String name, DataInput input, NbtAccounter accounter)
    • merge

      public CompoundTag merge(CompoundTag other)
      Copies all the tags of other into this tag, then returns itself.
      See Also:
    • accept

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

      protected Set<Map.Entry<String,Tag>> entrySet()
    • accept

      Specified by:
      accept in interface Tag