Interface ICollectionData
- All Superinterfaces:
IData
- All Known Implementing Classes:
ByteArrayData,IntArrayData,ListData,LongArrayData
The ICollection data is used to represent a collection of
IData like a List- DocParam:
- this new ListData(["Hello", "World"])
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.blamejared.crafttweaker.api.data.base.IData
IData.Type -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidclear()Removes every element in the listcopy()Makes a copy of this IData.Makes a copy of this IData with a copy of the internal INBT object.getAt(int index) Retrieves theIDatastored at the given index.static ICollectionDatagetFromMembers(IData... members) Creates the most specific ICollectionData form possible for the provided members.booleanisEmpty()remove(int index) Removes theIDatastored at the given index.Sets the item at the provided index to the given valueintsize()
-
Method Details
-
copy
ICollectionData copy()Description copied from interface:IDataMakes a copy of this IData. IData is immutable by default, use this to create a proper copy of the object. -
copyInternal
ICollectionData copyInternal()Description copied from interface:IDataMakes a copy of this IData with a copy of the internal INBT object.- Specified by:
copyInternalin interfaceIData- Returns:
- a copy of this IData with a copy of the internal INBT object.
-
getFromMembers
Creates the most specific ICollectionData form possible for the provided members. Tries to return (in order)ByteArrayData,IntArrayData,LongArrayDataor if neither is applicableListData -
setAt
Sets the item at the provided index to the given value- Parameters:
index- The index to set (0-based)value- The new Value- Returns:
- The replaced value
- DocParam:
- index 0, value "Bye"
-
add
- Parameters:
index- The index to add to. Subsequent items will be moved one index highervalue- The value to add to the list- DocParam:
- index 1, value "beautiful"
-
add
- Parameters:
value- The value to add to the list- DocParam:
- value "today"
-
remove
Removes theIDatastored at the given index.- Parameters:
index- The index (0-based)- Returns:
- The
IDatathat was removed - DocParam:
- index 0
-
getAt
Retrieves theIDatastored at the given index.- Parameters:
index- The index (0-based)- Returns:
- The
IData - DocParam:
- index 0
-
size
int size() -
isEmpty
boolean isEmpty() -
clear
void clear()Removes every element in the list
-