java.lang.Object
at.syntaxerror.syntaxnbt.tag.Tag<T>
- Type Parameters:
T- type of the value stored in this tag
An NBT Tag consisting of a type and a value
- Author:
- SyntaxError404
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<N extends Tag<?>>
Ncast()Casts this tag to the requested type, if possibleprotected booleanCompares two tags for equalityboolean@NonNull TagTypegetType()Returns the type of this taggetValue()Returns the value stored in this tagbooleanTests if the type of this tag matches the type specifiedbooleanisArray()booleanTests if this tag is aTagCompoundbooleanisFloat()booleanTests if this tag is aTagNumberdenoting an integer (TagType.BYTE,TagType.SHORT,TagType.INT, orTagType.LONG)booleanisList()Tests if this tag is aTagListbooleanTests if this tag is aTagListcontaining only elements of typecomponentTypebooleanisNumber()Tests if this tag is aTagNumber(TagType.BYTE,TagType.SHORT,TagType.INT,TagType.LONG,TagType.FLOAT, orTagType.DOUBLE)booleanisString()Tests if this tag is aTagStringvoidOverrides the value stored in this tagtoString()
-
Constructor Details
-
Tag
Constructs a new tag with a type and an initial value- Parameters:
type- type of this tagvalue- initial value
-
-
Method Details
-
is
Tests if the type of this tag matches the type specified- Parameters:
type- the type to be checked- Returns:
- whether the types match
-
isCompound
public boolean isCompound()Tests if this tag is aTagCompound- Returns:
- whether this tag is a compound
-
isList
public boolean isList()Tests if this tag is aTagList- Returns:
- whether this tag is a list
- See Also:
-
isList
Tests if this tag is aTagListcontaining only elements of typecomponentType- Parameters:
componentType- expected type for list elements- Returns:
- whether this tag is a list with children of type
componentType - See Also:
-
isArray
public boolean isArray()- Returns:
- whether this tag is an array
-
isString
public boolean isString()Tests if this tag is aTagString- Returns:
- whether this tag is a string
-
isNumber
public boolean isNumber()Tests if this tag is aTagNumber(TagType.BYTE,TagType.SHORT,TagType.INT,TagType.LONG,TagType.FLOAT, orTagType.DOUBLE)- Returns:
- whether this tag is a number
-
isInteger
public boolean isInteger()Tests if this tag is aTagNumberdenoting an integer (TagType.BYTE,TagType.SHORT,TagType.INT, orTagType.LONG)- Returns:
- whether this tag is an integer
-
isFloat
public boolean isFloat()- Returns:
- whether this tag is a float
-
cast
Casts this tag to the requested type, if possible- Type Parameters:
N- the type of the tag- Returns:
- this tag
- Throws:
ClassCastException- if casting failed
-
toString
-
compare
Compares two tags for equality- Parameters:
tag- tag to compare to- Returns:
- whether the tags are equal
-
equals
-
getType
Returns the type of this tag- Returns:
- the type of this tag
-
getValue
Returns the value stored in this tag- Returns:
- the value stored in this tag
-
setValue
Overrides the value stored in this tag- Parameters:
value- value to be stored
-