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
    • getKeys

      public Set<String> getKeys()
    • getType

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

      public TagReader<CompoundTag> getReader()
      Specified by:
      getReader in interface Tag
    • getSize

      public int getSize()
    • put

      @Nullable public Tag put​(String key, Tag tag)
    • 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)
      Writes a UUID to its NBT representation in this CompoundTag.
    • getUuid

      public UUID getUuid​(String key)
      Reads a UUID from its NBT representation in this CompoundTag.
    • containsUuid

      public boolean containsUuid​(String key)
      Returns true if this CompoundTag contains a valid UUID representation associated with the given key. A valid UUID is represented by an int array of length 4.
    • 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)
    • 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)
    • getType

      public byte getType​(String key)
    • contains

      public boolean contains​(String key)
    • contains

      public boolean contains​(String key, int type)
    • 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 type)
    • 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()
    • createCrashReport

      private CrashReport createCrashReport​(String key, TagReader<?> tagReader, ClassCastException classCastException)
    • copy

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

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

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

      private static void write​(String key, Tag tag, DataOutput output) throws IOException
      Throws:
      IOException
    • readByte

      private static byte readByte​(DataInput input, PositionTracker tracker) throws IOException
      Throws:
      IOException
    • readString

      private static String readString​(DataInput input, PositionTracker tracker) throws IOException
      Throws:
      IOException
    • read

      private static Tag read​(TagReader<?> reader, String key, DataInput input, int depth, PositionTracker tracker)
    • copyFrom

      public CompoundTag copyFrom​(CompoundTag source)
    • escapeTagKey

      protected static String escapeTagKey​(String key)
    • prettyPrintTagKey

      protected static Text prettyPrintTagKey​(String key)
    • toText

      public Text toText​(String indent, int depth)
      Specified by:
      toText in interface Tag
    • toMap

      protected Map<String,​Tag> toMap()