public class NBTList extends Object implements List<Object>
NBTList list = new NBTList(); // ok list.getType(); // type is 0 - list is empty list.add( (int) 15 ); // ok list.getType(); // type is 3 - contains integers list.add( (float) 3.14 ); // 3.14 converted to 3 list.add("some text"); // NBTConvertException, can not convert "some text" to int
List
:set(int, Object)
and add(int, Object)
creates clone of NBT tag before set:NBTList list = new NBTList(); NBTCompound cmp = new NBTCompound(); list.add(cmp); cmp.put("foo", "bar"); NBTCompound innerCmp = list.get(0); // now innerCmp is empty, because cmp was added to the list before changes.
NBTList
can not contain empty values (null).NBTList
can not contain cross-references.Modifier and Type | Class and Description |
---|---|
class |
NBTList.NBTIterator |
class |
NBTList.NBTSubList |
Constructor and Description |
---|
NBTList()
Create a new empty NBTList
|
NBTList(Collection collection)
Convert java
Collection to NBTList. |
NBTList(Object[] array)
Convert java array to NBTList
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
Object element) |
boolean |
add(Object o)
Appends
clone of the value to the end of NBTList |
boolean |
addAll(Collection<?> c) |
boolean |
addAll(int index,
Collection<?> c) |
void |
clear() |
NBTList |
clone()
Create clone of this NBT list
|
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
boolean |
equals(Object t) |
static NBTList |
forNBT(Object tag)
Create a new instance of NBTList by NBTTagList.
|
static NBTList |
forNBTCopy(Object tag)
Create a new instance of NBTList by copy of NBTTagList.
|
Object |
get(int index) |
Object |
getHandle()
Get original NBTTagList.
|
Object |
getHandleCopy()
Get copy of original NBTTagList.
|
List<Object> |
getHandleList()
Get list stored in original NBTTagList.
|
byte |
getType()
Get byte type of original NBTTagList.
|
int |
indexOf(Object o) |
boolean |
isEmpty() |
NBTList.NBTIterator |
iterator() |
int |
lastIndexOf(Object o) |
NBTList.NBTIterator |
listIterator() |
NBTList.NBTIterator |
listIterator(int index) |
Object |
remove(int index) |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
Object |
set(int index,
Object element) |
int |
size() |
NBTList.NBTSubList |
subList(int fromIndex,
int toIndex) |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
ArrayList<Object> |
toArrayList()
Convert nbt list to
ArrayList |
<T extends Collection<Object>> |
toCollection(T collection)
Convert NBTList to java
Collection |
<T extends List<Object>> |
toList(T list)
Convert NBTList to java
List |
String |
toString() |
getClass, hashCode, notify, notifyAll, wait, wait, wait
hashCode, replaceAll, sort, spliterator
parallelStream, removeIf, stream
public NBTList(Collection collection)
Collection
to NBTList.collection
- collectionpublic NBTList(Object[] array)
array
- arraypublic NBTList()
public static NBTList forNBT(Object tag)
tag
- instance of net.minecraft.server.NBTTagCompoundpublic static NBTList forNBTCopy(Object tag)
tag
- instance of net.minecraft.server.NBTTagCompoundpublic boolean equals(Object t)
public List<Object> getHandleList()
public Object getHandle()
public Object getHandleCopy()
public byte getType()
public <T extends List<Object>> T toList(T list)
List
T
- Tlist
- empty list to fillpublic <T extends Collection<Object>> T toCollection(T collection)
Collection
T
- Tcollection
- empty collection to fillpublic NBTList clone()
public int size()
public boolean isEmpty()
public boolean contains(Object o)
public NBTList.NBTIterator iterator()
public Object[] toArray()
public <T> T[] toArray(T[] a)
public boolean add(Object o)
clone
of the value to the end of NBTListpublic boolean remove(Object o)
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<Object>
containsAll
in interface List<Object>
public boolean addAll(Collection<?> c)
public boolean addAll(int index, Collection<?> c)
public boolean removeAll(Collection<?> c)
public boolean retainAll(Collection<?> c)
public void clear()
public int lastIndexOf(Object o)
lastIndexOf
in interface List<Object>
public NBTList.NBTIterator listIterator()
listIterator
in interface List<Object>
public NBTList.NBTIterator listIterator(int index)
listIterator
in interface List<Object>
public NBTList.NBTSubList subList(int fromIndex, int toIndex)
Copyright © 2017. All rights reserved.