Package alexiil.mc.lib.attributes.item
Class SingleCopyingItemSlot
java.lang.Object
alexiil.mc.lib.attributes.item.SingleItemSlotView
alexiil.mc.lib.attributes.item.SingleItemSlot
alexiil.mc.lib.attributes.item.SingleCopyingItemSlot
- All Implemented Interfaces:
ItemExtractable
,ItemInsertable
,ItemTransferable
,LimitedConsumer<net.minecraft.item.ItemStack>
,Reference<net.minecraft.item.ItemStack>
,StackReference
-
Method Summary
Modifier and TypeMethodDescriptionfinal ListenerToken
addListener
(ItemInvSlotChangeListener listener, ListenerRemovalToken removalToken) Adds the given listener to the backing inventory, such that theItemInvSlotChangeListener.onChange(FixedItemInvView, int, ItemStack, ItemStack)
will be called every time that this inventory changes.Methods inherited from class alexiil.mc.lib.attributes.item.SingleItemSlot
attemptExtraction, attemptInsertion, forceSet, getInsertionFilter, modify, set, set
Methods inherited from class alexiil.mc.lib.attributes.item.SingleItemSlotView
get, getFilter, getIndex, getMaxAmount, isValid
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface alexiil.mc.lib.attributes.item.ItemExtractable
attemptAnyExtraction, couldExtractAnything, extract, extract, extract, getPureExtractable
Methods inherited from interface alexiil.mc.lib.attributes.item.ItemInsertable
getPureInsertable, insert, offer, offer, wouldAccept, wouldPartiallyAccept
Methods inherited from interface alexiil.mc.lib.attributes.item.ItemTransferable
filtered
Methods inherited from interface alexiil.mc.lib.attributes.misc.Reference
asDestroyable, get, isValid
-
Method Details
-
getBackingInv
- Overrides:
getBackingInv
in classSingleItemSlot
-
addListener
public final ListenerToken addListener(ItemInvSlotChangeListener listener, ListenerRemovalToken removalToken) Adds the given listener to the backing inventory, such that theItemInvSlotChangeListener.onChange(FixedItemInvView, int, ItemStack, ItemStack)
will be called every time that this inventory changes. However if this inventory doesn't support listeners then this will return a nulltoken
.- 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.
-