Interface IListTag

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

public interface IListTag extends ITag<ArrayList<Tag<?>>>
Interface for NBT list tags - ordered collections of same-type elements. Lists enforce type homogeneity, meaning all elements must be of the same NBT type. They're perfect for storing arrays of data like inventory items, coordinates, or any sequential information.
Author:
Paul Ferlitz
See Also:
  • Method Details

    • getListTypeID

      int getListTypeID()
      Returns the NBT type ID that all elements in this list must have. Once set, this cannot be changed and all added elements must match this type.
      Returns:
      The required element type ID (0-12)
    • addString

      IListTag addString(String name, String value)
      Adds a string element to this list. Only works if this list stores string tags.
      Parameters:
      name - The element name
      value - The String value to store
      Returns:
      This list for fluent method chaining
      Throws:
      IllegalArgumentException - if this list doesn't store string tags
    • addInt

      IListTag addInt(String name, int value)
      Adds an integer element to this list. Only works if this list stores integer tags.
      Parameters:
      name - The element name
      value - The Integer value to store
      Returns:
      This list for fluent method chaining
      Throws:
      IllegalArgumentException - if this list doesn't store integer tags
    • addDouble

      IListTag addDouble(String name, double value)
      Adds a double-precision floating point element to this list. Only works if this list stores double tags.
      Parameters:
      name - The element name
      value - The Double value to store
      Returns:
      This list for fluent method chaining
      Throws:
      IllegalArgumentException - if this list doesn't store double tags
    • addCompound

      IListTag addCompound(String name)
      Adds an empty compound element to this list. Only works if this list stores compound tags.
      Parameters:
      name - The element name
      Returns:
      This list for fluent method chaining
      Throws:
      IllegalArgumentException - if this list doesn't store compound tags