Class CombinedFixedItemInvView<InvType extends FixedItemInvView>
- All Implemented Interfaces:
- Convertible,- AbstractItemInvView,- FixedItemInvView,- Combined
- Direct Known Subclasses:
- CombinedFixedItemInv
FixedItemInvView that delegates to a list of them instead of storing items directly.- 
Nested Class SummaryNested classes/interfaces inherited from interface alexiil.mc.lib.attributes.item.AbstractItemInvViewAbstractItemInvView.DefaultChangeTracker
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected intprotected int[]Fields inherited from class alexiil.mc.lib.attributes.misc.AbstractCombinedlist
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionaddListener(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()).static FixedItemInvViewcreateView(List<? extends FixedItemInvView> list)intgetFilterForSlot(int slot)ExposesFixedItemInvView.isItemValidForSlot(int, ItemStack)as a (potentially) readable filter.protected InvTypegetInv(int slot)protected intgetInvIndex(int slot)net.minecraft.item.ItemStackgetInvStack(int slot)getMappedInv(int... slots)intgetMaxAmount(int slot, net.minecraft.item.ItemStack stack)intgetSubInv(int fromIndex, int toIndex)Equivalent toList.subList(int, int).protected intgetSubSlot(int slot)booleanisItemValidForSlot(int slot, net.minecraft.item.ItemStack item)Checks to see if the given stack would be valid for this slot, ignoring the current contents.Methods inherited from class alexiil.mc.lib.attributes.misc.AbstractCombinedequals, getSubObject, getSubObjectCount, hashCode, toStringMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface alexiil.mc.lib.attributes.item.FixedItemInvViewconvertTo, getFixedView, getGroupedInv, getSlot, offerSelfAsAttribute, slotIterable, stackIterable
- 
Field Details- 
views
- 
subSlotStartIndexprotected final int[] subSlotStartIndex
- 
invSizeprotected final int invSize
 
- 
- 
Constructor Details- 
CombinedFixedItemInvView
 
- 
- 
Method Details- 
createView
- 
getSlotCountpublic int getSlotCount()- Specified by:
- getSlotCountin interface- FixedItemInvView
- Returns:
- The number of slots in this inventory.
 
- 
getInvIndexprotected int getInvIndex(int slot)
- 
getInv
- 
getSubSlotprotected int getSubSlot(int slot)
- 
getInvStackpublic net.minecraft.item.ItemStack getInvStack(int slot)- Specified by:
- getInvStackin interface- FixedItemInvView
- Parameters:
- slot- The slot index. Must be a value between 0 (inclusive) and- FixedItemInvView.getSlotCount()(exclusive) to be valid. (Like in arrays, lists, etc).
- Returns:
- The ItemStack that is held in the inventory at the moment. It is unspecified whether you are allowed to
         modify this returned ItemStack- however subinterfaces (likeFixedItemInv) may have different limitations on this. Note that this stack might not be valid for this slot in eitherFixedItemInvView.isItemValidForSlot(int, ItemStack)orFixedItemInvView.getFilterForSlot(int).
 
- 
isItemValidForSlotpublic boolean isItemValidForSlot(int slot, net.minecraft.item.ItemStack item)Description copied from interface:FixedItemInvViewChecks to see if the given stack would be valid for this slot, ignoring the current contents. Note that this method should adhere to the requirements ofItemFilter.matches(ItemStack), so this must not care about theItemStack.getCount(). Passingemptystacks will generally not return useful results.- Specified by:
- isItemValidForSlotin interface- FixedItemInvView
- Parameters:
- slot- The slot index. Must be a value between 0 (inclusive) and- FixedItemInvView.getSlotCount()(exclusive) to be valid. (Like in arrays, lists, etc).
- item- The- ItemStackto check. It's undefined what is returned if an- emptystack is passed in, but it is not generally expected to be useful.
 
- 
getFilterForSlotDescription copied from interface:FixedItemInvViewExposesFixedItemInvView.isItemValidForSlot(int, ItemStack)as a (potentially) readable filter.- Specified by:
- getFilterForSlotin interface- FixedItemInvView
- Parameters:
- slot- The slot index. Must be a value between 0 (inclusive) and- FixedItemInvView.getSlotCount()(exclusive) to be valid. (Like in arrays, lists, etc).
- Returns:
- An ItemFilterfor what may be present in this slot. If this slot is filtered by anItemFilterinternally then it is highly recommended that this be overridden to return that filter rather than the default opaque wrapper aroundFixedItemInvView.isItemValidForSlot(int, ItemStack).
 
- 
getMaxAmountpublic int getMaxAmount(int slot, net.minecraft.item.ItemStack stack)- Specified by:
- getMaxAmountin interface- FixedItemInvView
- Parameters:
- slot- The slot index. Must be a value between 0 (inclusive) and- FixedItemInvView.getSlotCount()(exclusive) to be valid. (Like in arrays, lists, etc).
- stack- The stack to check for. May be an- emptystack to get the maximum amount that this can hold of any stack.
- Returns:
- The maximum amount that the given slot can hold of the given stack. This method will ignore the current
         stack in FixedItemInvView.getInvStack(int). The default implementation just delegates toItemStack.getMaxCount(). Note that any setters that this object implements (likeFixedItemInv.setInvStack(int, ItemStack, Simulation)should reject stacks that are greater than this value. (and callers should only call this if they need to check the amounts separately. Note that it is meaningless to return values greater than the maximum amount an item can be stacked to here, and callers are free to throw an exception if this is violated. (Basically huge single-slot inventories shouldn't implement this interface).
 
- 
getChangeValuepublic int getChangeValue()- Specified by:
- getChangeValuein interface- AbstractItemInvView
- Returns:
- A value that indicates whether an inventory might have changed if it differs from the last value
         returned. This number doesn't have to start at 0, but it must change every time that the inventory is
         changed, although it can change even without any observable changes to this inventory.
         Inventories that don't support this might increment the change number every time that this is called - so you should never write a loop that depends on the returned value settling down on a particular value. Inventories that support listenershighly encouraged to support this - by definition if an inventory knows when it changed then it should be able to count the number of changes. It is also implied that any changes to this value will also invoke every registeredInvMarkDirtyListener.The default implementation returns an ever-increasing value. 
 
- 
addListenerDescription 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.
 
- 
getSubInvDescription copied from interface:FixedItemInvViewEquivalent toList.subList(int, int).- Specified by:
- getSubInvin interface- FixedItemInvView
- Parameters:
- fromIndex- The first slot to expose
- toIndex- The slot after the last slot to expose.
- Returns:
- a view of this inventory that only exposes the given number of slots. Might return "this" if fromIndex is
         0 and toIndex is equal to FixedItemInvView.getSlotCount().
 
- 
getMappedInv- Specified by:
- getMappedInvin interface- FixedItemInvView
- Parameters:
- slots- The slots to expose.
- Returns:
- a view of this inventory that only exposes the given slots. Might return "this" if the slot array is just
         [0,1, ... FixedItemInvView.getSlotCount()-1]
 
 
-