Class TagBase
java.lang.Object
com.saicone.rtag.tag.TagBase
Class to invoke methods inside classes that extends Tag.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidClear the provided CompoundTag or ListTag.static ObjectCopy provided Tag object into new one.static byteGet current tag type ID.
Byte = 1 | Short = 2 | Int = 3 | Long = 4 | Float = 5 | Double = 6 | ByteArray = 7 | String = 8 | List = 9 | Compound = 10 | IntArray = 11 | LongArray = 12static ObjectgetValue(RtagMirror mirror, Object tag) Get Java value recursively of any Tag tag.
For example CompoundTag -> Map.static ObjectGet Java value of Tag tag.
For example StringTag -> String.static booleanCheck if the provided object is instance of Tag class.static booleanCheck if Tag object type is equals to provided type id.static booleanCheck if two Tag objects has the same type.static ObjectnewTag(RtagMirror mirror, Object object) Constructs a Tag recursively with provided object.
For example List -> ListTagstatic ObjectConstructs a Tag directly associated with Java object.
For example Float -> FloatTagstatic intGet the size of elements inside CompoundTag or ListTag.
-
Method Details
-
newTag
Constructs a Tag directly associated with Java object.
For example Float -> FloatTag- Parameters:
object- java object that can be represented as Tag.- Returns:
- a Tag associated with provided object.
- Throws:
IllegalArgumentException- if the object is not supported by this method.- See Also:
-
newTag
Constructs a Tag recursively with provided object.
For example List -> ListTag- Parameters:
mirror- RtagMirror to convert objects into tags.object- Object that can be represented as Tag.- Returns:
- a Tag associated with provided object.
- Throws:
IllegalArgumentException- if the object is not supported.
-
isTag
Check if the provided object is instance of Tag class.- Parameters:
object- the object to check.- Returns:
- true if the object is an instance of Tag class.
-
isTypeOf
Check if Tag object type is equals to provided type id.- Parameters:
tag- the Tag object to check.type- the nbt type id.- Returns:
- true if Tag type is equals.
-
isTypeOf
-
clone
-
getTypeId
Get current tag type ID.
Byte = 1 | Short = 2 | Int = 3 | Long = 4 | Float = 5 | Double = 6 | ByteArray = 7 | String = 8 | List = 9 | Compound = 10 | IntArray = 11 | LongArray = 12- Parameters:
tag- TagBase instance to get the ID.- Returns:
- An ID that represents the tag type.
-
getValue
Get Java value of Tag tag.
For example StringTag -> String.- Parameters:
tag- the Tag to extract value.- Returns:
- a java object inside Tag tag.
- Throws:
IllegalArgumentException- if tag is not supported by this class.- See Also:
-
getValue
Get Java value recursively of any Tag tag.
For example CompoundTag -> Map.- Parameters:
mirror- RtagMirror to convert objects into tags.tag- Tag to extract value.- Returns:
- a java object represented as Tag.
- Throws:
IllegalArgumentException- if tag is not supported.
-
size
Get the size of elements inside CompoundTag or ListTag.- Parameters:
tag- the Tag instance.- Returns:
- size of map or list inside.
-
clear
Clear the provided CompoundTag or ListTag.- Parameters:
tag- the Tag instance.
-