- Type Parameters:
T- type of the elements stored in this tag
- All Implemented Interfaces:
Iterable<T>
A list of nameless tags, all of the same type. The list is prefixed with the
Type ID of the items it contains
(thus 1 byte), and the length of the list as a signed integer (a further 4 bytes). If the length of the list is 0 or negative,
the type may be 0 (TAG_End) but otherwise it must be any other type. (The notchian implementation uses TAG_End in that situation,
but another reference implementation by Mojang uses 1 instead; parsers should accept any type if the length is <= 0).- Author:
- SyntaxError404
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionInserts an element at the specified position in the listAdd an element to the listaddByte(byte value) Add an element to the listaddByte(int index, byte value) Inserts an element at the specified position in the listaddByteArray(byte[] value) Add an element to the listaddByteArray(int index, byte[] value) Inserts an element at the specified position in the listaddByteArrayTag(int index, TagByteArray value) Inserts an element at the specified position in the listaddByteArrayTag(TagByteArray value) Add an element to the listaddByteTag(int index, TagByte value) Inserts an element at the specified position in the listaddByteTag(TagByte value) Add an element to the listaddCompound(int index, TagCompound value) Inserts an element at the specified position in the listaddCompound(TagCompound value) Add an element to the listaddDouble(double value) Add an element to the listaddDouble(int index, double value) Inserts an element at the specified position in the listaddDoubleTag(int index, TagDouble value) Inserts an element at the specified position in the listaddDoubleTag(TagDouble value) Add an element to the listaddFloat(float value) Add an element to the listaddFloat(int index, float value) Inserts an element at the specified position in the listaddFloatTag(int index, TagFloat value) Inserts an element at the specified position in the listaddFloatTag(TagFloat value) Add an element to the listaddInt(int value) Add an element to the listaddInt(int index, int value) Inserts an element at the specified position in the listaddIntArray(int[] value) Add an element to the listaddIntArray(int index, int[] value) Inserts an element at the specified position in the listaddIntArrayTag(int index, TagIntArray value) Inserts an element at the specified position in the listaddIntArrayTag(TagIntArray value) Add an element to the listInserts an element at the specified position in the listAdd an element to the listInserts an element at the specified position in the listAdd an element to the listaddLong(int index, long value) Inserts an element at the specified position in the listaddLong(long value) Add an element to the listaddLongArray(int index, long[] value) Inserts an element at the specified position in the listaddLongArray(long[] value) Add an element to the listaddLongArrayTag(int index, TagLongArray value) Inserts an element at the specified position in the listaddLongArrayTag(TagLongArray value) Add an element to the listaddLongTag(int index, TagLong value) Inserts an element at the specified position in the listaddLongTag(TagLong value) Add an element to the listaddShort(int index, short value) Inserts an element at the specified position in the listaddShort(short value) Add an element to the listaddShortTag(int index, TagShort value) Inserts an element at the specified position in the listaddShortTag(TagShort value) Add an element to the listInserts an element at the specified position in the listAdd an element to the listaddStringTag(int index, TagString value) Inserts an element at the specified position in the listaddStringTag(TagString value) Add an element to the listReturns this list, casted to a list of byte arraysReturns this list, casted to a list of bytesReturns this list, casted to a list of compoundsReturns this list, casted to a list of doublesReturns this list, casted to a list of floatsReturns this list, casted to a list of int arraysReturns this list, casted to a list of intsReturns this list, casted to a list of listsasListList(Class<X> componentType) Returns this list, casted to a list of lists, where each list should only contain elements of typecomponentTypeReturns this list, casted to a list of long arraysReturns this list, casted to a list of longsReturns this list, casted to a list of shortsReturns this list, casted to a list of stringsclear()Removes all of the elements from this listConstructs an empty list without a specified type.get(int index) Returns the element at the specified position in this listbytegetByte(int index) Returns the element at the specified position in this listbyte[]getByteArray(int index) Returns the element at the specified position in this listgetByteArrayTag(int index) Returns the element at the specified position in this listgetByteTag(int index) Returns the element at the specified position in this listReturns the type of elements in this list.getCompound(int index) Returns the element at the specified position in this listdoublegetDouble(int index) Returns the element at the specified position in this listgetDoubleTag(int index) Returns the element at the specified position in this listfloatgetFloat(int index) Returns the element at the specified position in this listgetFloatTag(int index) Returns the element at the specified position in this listintgetInt(int index) Returns the element at the specified position in this listint[]getIntArray(int index) Returns the element at the specified position in this listgetIntArrayTag(int index) Returns the element at the specified position in this listgetIntTag(int index) Returns the element at the specified position in this listTagList<?>getList(int index) Returns the element at the specified position in this listlonggetLong(int index) Returns the element at the specified position in this listlong[]getLongArray(int index) Returns the element at the specified position in this listgetLongArrayTag(int index) Returns the element at the specified position in this listgetLongTag(int index) Returns the element at the specified position in this listshortgetShort(int index) Returns the element at the specified position in this listgetShortTag(int index) Returns the element at the specified position in this listgetString(int index) Returns the element at the specified position in this listgetStringTag(int index) Returns the element at the specified position in this listbooleanisEmpty()Returnstrueif this list contains no elements.iterator()remove(int index) Removes the element at the specified position in this listReplaces an element at the specified position in the listsetByte(int index, byte value) Replaces an element at the specified position in the listsetByteArray(int index, byte[] value) Replaces an element at the specified position in the listsetByteArrayTag(int index, TagByteArray value) Replaces an element at the specified position in the listsetByteTag(int index, TagByte value) Replaces an element at the specified position in the listsetCompound(int index, TagCompound value) Replaces an element at the specified position in the listsetDouble(int index, double value) Replaces an element at the specified position in the listsetDoubleTag(int index, TagDouble value) Replaces an element at the specified position in the listsetFloat(int index, float value) Replaces an element at the specified position in the listsetFloatTag(int index, TagFloat value) Replaces an element at the specified position in the listsetInt(int index, int value) Replaces an element at the specified position in the listsetIntArray(int index, int[] value) Replaces an element at the specified position in the listsetIntArrayTag(int index, TagIntArray value) Replaces an element at the specified position in the listReplaces an element at the specified position in the listReplaces an element at the specified position in the listsetLong(int index, long value) Replaces an element at the specified position in the listsetLongArray(int index, long[] value) Replaces an element at the specified position in the listsetLongArrayTag(int index, TagLongArray value) Replaces an element at the specified position in the listsetLongTag(int index, TagLong value) Replaces an element at the specified position in the listsetShort(int index, short value) Replaces an element at the specified position in the listsetShortTag(int index, TagShort value) Replaces an element at the specified position in the listReplaces an element at the specified position in the listsetStringTag(int index, TagString value) Replaces an element at the specified position in the listintsize()Returns the number of elements in this listMethods inherited from class at.syntaxerror.syntaxnbt.tag.Tag
cast, compare, equals, getType, getValue, is, isArray, isCompound, isFloat, isInteger, isList, isList, isNumber, isString, setValue, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
TagList
Constructs an empty list of the specified type- Parameters:
typeClass- type of elements in this list
-
TagList
Constructs a list of the specified type- Parameters:
typeClass- type of elements in this listelements- the collection whose elements are to be placed into this list
-
-
Method Details
-
emptyList
Constructs an empty list without a specified type. The type is determined when an element is added or the list is casted to a specific type.- Returns:
- the empty list
-
get
Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
getByte
public byte getByte(int index) Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
getShort
public short getShort(int index) Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
getInt
public int getInt(int index) Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
getLong
public long getLong(int index) Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
getFloat
public float getFloat(int index) Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
getDouble
public double getDouble(int index) Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
getByteArray
public byte[] getByteArray(int index) Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
getIntArray
public int[] getIntArray(int index) Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
getLongArray
public long[] getLongArray(int index) Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
getString
Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
getByteTag
Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
getShortTag
Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
getIntTag
Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
getLongTag
Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
getFloatTag
Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
getDoubleTag
Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
getByteArrayTag
Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
getIntArrayTag
Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
getLongArrayTag
Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
getStringTag
Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
getCompound
Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
getList
Returns the element at the specified position in this list- Parameters:
index- index of the element to be returned- Returns:
- the element at the specified position in this list
-
add
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
addByte
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
addShort
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
addInt
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
addLong
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
addFloat
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
addDouble
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
addByteArray
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
addIntArray
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
addLongArray
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
addString
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
addByteTag
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
addShortTag
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
addIntTag
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
addLongTag
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
addFloatTag
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
addDoubleTag
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
addByteArrayTag
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
addIntArrayTag
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
addLongArrayTag
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
addStringTag
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
addCompound
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
addList
Add an element to the list- Parameters:
value- element to be added- Returns:
- this list
-
add
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
addByte
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
addShort
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
addInt
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
addLong
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
addFloat
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
addDouble
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
addByteArray
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
addIntArray
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
addLongArray
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
addString
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
addByteTag
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
addShortTag
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
addIntTag
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
addLongTag
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
addFloatTag
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
addDoubleTag
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
addByteArrayTag
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
addIntArrayTag
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
addLongArrayTag
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
addStringTag
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
addCompound
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
addList
Inserts an element at the specified position in the list- Parameters:
index- index at which the specified element is to be insertedvalue- element to be inserted- Returns:
- this list
-
set
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
setByte
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
setShort
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
setInt
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
setLong
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
setFloat
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
setDouble
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
setByteArray
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
setIntArray
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
setLongArray
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
setString
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
setByteTag
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
setShortTag
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
setIntTag
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
setLongTag
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
setFloatTag
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
setDoubleTag
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
setByteArrayTag
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
setIntArrayTag
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
setLongArrayTag
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
setStringTag
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
setCompound
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
setList
Replaces an element at the specified position in the list- Parameters:
index- index of the element to replacevalue- element to be stored at the specified position- Returns:
- this list
-
remove
Removes the element at the specified position in this list- Parameters:
index- index of the element to be removed- Returns:
- this list
-
clear
Removes all of the elements from this list- Returns:
- this list
-
size
public int size()Returns the number of elements in this list- Returns:
- the number of elements in this list
-
isEmpty
public boolean isEmpty()Returnstrueif this list contains no elements.- Returns:
trueif this list contains no elements
-
asByteList
Returns this list, casted to a list of bytes- Returns:
- this list
-
asShortList
Returns this list, casted to a list of shorts- Returns:
- this list
-
asIntList
Returns this list, casted to a list of ints- Returns:
- this list
-
asLongList
Returns this list, casted to a list of longs- Returns:
- this list
-
asFloatList
Returns this list, casted to a list of floats- Returns:
- this list
-
asDoubleList
Returns this list, casted to a list of doubles- Returns:
- this list
-
asByteArrayList
Returns this list, casted to a list of byte arrays- Returns:
- this list
-
asIntArrayList
Returns this list, casted to a list of int arrays- Returns:
- this list
-
asLongArrayList
Returns this list, casted to a list of long arrays- Returns:
- this list
-
asStringList
Returns this list, casted to a list of strings- Returns:
- this list
-
asCompoundList
Returns this list, casted to a list of compounds- Returns:
- this list
-
asListList
Returns this list, casted to a list of lists- Returns:
- this list
-
asListList
Returns this list, casted to a list of lists, where each list should only contain elements of typecomponentType- Type Parameters:
X- type of the elements of the lists- Parameters:
componentType- class of the type of the elements of the lists- Returns:
- this list
-
iterator
-
getComponentType
Returns the type of elements in this list. May benullif the list was created viaemptyList()- Returns:
- the type of elements in this list
-