Module syntaxnbt

Class TagCompound

java.lang.Object
at.syntaxerror.syntaxnbt.tag.Tag<Map<String,Tag<?>>>
at.syntaxerror.syntaxnbt.tag.TagCompound

public class TagCompound extends Tag<Map<String,Tag<?>>>
Effectively a list of a named tags. Order is not guaranteed.
Author:
SyntaxError404
  • Constructor Details

    • TagCompound

      public TagCompound()
      Constructs an empty compound tag
    • TagCompound

      public TagCompound(Map<String,Tag<?>> tags)
      Constructs a compound tag
      Parameters:
      tags - the map whose mappings are to be placed in this map
  • Method Details

    • has

      public boolean has(@NonNull @NonNull String key)
      Returns true if this map contains a mapping for the specified key
      Parameters:
      key - key whose presence in this map is to be tested
      Returns:
      true if this map contains a mapping for the specified key
    • get

      public Tag<?> get(@NonNull @NonNull String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • getByte

      public byte getByte(String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • getShort

      public short getShort(String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • getInt

      public int getInt(String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • getLong

      public long getLong(String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • getFloat

      public float getFloat(String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • getDouble

      public double getDouble(String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • getByteArray

      public byte[] getByteArray(String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • getIntArray

      public int[] getIntArray(String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • getLongArray

      public long[] getLongArray(String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • getString

      public String getString(String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • getByteTag

      public TagByte getByteTag(String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • getShortTag

      public TagShort getShortTag(String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • getIntTag

      public TagInt getIntTag(String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • getLongTag

      public TagLong getLongTag(String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • getFloatTag

      public TagFloat getFloatTag(String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • getDoubleTag

      public TagDouble getDoubleTag(String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • getByteArrayTag

      public TagByteArray getByteArrayTag(String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • getIntArrayTag

      public TagIntArray getIntArrayTag(String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • getLongArrayTag

      public TagLongArray getLongArrayTag(String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • getStringTag

      public TagString getStringTag(String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • getCompound

      public TagCompound getCompound(String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • getList

      public TagList<?> getList(String key)
      Returns the value to which the specified key is mapped, or throws a NBTException if this map contains no mapping for the key
      Parameters:
      key - key of the mapping to be returned
      Returns:
      the element at the specified position in this list
    • get

      public Tag<?> get(@NonNull @NonNull String key, Tag<?> defaultValue)
      Returns the value to which the specified key is mapped, or defaultValue if this map contains no mapping for the key.
      Parameters:
      key - the key whose associated value is to be returned
      defaultValue - the default mapping for the key
      Returns:
      the value to which the specified key is mapped, or defaultValue if this map contains no mapping for the key
    • put

      public TagCompound put(@NonNull @NonNull String key, @NonNull @NonNull Tag<?> value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • putByte

      public TagCompound putByte(String key, byte value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • putShort

      public TagCompound putShort(String key, short value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • putInt

      public TagCompound putInt(String key, int value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • putLong

      public TagCompound putLong(String key, long value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • putFloat

      public TagCompound putFloat(String key, float value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • putDouble

      public TagCompound putDouble(String key, double value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • putByteArray

      public TagCompound putByteArray(String key, byte[] value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • putIntArray

      public TagCompound putIntArray(String key, int[] value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • putLongArray

      public TagCompound putLongArray(String key, long[] value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • putString

      public TagCompound putString(String key, String value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • putByteTag

      public TagCompound putByteTag(String key, TagByte value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • putShortTag

      public TagCompound putShortTag(String key, TagShort value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • putIntTag

      public TagCompound putIntTag(String key, TagInt value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • putLongTag

      public TagCompound putLongTag(String key, TagLong value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • putFloatTag

      public TagCompound putFloatTag(String key, TagFloat value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • putDoubleTag

      public TagCompound putDoubleTag(String key, TagDouble value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • putByteArrayTag

      public TagCompound putByteArrayTag(String key, TagByteArray value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • putIntArrayTag

      public TagCompound putIntArrayTag(String key, TagIntArray value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • putLongArrayTag

      public TagCompound putLongArrayTag(String key, TagLongArray value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • putStringTag

      public TagCompound putStringTag(String key, TagString value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • putCompound

      public TagCompound putCompound(String key, TagCompound value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • putList

      public TagCompound putList(String key, TagList<?> value)
      Associates the specified value with the specified key in this compound tag
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      this compound tag
    • remove

      public TagCompound remove(@NonNull @NonNull String key)
      Removes the mapping for a key from this compound tag if it is present
      Parameters:
      key - key whose mapping is to be removed from the compound tag
      Returns:
      this compound tag
    • size

      public int size()
      Returns the number of key-value mappings in this compound tag
      Returns:
      the number of key-value mappings in this compound tag
    • isEmpty

      public boolean isEmpty()
      Returns true if this compound tag contains no key-value mappings.
      Returns:
      true if this compound tag contains no key-value mappings
    • keySet

      public Set<String> keySet()
      Returns a set view of the keys contained in this map
      Returns:
      a set view of the keys contained in this map
    • clear

      public TagCompound clear()
      Removes all of the mappings from this map
      Returns:
      this compound tag
    • contains

      public boolean contains(TagCompound other)
      Checks whether all mappings of the specified compound tag also exist within this compound tag and are equal.
      Parameters:
      other - compound to be checked
      Returns:
      whether this compound tag is a superset of the specified compound tag