Class CompoundTag
TAG_Compound
tag.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
Get a double named with the given key, even if it's another type of number.int
Get an int named with the given key, even if it's another type of number.long
Get a long named with the given key, even if it's another type of number.boolean
containsKey
(String key) Returns whether this compound tag contains the given key.Create a compound tag builder.byte
Get a byte named with the given key.byte[]
getByteArray
(String key) Get a byte array named with the given key.double
Get a double named with the given key.float
Get a float named with the given key.int
Get an int named with the given key.int[]
getIntArray
(String key) Get aint[]
named with the given key.Get a list of tags named with the given key.Get a list of tags named with the given key.getListTag
(String key) Get aTagList
named with the given key.long
Get a long named with the given key.long[]
getLongArray
(String key) Get along[]
named with the given key.short
Get a short named with the given key.Get a string named with the given key.getValue()
Gets the value of this tag.Return a new compound tag with the given values.toString()
-
Constructor Details
-
CompoundTag
Creates the tag with an empty name.- Parameters:
value
- the value of the tag
-
-
Method Details
-
containsKey
Returns whether this compound tag contains the given key.- Parameters:
key
- the given key- Returns:
- true if the tag contains the given key
-
getValue
Description copied from class:Tag
Gets the value of this tag. -
setValue
Return a new compound tag with the given values.- Parameters:
value
- the value- Returns:
- the new compound tag
-
createBuilder
Create a compound tag builder.- Returns:
- the builder
-
getByteArray
Get a byte array named with the given key.If the key does not exist or its value is not a byte array tag, then an empty byte array will be returned.
- Parameters:
key
- the key- Returns:
- a byte array
-
getByte
Get a byte named with the given key.If the key does not exist or its value is not a byte tag, then
0
will be returned.- Parameters:
key
- the key- Returns:
- a byte
-
getDouble
Get a double named with the given key.If the key does not exist or its value is not a double tag, then
0
will be returned.- Parameters:
key
- the key- Returns:
- a double
-
asDouble
Get a double named with the given key, even if it's another type of number.If the key does not exist or its value is not a number, then
0
will be returned.- Parameters:
key
- the key- Returns:
- a double
-
getFloat
Get a float named with the given key.If the key does not exist or its value is not a float tag, then
0
will be returned.- Parameters:
key
- the key- Returns:
- a float
-
getIntArray
Get aint[]
named with the given key.If the key does not exist or its value is not an int array tag, then an empty array will be returned.
- Parameters:
key
- the key- Returns:
- an int array
-
getInt
Get an int named with the given key.If the key does not exist or its value is not an int tag, then
0
will be returned.- Parameters:
key
- the key- Returns:
- an int
-
asInt
Get an int named with the given key, even if it's another type of number.If the key does not exist or its value is not a number, then
0
will be returned.- Parameters:
key
- the key- Returns:
- an int
-
getList
Get a list of tags named with the given key.If the key does not exist or its value is not a list tag, then an empty list will be returned.
- Parameters:
key
- the key- Returns:
- a list of tags
-
getListTag
Get aTagList
named with the given key.If the key does not exist or its value is not a list tag, then an empty tag list will be returned.
- Parameters:
key
- the key- Returns:
- a tag list instance
-
getList
Get a list of tags named with the given key.If the key does not exist or its value is not a list tag, then an empty list will be returned. If the given key references a list but the list of of a different type, then an empty list will also be returned.
- Type Parameters:
T
- the type of list- Parameters:
key
- the keylistType
- the class of the contained type- Returns:
- a list of tags
-
getLongArray
Get along[]
named with the given key.If the key does not exist or its value is not an long array tag, then an empty array will be returned.
- Parameters:
key
- the key- Returns:
- an int array
-
getLong
Get a long named with the given key.If the key does not exist or its value is not a long tag, then
0
will be returned.- Parameters:
key
- the key- Returns:
- a long
-
asLong
Get a long named with the given key, even if it's another type of number.If the key does not exist or its value is not a number, then
0
will be returned.- Parameters:
key
- the key- Returns:
- a long
-
getShort
Get a short named with the given key.If the key does not exist or its value is not a short tag, then
0
will be returned.- Parameters:
key
- the key- Returns:
- a short
-
getString
Get a string named with the given key.If the key does not exist or its value is not a string tag, then
""
will be returned.- Parameters:
key
- the key- Returns:
- a string
-
toString
-