Interface IListTag
- All Known Implementing Classes:
Tag_List
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 Summary
Modifier and TypeMethodDescriptionaddCompound(String name) Adds an empty compound element to this list.Adds a double-precision floating point element to this list.Adds an integer element to this list.Adds a string element to this list.intReturns the NBT type ID that all elements in this list must have.
-
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
Adds a string element to this list. Only works if this list stores string tags.- Parameters:
name- The element namevalue- TheStringvalue to store- Returns:
- This list for fluent method chaining
- Throws:
IllegalArgumentException- if this list doesn't store string tags
-
addInt
Adds an integer element to this list. Only works if this list stores integer tags.- Parameters:
name- The element namevalue- TheIntegervalue to store- Returns:
- This list for fluent method chaining
- Throws:
IllegalArgumentException- if this list doesn't store integer tags
-
addDouble
Adds a double-precision floating point element to this list. Only works if this list stores double tags.- Parameters:
name- The element namevalue- TheDoublevalue to store- Returns:
- This list for fluent method chaining
- Throws:
IllegalArgumentException- if this list doesn't store double tags
-
addCompound
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
-