TType - - the value type of each NBT tag.public interface NbtList<TType> extends NbtBase<List<NbtBase<TType>>>, Iterable<TType>
Use NbtFactory to load or create an instance.
The NbtBase.getValue() method returns a List that will correctly return the content
of this NBT list, but may throw an UnsupportedOperationException for any of the write operations.
| Modifier and Type | Field and Description |
|---|---|
static String |
EMPTY_NAME
The name of every NBT tag in a list.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(byte value)
Add a new byte element to the list.
|
void |
add(byte[] value)
Add a new byte array element to the list.
|
void |
add(double value)
Add a new double element to the list.
|
void |
add(int value)
Add a new integer element to the list.
|
void |
add(int[] value)
Add a new int array element to the list.
|
void |
add(long value)
Add a new long element to the list.
|
void |
add(NbtBase<TType> element)
Add a NBT list or NBT compound to the list.
|
void |
add(short value)
Add a new short element to the list.
|
void |
add(String value)
Add a new string element to the list.
|
void |
addClosest(Object value)
Add a value to a typed list by attempting to convert it to the nearest value.
|
Collection<NbtBase<TType>> |
asCollection()
Retrieve each NBT tag in this list.
|
NbtType |
getElementType()
Get the type of each element.
|
TType |
getValue(int index)
Retrieve an element by index.
|
Iterator<TType> |
iterator()
Iterate over all the elements in this list.
|
void |
remove(Object remove)
Remove a given object from the list.
|
void |
setElementType(NbtType type)
Set the type of each element.
|
int |
size()
Retrieve the number of elements in this list.
|
accept, deepClone, getName, getType, getValue, setName, setValueforEach, spliteratorstatic final String EMPTY_NAME
NbtType getElementType()
This will be TAG_END if the NBT list has just been created.
void setElementType(NbtType type)
type - - type of each element.void addClosest(Object value)
Note that the list must be typed by setting setElementType(NbtType) before calling this function.
value - - the value to add.void add(NbtBase<TType> element)
element - Element to addvoid add(String value)
value - - the string element to add.IllegalArgumentException - If this is not a list of strings.void add(byte value)
value - - the byte element to add.IllegalArgumentException - If this is not a list of bytes.void add(short value)
value - - the short element to add.IllegalArgumentException - If this is not a list of shorts.void add(int value)
value - - the string element to add.IllegalArgumentException - If this is not a list of integers.void add(long value)
value - - the string element to add.IllegalArgumentException - If this is not a list of longs.void add(double value)
value - - the double element to add.IllegalArgumentException - If this is not a list of doubles.void add(byte[] value)
value - - the byte array element to add.IllegalArgumentException - If this is not a list of byte arrays.void add(int[] value)
value - - the int array element to add.IllegalArgumentException - If this is not a list of int arrays.void remove(Object remove)
remove - - the object to remove.TType getValue(int index)
index - - index of the element to retrieve.IndexOutOfBoundsException - If the index is out of rangeint size()
Collection<NbtBase<TType>> asCollection()
Copyright © 2012–2017 Comphenix and dmulloy2. Licensed under the GNU GPL v2.