Class ItemStackList

java.lang.Object
com.refinedmods.refinedstorage.apiimpl.util.ItemStackList
All Implemented Interfaces:
IStackList<net.minecraft.world.item.ItemStack>

public class ItemStackList extends Object implements IStackList<net.minecraft.world.item.ItemStack>
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    ItemStackList(Iterable<net.minecraft.world.item.ItemStack> stacks)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    StackListResult<net.minecraft.world.item.ItemStack>
    add(net.minecraft.world.item.ItemStack stack)
    Adds a stack to the list, will merge it with another stack if it already exists in the list.
    StackListResult<net.minecraft.world.item.ItemStack>
    add(net.minecraft.world.item.ItemStack stack, int size)
    Adds a stack to the list, will merge it with another stack if it already exists in the list.
    void
    Clears the list.
    IStackList<net.minecraft.world.item.ItemStack>
     
    net.minecraft.world.item.ItemStack
    get(UUID id)
    Returns a stack.
    net.minecraft.world.item.ItemStack
    get(net.minecraft.world.item.ItemStack stack, int flags)
    Returns a stack.
    int
    getCount(net.minecraft.world.item.ItemStack stack, int flags)
    Returns the amount in this list, based on the stack and the flags.
    StackListEntry<net.minecraft.world.item.ItemStack>
    getEntry(net.minecraft.world.item.ItemStack stack, int flags)
    Returns a stack entry.
    Collection<StackListEntry<net.minecraft.world.item.ItemStack>>
     
    Collection<StackListEntry<net.minecraft.world.item.ItemStack>>
    getStacks(net.minecraft.world.item.ItemStack stack)
     
    boolean
     
    StackListResult<net.minecraft.world.item.ItemStack>
    remove(net.minecraft.world.item.ItemStack stack)
    Decrements the count of that stack in the list.
    StackListResult<net.minecraft.world.item.ItemStack>
    remove(net.minecraft.world.item.ItemStack stack, int size)
    Decrements the count of that stack in the list.
    int
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.refinedmods.refinedstorage.api.util.IStackList

    get, getCount
  • Constructor Details

    • ItemStackList

      public ItemStackList()
    • ItemStackList

      public ItemStackList(Iterable<net.minecraft.world.item.ItemStack> stacks)
  • Method Details

    • add

      public StackListResult<net.minecraft.world.item.ItemStack> add(@Nonnull net.minecraft.world.item.ItemStack stack, int size)
      Description copied from interface: IStackList
      Adds a stack to the list, will merge it with another stack if it already exists in the list.
      Specified by:
      add in interface IStackList<net.minecraft.world.item.ItemStack>
      Parameters:
      stack - the stack
      size - the size to add
      Returns:
      the result
    • add

      public StackListResult<net.minecraft.world.item.ItemStack> add(@Nonnull net.minecraft.world.item.ItemStack stack)
      Description copied from interface: IStackList
      Adds a stack to the list, will merge it with another stack if it already exists in the list.
      Specified by:
      add in interface IStackList<net.minecraft.world.item.ItemStack>
      Parameters:
      stack - the stack
      Returns:
      the result
    • remove

      public StackListResult<net.minecraft.world.item.ItemStack> remove(@Nonnull net.minecraft.world.item.ItemStack stack, int size)
      Description copied from interface: IStackList
      Decrements the count of that stack in the list.
      Specified by:
      remove in interface IStackList<net.minecraft.world.item.ItemStack>
      Parameters:
      stack - the stack
      size - the size to remove
      Returns:
      the result, or null if the stack wasn't present
    • remove

      public StackListResult<net.minecraft.world.item.ItemStack> remove(@Nonnull net.minecraft.world.item.ItemStack stack)
      Description copied from interface: IStackList
      Decrements the count of that stack in the list.
      Specified by:
      remove in interface IStackList<net.minecraft.world.item.ItemStack>
      Parameters:
      stack - the stack
      Returns:
      the result, or null if the stack wasn't present
    • getCount

      public int getCount(@Nonnull net.minecraft.world.item.ItemStack stack, int flags)
      Description copied from interface: IStackList
      Returns the amount in this list, based on the stack and the flags.
      Specified by:
      getCount in interface IStackList<net.minecraft.world.item.ItemStack>
      Parameters:
      stack - the stack
      flags - the flags
      Returns:
      the count, 0 if not found
    • get

      @Nullable public net.minecraft.world.item.ItemStack get(@Nonnull net.minecraft.world.item.ItemStack stack, int flags)
      Description copied from interface: IStackList
      Returns a stack.
      Specified by:
      get in interface IStackList<net.minecraft.world.item.ItemStack>
      Parameters:
      stack - the stack to search for
      flags - the flags to compare on, see IComparer
      Returns:
      the stack, or null if no stack was found
    • getEntry

      @Nullable public StackListEntry<net.minecraft.world.item.ItemStack> getEntry(@Nonnull net.minecraft.world.item.ItemStack stack, int flags)
      Description copied from interface: IStackList
      Returns a stack entry.
      Specified by:
      getEntry in interface IStackList<net.minecraft.world.item.ItemStack>
      Parameters:
      stack - the stack to search for
      flags - the flags to compare on, see IComparer
      Returns:
      the stack entry, or null if no stack entry was found
    • get

      @Nullable public net.minecraft.world.item.ItemStack get(UUID id)
      Description copied from interface: IStackList
      Returns a stack.
      Specified by:
      get in interface IStackList<net.minecraft.world.item.ItemStack>
      Parameters:
      id - the id of the entry to search for
      Returns:
      the stack, or null if no stack was found
    • clear

      public void clear()
      Description copied from interface: IStackList
      Clears the list.
      Specified by:
      clear in interface IStackList<net.minecraft.world.item.ItemStack>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface IStackList<net.minecraft.world.item.ItemStack>
      Returns:
      true if the list is empty, false otherwise
    • getStacks

      @Nonnull public Collection<StackListEntry<net.minecraft.world.item.ItemStack>> getStacks()
      Specified by:
      getStacks in interface IStackList<net.minecraft.world.item.ItemStack>
      Returns:
      a collection of stacks in this list
    • getStacks

      @Nonnull public Collection<StackListEntry<net.minecraft.world.item.ItemStack>> getStacks(@Nonnull net.minecraft.world.item.ItemStack stack)
      Specified by:
      getStacks in interface IStackList<net.minecraft.world.item.ItemStack>
      Returns:
      a collection of stacks matching the given type (ignoring NBT)
    • copy

      @Nonnull public IStackList<net.minecraft.world.item.ItemStack> copy()
      Specified by:
      copy in interface IStackList<net.minecraft.world.item.ItemStack>
      Returns:
      a new copy of this list, with the stacks in it copied as well
    • size

      public int size()
      Specified by:
      size in interface IStackList<net.minecraft.world.item.ItemStack>
      Returns:
      the amount of elements in this list