public final class ListTag extends Tag
TAG_List
tag.Constructor and Description |
---|
ListTag(Class<? extends Tag> type,
List<? extends Tag> value)
Creates the tag with an empty name.
|
Modifier and Type | Method and Description |
---|---|
double |
asDouble(int index)
Get a double named with the given index, even if it's another
type of number.
|
int |
asInt(int index)
Get an int named with the given index, even if it's another
type of number.
|
long |
asLong(int index)
Get a long named with the given index, even if it's another
type of number.
|
byte |
getByte(int index)
Get a byte named with the given index.
|
byte[] |
getByteArray(int index)
Get a byte array named with the given index.
|
double |
getDouble(int index)
Get a double named with the given index.
|
float |
getFloat(int index)
Get a float named with the given index.
|
Tag |
getIfExists(int index)
Get the tag if it exists at the given index.
|
int |
getInt(int index)
Get an int named with the given index.
|
int[] |
getIntArray(int index)
Get a
int[] named with the given index. |
List<Tag> |
getList(int index)
Get a list of tags named with the given index.
|
<T extends Tag> |
getList(int index,
Class<T> listType)
Get a list of tags named with the given index.
|
ListTag |
getListTag(int index)
Get a
TagList named with the given index. |
long |
getLong(int index)
Get a long named with the given index.
|
short |
getShort(int index)
Get a short named with the given index.
|
String |
getString(int index)
Get a string named with the given index.
|
Class<? extends Tag> |
getType()
Gets the type of item in this list.
|
List<Tag> |
getValue()
Gets the value of this tag.
|
ListTag |
setValue(List<Tag> list)
Create a new list tag with this tag's name and type.
|
String |
toString() |
public Class<? extends Tag> getType()
public ListTag setValue(List<Tag> list)
list
- the new listpublic Tag getIfExists(int index)
index
- the indexpublic byte[] getByteArray(int index)
If the index does not exist or its value is not a byte array tag, then an empty byte array will be returned.
index
- the indexpublic byte getByte(int index)
If the index does not exist or its value is not a byte tag,
then 0
will be returned.
index
- the indexpublic double getDouble(int index)
If the index does not exist or its value is not a double tag,
then 0
will be returned.
index
- the indexpublic double asDouble(int index)
If the index does not exist or its value is not a number,
then 0
will be returned.
index
- the indexpublic float getFloat(int index)
If the index does not exist or its value is not a float tag,
then 0
will be returned.
index
- the indexpublic int[] getIntArray(int index)
int[]
named with the given index.
If the index does not exist or its value is not an int array tag, then an empty array will be returned.
index
- the indexpublic int getInt(int index)
If the index does not exist or its value is not an int tag,
then 0
will be returned.
index
- the indexpublic int asInt(int index)
If the index does not exist or its value is not a number,
then 0
will be returned.
index
- the indexpublic List<Tag> getList(int index)
If the index does not exist or its value is not a list tag, then an empty list will be returned.
index
- the indexpublic ListTag getListTag(int index)
TagList
named with the given index.
If the index does not exist or its value is not a list tag, then an empty tag list will be returned.
index
- the indexpublic <T extends Tag> List<T> getList(int index, Class<T> listType)
If the index does not exist or its value is not a list tag, then an empty list will be returned. If the given index references a list but the list of of a different type, then an empty list will also be returned.
T
- the NBT typeindex
- the indexlistType
- the class of the contained typepublic long getLong(int index)
If the index does not exist or its value is not a long tag,
then 0
will be returned.
index
- the indexpublic long asLong(int index)
If the index does not exist or its value is not a number,
then 0
will be returned.
index
- the indexpublic short getShort(int index)
If the index does not exist or its value is not a short tag,
then 0
will be returned.
index
- the indexpublic String getString(int index)
If the index does not exist or its value is not a string tag,
then ""
will be returned.
index
- the indexCopyright © 2020. All rights reserved.