Package alexiil.mc.lib.attributes.item
Interface GroupedItemInvView
- All Superinterfaces:
- AbstractItemInvView
- All Known Subinterfaces:
- GroupedItemInv,- LimitedGroupedItemInv
- All Known Implementing Classes:
- CombinedGroupedItemInv,- CombinedGroupedItemInvView,- DelegatingGroupedItemInv,- DirectFixedItemInv,- EmptyGroupedItemInv,- GroupedItemInvFixedWrapper,- GroupedItemInvViewFixedWrapper,- SimpleGroupedItemInv,- SimpleLimitedGroupedItemInv
An alternative way of storing large numbers of 
ItemStack, without using large numbers of slots in a
 FixedItemInvView. Instead of storing items in a List<ItemStack> this works more like a
 Map<ItemStack, int amount>.- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic classStatistics associated with a singleItemFilterin a given inventory.Nested classes/interfaces inherited from interface alexiil.mc.lib.attributes.item.AbstractItemInvViewAbstractItemInvView.DefaultChangeTracker
- 
Method SummaryModifier and TypeMethodDescriptiondefault ListenerTokenaddListener(InvMarkDirtyListener listener, ListenerRemovalToken removalToken)Adds the given listener to this inventory, such thatInvMarkDirtyListener.onMarkDirty(AbstractItemInvView)will be called every time that any stored stack is changed (either fromFixedItemInv.setInvStack(int, ItemStack, Simulation)orFixedItemInv.ModifiableFixedItemInv.markDirty()).default ListenerTokenaddListener(ItemInvAmountChangeListener listener, ListenerRemovalToken removalToken)Adds the given listener to this inventory, such that theItemInvAmountChangeListener.onChange(GroupedItemInvView, ItemStack, int, int)will be called every time that this inventory changes.default intgetAmount(ItemFilter filter)default intgetAmount(net.minecraft.item.ItemStack stack)default intgetCapacity(net.minecraft.item.ItemStack stack)default GroupedItemInvViewdefault intgetSpace(net.minecraft.item.ItemStack stack)getStatistics(ItemFilter filter)getStatistics(net.minecraft.item.ItemStack stack)Set<net.minecraft.item.ItemStack>intdefault booleanisEmpty()Methods inherited from interface alexiil.mc.lib.attributes.item.AbstractItemInvViewgetChangeValue
- 
Method Details- 
getStoredStacksSet<net.minecraft.item.ItemStack> getStoredStacks()- Returns:
- a set containing all of the ItemStack's that are stored in the inventory. NOTE: This must return a set using one of theHash.Strategy's inItemStackCollectionsotherwise comparison methods won't work correctly!
 
- 
getAmountdefault int getAmount(net.minecraft.item.ItemStack stack)- Parameters:
- stack- The stack to check for. Cannot be- empty.
- Returns:
- The total amount of the given stack that is stored in this inventory.
 
- 
getCapacitydefault int getCapacity(net.minecraft.item.ItemStack stack)- Parameters:
- stack- The stack to check for. Must not be- empty.
- Returns:
- The total space that is available (right now!) to store the given stack.
 
- 
getTotalCapacityint getTotalCapacity()- Returns:
- The total capacity for every ItemStackthat can be stored in this inventory.NOTE: This value might not be equal to the sum of getCapacity(ItemStack)overgetStoredStacks()!
 
- 
getSpacedefault int getSpace(net.minecraft.item.ItemStack stack)- Returns:
- The total space that could store the given stack, not including space that is currently taken up by the
         stack (so this should change with getAmount(ItemFilter)).
 
- 
getStatistics- Parameters:
- filter- The filter to check on.
- Returns:
- Statistics about the currently stored amount, capacity, and space for everything that matches the given filter.
 
- 
getStatistics- Parameters:
- stack- The- ItemStackto check for.
- Returns:
- Statistics about the currently stored amount, capacity, and space for everything that matches the given item stack.
 
- 
getAmount- Returns:
- A count of all the ItemStack's that match the given filter.
 
- 
isEmptydefault boolean isEmpty()- Returns:
- True if getAmount(ConstantItemFilter.ANYTHING) returns a value greater than 0.
 
- 
addListenerdefault ListenerToken addListener(InvMarkDirtyListener listener, ListenerRemovalToken removalToken)Description copied from interface:AbstractItemInvViewAdds the given listener to this inventory, such thatInvMarkDirtyListener.onMarkDirty(AbstractItemInvView)will be called every time that any stored stack is changed (either fromFixedItemInv.setInvStack(int, ItemStack, Simulation)orFixedItemInv.ModifiableFixedItemInv.markDirty()).If the listener is registered (and thus this returns null) then it implies that AbstractItemInvView.getChangeValue()will change every time that the given listener is invoked, always just-before it is invoked.The default implementation refuses to accept any listeners, but implementations are highly encouraged to override this if they are able to! - Specified by:
- addListenerin interface- AbstractItemInvView
- removalToken- A token that will be called whenever the given listener is removed from this inventory (or if this inventory itself is unloaded or otherwise invalidated).
- Returns:
- A token that represents the listener, or null if the listener could not be added.
 
- 
addListenerdefault ListenerToken addListener(ItemInvAmountChangeListener listener, ListenerRemovalToken removalToken)Adds the given listener to this inventory, such that theItemInvAmountChangeListener.onChange(GroupedItemInvView, ItemStack, int, int)will be called every time that this inventory changes. However if this inventory doesn't support listeners then this will return a nulltoken.The default implementation refuses to accept any listeners, but implementations are highly encouraged to override this if they are able to! - Parameters:
- removalToken- A token that will be called whenever the given listener is removed from this inventory (or if this inventory itself is unloaded or otherwise invalidated).
- Returns:
- A token that represents the listener, or null if the listener could not be added.
 
- 
getGroupedView- Returns:
- A completely unmodifiable view of this GroupedItemInvView.
 
 
-