Class MappedFixedItemInvView
java.lang.Object
alexiil.mc.lib.attributes.item.impl.AbstractPartialFixedItemInvView
alexiil.mc.lib.attributes.item.impl.MappedFixedItemInvView
- All Implemented Interfaces:
Convertible
,AbstractItemInvView
,FixedItemInvView
- Direct Known Subclasses:
MappedFixedItemInv
public class MappedFixedItemInvView extends AbstractPartialFixedItemInvView
Default implementation for
FixedItemInvView.getMappedInv(int...)
.-
Nested Class Summary
Nested classes/interfaces inherited from interface alexiil.mc.lib.attributes.item.AbstractItemInvView
AbstractItemInvView.DefaultChangeTracker
-
Field Summary
Fields Modifier and Type Field Description protected it.unimi.dsi.fastutil.ints.Int2IntMap
inverseSlotMap
protected int[]
slots
-
Constructor Summary
Constructors Constructor Description MappedFixedItemInvView(FixedItemInvView inv, int[] slots)
-
Method Summary
Modifier and Type Method Description static MappedFixedItemInvView
createView(FixedItemInvView inv, int[] slots)
protected int
getInternalSlot(int slot)
FixedItemInvView
getMappedInv(int... slots)
int
getSlotCount()
FixedItemInvView
getSubInv(int fromIndex, int toIndex)
Equivalent toList.subList(int, int)
.Methods inherited from class alexiil.mc.lib.attributes.item.impl.AbstractPartialFixedItemInvView
addListener, getChangeValue, getFilterForSlot, getInvStack, getMaxAmount, isItemValidForSlot
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.FixedItemInvView
convertTo, getFixedView, getGroupedInv, getSlot, offerSelfAsAttribute, slotIterable, stackIterable
-
Field Details
-
slots
protected final int[] slots -
inverseSlotMap
protected final it.unimi.dsi.fastutil.ints.Int2IntMap inverseSlotMap
-
-
Constructor Details
-
Method Details
-
createView
-
getInternalSlot
protected int getInternalSlot(int slot)- Specified by:
getInternalSlot
in classAbstractPartialFixedItemInvView
- Returns:
- The slot that the internal
AbstractPartialFixedItemInvView.inv
should use.
-
getSlotCount
public int getSlotCount()- Returns:
- The number of slots in this inventory.
-
getSubInv
Description copied from interface:FixedItemInvView
Equivalent toList.subList(int, int)
.- Parameters:
fromIndex
- The first slot to exposetoIndex
- 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
- 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]
-