Class ListTag
TAG_List
tag.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
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.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 aint[]
named with the given index.getList
(int index) Get a list of tags named with the given index.Get a list of tags named with the given index.getListTag
(int index) Get aTagList
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.getString
(int index) Get a string named with the given index.getType()
Gets the type of item in this list.getValue()
Gets the value of this tag.Create a new list tag with this tag's name and type.toString()
-
Constructor Details
-
ListTag
Creates the tag with an empty name.- Parameters:
type
- the type of tagvalue
- the value of the tag
-
-
Method Details
-
getType
Gets the type of item in this list.- Returns:
- The type of item in this list.
-
getValue
Description copied from class:Tag
Gets the value of this tag. -
setValue
Create a new list tag with this tag's name and type.- Parameters:
list
- the new list- Returns:
- a new list tag
-
getIfExists
Get the tag if it exists at the given index.- Parameters:
index
- the index- Returns:
- the tag or null
-
getByteArray
public byte[] getByteArray(int index) Get a byte array named with the given index.If the index does not exist or its value is not a byte array tag, then an empty byte array will be returned.
- Parameters:
index
- the index- Returns:
- a byte array
-
getByte
public byte getByte(int index) Get a byte named with the given index.If the index does not exist or its value is not a byte tag, then
0
will be returned.- Parameters:
index
- the index- Returns:
- a byte
-
getDouble
public double getDouble(int index) Get a double named with the given index.If the index does not exist or its value is not a double tag, then
0
will be returned.- Parameters:
index
- the index- Returns:
- a double
-
asDouble
public double asDouble(int index) Get a double named with the given index, even if it's another type of number.If the index does not exist or its value is not a number, then
0
will be returned.- Parameters:
index
- the index- Returns:
- a double
-
getFloat
public float getFloat(int index) Get a float named with the given index.If the index does not exist or its value is not a float tag, then
0
will be returned.- Parameters:
index
- the index- Returns:
- a float
-
getIntArray
public int[] getIntArray(int index) Get aint[]
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.
- Parameters:
index
- the index- Returns:
- an int array
-
getInt
public int getInt(int index) Get an int named with the given index.If the index does not exist or its value is not an int tag, then
0
will be returned.- Parameters:
index
- the index- Returns:
- an int
-
asInt
public int asInt(int index) Get an int named with the given index, even if it's another type of number.If the index does not exist or its value is not a number, then
0
will be returned.- Parameters:
index
- the index- Returns:
- an int
-
getList
Get a list of tags named with the given index.If the index does not exist or its value is not a list tag, then an empty list will be returned.
- Parameters:
index
- the index- Returns:
- a list of tags
-
getListTag
Get aTagList
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.
- Parameters:
index
- the index- Returns:
- a tag list instance
-
getList
Get a list of tags named with the given index.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.
- Type Parameters:
T
- the NBT type- Parameters:
index
- the indexlistType
- the class of the contained type- Returns:
- a list of tags
-
getLong
public long getLong(int index) Get a long named with the given index.If the index does not exist or its value is not a long tag, then
0
will be returned.- Parameters:
index
- the index- Returns:
- a long
-
asLong
public long asLong(int index) Get a long named with the given index, even if it's another type of number.If the index does not exist or its value is not a number, then
0
will be returned.- Parameters:
index
- the index- Returns:
- a long
-
getShort
public short getShort(int index) Get a short named with the given index.If the index does not exist or its value is not a short tag, then
0
will be returned.- Parameters:
index
- the index- Returns:
- a short
-
getString
Get a string named with the given index.If the index does not exist or its value is not a string tag, then
""
will be returned.- Parameters:
index
- the index- Returns:
- a string
-
toString
-