Interface ICollectionData

All Superinterfaces:
IData
All Known Implementing Classes:
ByteArrayData, IntArrayData, ListData, LongArrayData

@ZenRegister(loaders={"crafttweaker","tags"}) public interface ICollectionData extends IData
The ICollection data is used to represent a collection of IData like a List
DocParam:
this new ListData(["Hello", "World"])
  • Method Details

    • copy

      Description copied from interface: IData
      Makes a copy of this IData. IData is immutable by default, use this to create a proper copy of the object.
      Specified by:
      copy in interface IData
      Returns:
      a copy of this IData.
    • copyInternal

      ICollectionData copyInternal()
      Description copied from interface: IData
      Makes a copy of this IData with a copy of the internal INBT object.
      Specified by:
      copyInternal in interface IData
      Returns:
      a copy of this IData with a copy of the internal INBT object.
    • getFromMembers

      static ICollectionData getFromMembers(IData... members)
      Creates the most specific ICollectionData form possible for the provided members. Tries to return (in order) ByteArrayData, IntArrayData, LongArrayData or if neither is applicable ListData
    • setAt

      IData setAt(int index, IData value)
      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

      void add(int index, IData value)
      Parameters:
      index - The index to add to. Subsequent items will be moved one index higher
      value - The value to add to the list
      DocParam:
      index 1, value "beautiful"
    • add

      void add(IData value)
      Parameters:
      value - The value to add to the list
      DocParam:
      value "today"
    • remove

      IData remove(int index)
      Removes the IData stored at the given index.
      Parameters:
      index - The index (0-based)
      Returns:
      The IData that was removed
      DocParam:
      index 0
    • getAt

      IData getAt(int index)
      Retrieves the IData stored 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