Interface ICompoundTag

All Superinterfaces:
ITag<ArrayList<Tag<?>>>
All Known Implementing Classes:
Tag_Compound

public interface ICompoundTag extends ITag<ArrayList<Tag<?>>>
Interface for NBT compound tags - the workhorse of NBT data structures. Compounds function like dictionaries or maps, storing named child tags in key-value pairs. They're essential for organizing complex data like player inventories, world chunks, and entity properties.
Author:
Paul Ferlitz
See Also:
  • Method Details

    • hasTag

      boolean hasTag(String tagName)
      Checks whether this compound contains a tag with the specified name.
      Parameters:
      tagName - The name to search for
      Returns:
      true if a tag with this name exists, false otherwise
    • addString

      ICompoundTag addString(String name, String value)
      Adds a string tag with the given name and value.
      Parameters:
      name - The tag name
      value - The String value to store
      Returns:
      This compound for fluent method chaining
    • addInt

      ICompoundTag addInt(String name, int value)
      Adds an integer tag with the given name and value.
      Parameters:
      name - The tag name
      value - The Integer value to store
      Returns:
      This compound for fluent method chaining
    • addDouble

      ICompoundTag addDouble(String name, double value)
      Adds a double-precision floating point tag.
      Parameters:
      name - The tag name
      value - The Double value to store
      Returns:
      This compound for fluent method chaining
    • addFloat

      ICompoundTag addFloat(String name, float value)
      Adds a single-precision floating point tag.
      Parameters:
      name - The tag name
      value - The Float value to store
      Returns:
      This compound for fluent method chaining
    • addByte

      ICompoundTag addByte(String name, byte value)
      Adds a byte tag with the given name and value.
      Parameters:
      name - The tag name
      value - The Byte value to store
      Returns:
      This compound for fluent method chaining
    • addShort

      ICompoundTag addShort(String name, short value)
      Adds a short integer tag.
      Parameters:
      name - The tag name
      value - The Short value to store
      Returns:
      This compound for fluent method chaining
    • addLong

      ICompoundTag addLong(String name, long value)
      Adds a long integer tag.
      Parameters:
      name - The tag name
      value - The Long value to store
      Returns:
      This compound for fluent method chaining
    • getTag

      ITag<?> getTag(String name)
      Retrieves a child tag by name without requiring casts.
      Parameters:
      name - The name of the tag to find
      Returns:
      The tag if found, null otherwise
    • getString

      String getString(String name)
      Retrieves a string value directly from a child tag.
      Parameters:
      name - The name of the string tag
      Returns:
      The string value, or null if tag doesn't exist or isn't a string
    • getInt

      int getInt(String name)
      Retrieves an integer value directly from a child tag.
      Parameters:
      name - The name of the integer tag
      Returns:
      The integer value, or 0 if tag doesn't exist or isn't an integer
    • getDouble

      double getDouble(String name)
      Retrieves a double value directly from a child tag.
      Parameters:
      name - The name of the double tag
      Returns:
      The double value, or 0.0 if tag doesn't exist or isn't a double
    • getByte

      byte getByte(String name)
      Retrieves a byte value directly from a child tag.
      Parameters:
      name - The name of the byte tag
      Returns:
      The byte value, or 0 if tag doesn't exist or isn't a byte
    • getCompound

      ICompoundTag getCompound(String name)
      Retrieves a compound tag by name without casting.
      Parameters:
      name - The name of the compound tag
      Returns:
      The ICompoundTag if found, null otherwise
    • getList

      IListTag getList(String name)
      Retrieves a list tag by name without casting.
      Parameters:
      name - The name of the list tag
      Returns:
      The IListTag if found, null otherwise