Class Tag_Compound
- All Implemented Interfaces:
ICompoundTag,ITag<ArrayList<Tag<?>>>
Represents an NBT compound tag - a named collection of heterogeneous tags
that forms the backbone of NBT data structures.
Compound tags store multiple child tags of different types, accessed by name. They provide both direct tag manipulation and fluent builder methods for common data types.
Extends Collection_Tag with compound-specific operations and
implements ICompoundTag for standardized access.
- Author:
- Paul Ferlitz
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty compound tag with default name.Tag_Compound(String name) Creates an empty compound tag with the specified name.Tag_Compound(String name, ArrayList<Tag<?>> data) Creates a compound tag pre-populated with child tags. -
Method Summary
Modifier and TypeMethodDescriptionAdds a byte tag and returns this compound for method chaining.Adds a double-precision tag and returns this compound for method chaining.Adds a single-precision float tag and returns this compound for method chaining.Adds an integer tag and returns this compound for method chaining.Adds a long integer tag and returns this compound for method chaining.Adds a short integer tag and returns this compound for method chaining.Adds a string tag and returns this compound for method chaining.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.toString()Generates a hierarchical string representation showing all nested tags.Methods inherited from class de.pauleff.core.Collection_Tag
addAllTags, addTag, getAllTags, getAllTagsByName, getTag, getTagByName, removeAllTags, removeAllTagsByName, removeTag, removeTagByNameMethods inherited from class de.pauleff.core.Tag
applyOperation, editTag, equals, getData, getId, getName, hashCode, setData, setName
-
Constructor Details
-
Tag_Compound
public Tag_Compound()Creates an empty compound tag with default name. -
Tag_Compound
Creates an empty compound tag with the specified name.- Parameters:
name- the tag name
-
Tag_Compound
-
-
Method Details
-
addString
Adds a string tag and returns this compound for method chaining.- Specified by:
addStringin interfaceICompoundTag- Parameters:
name- the tag namevalue- the string value- Returns:
- this compound tag for fluent operations
- See Also:
-
addInt
Adds an integer tag and returns this compound for method chaining.- Specified by:
addIntin interfaceICompoundTag- Parameters:
name- the tag namevalue- the integer value- Returns:
- this compound tag for fluent operations
- See Also:
-
addDouble
Adds a double-precision tag and returns this compound for method chaining.- Specified by:
addDoublein interfaceICompoundTag- Parameters:
name- the tag namevalue- the double value- Returns:
- this compound tag for fluent operations
- See Also:
-
addFloat
Adds a single-precision float tag and returns this compound for method chaining.- Specified by:
addFloatin interfaceICompoundTag- Parameters:
name- the tag namevalue- the float value- Returns:
- this compound tag for fluent operations
- See Also:
-
addByte
Adds a byte tag and returns this compound for method chaining.- Specified by:
addBytein interfaceICompoundTag- Parameters:
name- the tag namevalue- the byte value- Returns:
- this compound tag for fluent operations
- See Also:
-
addShort
Adds a short integer tag and returns this compound for method chaining.- Specified by:
addShortin interfaceICompoundTag- Parameters:
name- the tag namevalue- the short value- Returns:
- this compound tag for fluent operations
- See Also:
-
addLong
Adds a long integer tag and returns this compound for method chaining.- Specified by:
addLongin interfaceICompoundTag- Parameters:
name- the tag namevalue- the long value- Returns:
- this compound tag for fluent operations
- See Also:
-
hasTag
Description copied from interface:ICompoundTagChecks whether this compound contains a tag with the specified name.- Specified by:
hasTagin interfaceICompoundTag- Parameters:
tagName- The name to search for- Returns:
trueif a tag with this name exists,falseotherwise
-
getTag
Description copied from interface:ICompoundTagRetrieves a child tag by name without requiring casts.- Specified by:
getTagin interfaceICompoundTag- Parameters:
name- The name of the tag to find- Returns:
- The tag if found,
nullotherwise
-
getString
Description copied from interface:ICompoundTagRetrieves a string value directly from a child tag.- Specified by:
getStringin interfaceICompoundTag- Parameters:
name- The name of the string tag- Returns:
- The string value, or
nullif tag doesn't exist or isn't a string
-
getInt
Description copied from interface:ICompoundTagRetrieves an integer value directly from a child tag.- Specified by:
getIntin interfaceICompoundTag- 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
Description copied from interface:ICompoundTagRetrieves a double value directly from a child tag.- Specified by:
getDoublein interfaceICompoundTag- 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
Description copied from interface:ICompoundTagRetrieves a byte value directly from a child tag.- Specified by:
getBytein interfaceICompoundTag- 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
Description copied from interface:ICompoundTagRetrieves a compound tag by name without casting.- Specified by:
getCompoundin interfaceICompoundTag- Parameters:
name- The name of the compound tag- Returns:
- The
ICompoundTagif found,nullotherwise
-
getList
Description copied from interface:ICompoundTagRetrieves a list tag by name without casting.- Specified by:
getListin interfaceICompoundTag- Parameters:
name- The name of the list tag- Returns:
- The
IListTagif found,nullotherwise
-
toString
Generates a hierarchical string representation showing all nested tags.Output includes tag type, name, size, and recursively formatted child tags.
-