Class ItemStackList
java.lang.Object
com.refinedmods.refinedstorage.apiimpl.util.ItemStackList
- All Implemented Interfaces:
IStackList<net.minecraft.world.item.ItemStack>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionStackListResult<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
clear()
Clears the list.IStackList<net.minecraft.world.item.ItemStack>
copy()
net.minecraft.world.item.ItemStack
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
isEmpty()
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
size()
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
-
-
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 interfaceIStackList<net.minecraft.world.item.ItemStack>
- Parameters:
stack
- the stacksize
- 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 interfaceIStackList<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 interfaceIStackList<net.minecraft.world.item.ItemStack>
- Parameters:
stack
- the stacksize
- 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 interfaceIStackList<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 interfaceIStackList<net.minecraft.world.item.ItemStack>
- Parameters:
stack
- the stackflags
- 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 interfaceIStackList<net.minecraft.world.item.ItemStack>
- Parameters:
stack
- the stack to search forflags
- the flags to compare on, seeIComparer
- 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 interfaceIStackList<net.minecraft.world.item.ItemStack>
- Parameters:
stack
- the stack to search forflags
- the flags to compare on, seeIComparer
- Returns:
- the stack entry, or null if no stack entry was found
-
get
Description copied from interface:IStackList
Returns a stack.- Specified by:
get
in interfaceIStackList<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 interfaceIStackList<net.minecraft.world.item.ItemStack>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceIStackList<net.minecraft.world.item.ItemStack>
- Returns:
- true if the list is empty, false otherwise
-
getStacks
- Specified by:
getStacks
in interfaceIStackList<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 interfaceIStackList<net.minecraft.world.item.ItemStack>
- Returns:
- a collection of stacks matching the given type (ignoring NBT)
-
copy
- Specified by:
copy
in interfaceIStackList<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 interfaceIStackList<net.minecraft.world.item.ItemStack>
- Returns:
- the amount of elements in this list
-