Class CombinedFixedItemInv<InvType extends FixedItemInv>
java.lang.Object
alexiil.mc.lib.attributes.item.impl.CombinedFixedItemInvView<InvType>
alexiil.mc.lib.attributes.item.impl.CombinedFixedItemInv<InvType>
- All Implemented Interfaces:
Convertible
,AbstractItemInvView
,FixedItemInv
,FixedItemInvView
- Direct Known Subclasses:
CombinedFixedItemInv.OfCopying
,CombinedFixedItemInv.OfModifiable
public class CombinedFixedItemInv<InvType extends FixedItemInv> extends CombinedFixedItemInvView<InvType> implements FixedItemInv
An
FixedItemInv
that delegates to a list of them instead of storing items directly.-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CombinedFixedItemInv.OfCopying<InvType extends FixedItemInv.CopyingFixedItemInv>
static class
CombinedFixedItemInv.OfModifiable<InvType extends FixedItemInv.ModifiableFixedItemInv>
Nested classes/interfaces inherited from interface alexiil.mc.lib.attributes.item.AbstractItemInvView
AbstractItemInvView.DefaultChangeTracker
Nested classes/interfaces inherited from interface alexiil.mc.lib.attributes.item.FixedItemInv
FixedItemInv.CopyingFixedItemInv, FixedItemInv.ModifiableFixedItemInv
-
Field Summary
Fields inherited from class alexiil.mc.lib.attributes.item.impl.CombinedFixedItemInvView
invSize, subSlotStartIndex, views
-
Constructor Summary
Constructors Constructor Description CombinedFixedItemInv(java.util.List<? extends InvType> views)
-
Method Summary
Modifier and Type Method Description static FixedItemInv
create(java.util.List<? extends FixedItemInv> list)
FixedItemInv
getMappedInv(int... slots)
FixedItemInv
getSubInv(int fromIndex, int toIndex)
Equivalent toList.subList(int, int)
.boolean
setInvStack(int slot, net.minecraft.item.ItemStack to, Simulation simulation)
Sets the stack in the given slot to the given stack.Methods inherited from class alexiil.mc.lib.attributes.item.impl.CombinedFixedItemInvView
addListener, createView, getChangeValue, getFilterForSlot, getInv, getInvIndex, getInvStack, getMaxAmount, getSlotCount, getSubSlot, 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.AbstractItemInvView
addListener, getChangeValue
Methods inherited from interface alexiil.mc.lib.attributes.item.FixedItemInv
createLimitedFixedInv, extractStack, forceSetInvStack, getExtractable, getGroupedInv, getInsertable, getInvStack, getSlot, getTransferable, insertStack, isItemValidForSlot, modifySlot, slotIterable
Methods inherited from interface alexiil.mc.lib.attributes.item.FixedItemInvView
convertTo, getFilterForSlot, getFixedView, getMaxAmount, getSlotCount, offerSelfAsAttribute, stackIterable
-
Constructor Details
-
Method Details
-
create
-
setInvStack
Description copied from interface:FixedItemInv
Sets the stack in the given slot to the given stack.- Specified by:
setInvStack
in interfaceFixedItemInv
to
- The newItemStack
. It is not defined if you are allowed to modify this or not.- Returns:
- True if the modification was allowed, false otherwise. (For example if the given stack doesn't pass the
FixedItemInvView.isItemValidForSlot(int, ItemStack)
test).
-
getSubInv
Description copied from interface:FixedItemInvView
Equivalent toList.subList(int, int)
.- Specified by:
getSubInv
in interfaceFixedItemInv
- Specified by:
getSubInv
in interfaceFixedItemInvView
- Overrides:
getSubInv
in classCombinedFixedItemInvView<InvType extends FixedItemInv>
- 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
- Specified by:
getMappedInv
in interfaceFixedItemInv
- Specified by:
getMappedInv
in interfaceFixedItemInvView
- Overrides:
getMappedInv
in classCombinedFixedItemInvView<InvType extends FixedItemInv>
- 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]
-