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> pTags)
    • CompoundTag

      public CompoundTag()
  • Method Details

    • write

      public void write(DataOutput pOutput) 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 pKey, Tag pValue)
    • putByte

      public void putByte(String pKey, byte pValue)
    • putShort

      public void putShort(String pKey, short pValue)
    • putInt

      public void putInt(String pKey, int pValue)
    • putLong

      public void putLong(String pKey, long pValue)
    • putUUID

      public void putUUID(String pKey, UUID pValue)
    • getUUID

      public UUID getUUID(String pKey)
    • hasUUID

      public boolean hasUUID(String pKey)
    • putFloat

      public void putFloat(String pKey, float pValue)
    • putDouble

      public void putDouble(String pKey, double pValue)
    • putString

      public void putString(String pKey, String pValue)
    • putByteArray

      public void putByteArray(String pKey, byte[] pValue)
    • putByteArray

      public void putByteArray(String pKey, List<Byte> pValue)
    • putIntArray

      public void putIntArray(String pKey, int[] pValue)
    • putIntArray

      public void putIntArray(String pKey, List<Integer> pValue)
    • putLongArray

      public void putLongArray(String pKey, long[] pValue)
    • putLongArray

      public void putLongArray(String pKey, List<Long> pValue)
    • putBoolean

      public void putBoolean(String pKey, boolean pValue)
    • get

      @Nullable public Tag get(String pKey)
    • getTagType

      public byte getTagType(String pKey)
      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 pKey)
    • contains

      public boolean contains(String pKey, int pTagType)
      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 pKey)
    • getShort

      public short getShort(String pKey)
    • getInt

      public int getInt(String pKey)
    • getLong

      public long getLong(String pKey)
    • getFloat

      public float getFloat(String pKey)
    • getDouble

      public double getDouble(String pKey)
    • getString

      public String getString(String pKey)
    • getByteArray

      public byte[] getByteArray(String pKey)
    • getIntArray

      public int[] getIntArray(String pKey)
    • getLongArray

      public long[] getLongArray(String pKey)
    • getCompound

      public CompoundTag getCompound(String pKey)
    • getList

      public ListTag getList(String pKey, int pTagType)
    • getBoolean

      public boolean getBoolean(String pKey)
    • remove

      public void remove(String pKey)
    • toString

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

      public boolean isEmpty()
    • createReport

      private CrashReport createReport(String pTagName, TagType<?> pType, ClassCastException pException)
    • shallowCopy

      protected CompoundTag shallowCopy()
    • copy

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

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

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

      private static void writeNamedTag(String pName, Tag pTag, DataOutput pOutput) throws IOException
      Throws:
      IOException
    • readNamedTagData

      static Tag readNamedTagData(TagType<?> pType, String pName, DataInput pInput, NbtAccounter pAccounter)
    • merge

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

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

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

      Specified by:
      accept in interface Tag