Interface ICompoundTag
- All Known Implementing Classes:
Tag_Compound
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 Summary
Modifier and TypeMethodDescriptionAdds a byte tag with the given name and value.Adds a double-precision floating point tag.Adds a single-precision floating point tag.Adds an integer tag with the given name and value.Adds a long integer tag.Adds a short integer tag.Adds a string tag with the given name and value.byteRetrieves a byte value directly from a child tag.getCompound(String name) Retrieves a compound tag by name without casting.doubleRetrieves a double value directly from a child tag.intRetrieves an integer value directly from a child tag.Retrieves a list tag by name without casting.Retrieves a string value directly from a child tag.ITag<?> Retrieves a child tag by name without requiring casts.booleanChecks whether this compound contains a tag with the specified name.
-
Method Details
-
hasTag
Checks whether this compound contains a tag with the specified name.- Parameters:
tagName- The name to search for- Returns:
trueif a tag with this name exists,falseotherwise
-
addString
Adds a string tag with the given name and value.- Parameters:
name- The tag namevalue- TheStringvalue to store- Returns:
- This compound for fluent method chaining
-
addInt
Adds an integer tag with the given name and value.- Parameters:
name- The tag namevalue- TheIntegervalue to store- Returns:
- This compound for fluent method chaining
-
addDouble
Adds a double-precision floating point tag.- Parameters:
name- The tag namevalue- TheDoublevalue to store- Returns:
- This compound for fluent method chaining
-
addFloat
Adds a single-precision floating point tag.- Parameters:
name- The tag namevalue- TheFloatvalue to store- Returns:
- This compound for fluent method chaining
-
addByte
Adds a byte tag with the given name and value.- Parameters:
name- The tag namevalue- TheBytevalue to store- Returns:
- This compound for fluent method chaining
-
addShort
Adds a short integer tag.- Parameters:
name- The tag namevalue- TheShortvalue to store- Returns:
- This compound for fluent method chaining
-
addLong
Adds a long integer tag.- Parameters:
name- The tag namevalue- TheLongvalue to store- Returns:
- This compound for fluent method chaining
-
getTag
-
getString
-
getInt
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
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
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
Retrieves a compound tag by name without casting.- Parameters:
name- The name of the compound tag- Returns:
- The
ICompoundTagif found,nullotherwise
-
getList
-