Class FixedInvEmiItemInv
java.lang.Object
alexiil.mc.lib.attributes.misc.AbstractItemBasedAttribute
alexiil.mc.lib.attributes.item.compat.mod.emi.iteminv.FixedInvEmiItemInv
- All Implemented Interfaces:
Convertible
,AbstractItemInvView
,FixedItemInv
,FixedItemInvView
public class FixedInvEmiItemInv extends AbstractItemBasedAttribute implements FixedItemInv
A
FixedItemInv
which wraps emi's ItemInventory
.
Very few mods will need to use this directly - instead this should be obtained as an attribute through
ItemAttributes.FIXED_INV
or similar.
-
Nested Class Summary
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.misc.AbstractItemBasedAttribute
excessStacks, stackRef
-
Constructor Summary
Constructors Constructor Description FixedInvEmiItemInv(Reference<net.minecraft.item.ItemStack> stackRef, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks)
-
Method Summary
Modifier and Type Method Description net.minecraft.item.ItemStack
getInvStack(int slot)
int
getSlotCount()
protected static dev.emi.iteminventory.api.ItemInventory
inv(net.minecraft.item.ItemStack stack)
boolean
isItemValidForSlot(int slot, net.minecraft.item.ItemStack offered)
Checks to see if the given stack would be valid for this slot, ignoring the current contents.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.misc.AbstractItemBasedAttribute
setStacks, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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, getMappedInv, getSlot, getSubInv, getTransferable, insertStack, modifySlot, slotIterable
Methods inherited from interface alexiil.mc.lib.attributes.item.FixedItemInvView
convertTo, getFilterForSlot, getFixedView, getMaxAmount, offerSelfAsAttribute, stackIterable
-
Constructor Details
-
FixedInvEmiItemInv
public FixedInvEmiItemInv(Reference<net.minecraft.item.ItemStack> stackRef, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks)
-
-
Method Details
-
inv
protected static dev.emi.iteminventory.api.ItemInventory inv(net.minecraft.item.ItemStack stack) -
getSlotCount
public int getSlotCount()- Specified by:
getSlotCount
in interfaceFixedItemInvView
- Returns:
- The number of slots in this inventory.
-
isItemValidForSlot
public boolean isItemValidForSlot(int slot, net.minecraft.item.ItemStack offered)Description copied from interface:FixedItemInv
Checks 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()
. Passingempty
stacks will generally not return useful results.Note that just because an
ItemStack
passes this validity test, and is stackable with the current stack, does not mean that you can insert the stack into this inventory..- Specified by:
isItemValidForSlot
in interfaceFixedItemInv
- Specified by:
isItemValidForSlot
in interfaceFixedItemInvView
- Parameters:
slot
- The slot index. Must be a value between 0 (inclusive) andFixedItemInvView.getSlotCount()
(exclusive) to be valid. (Like in arrays, lists, etc).offered
- TheItemStack
to check. It's undefined what is returned if anempty
stack is passed in, but it is not generally expected to be useful.
-
getInvStack
public net.minecraft.item.ItemStack getInvStack(int slot)- Specified by:
getInvStack
in interfaceFixedItemInv
- Specified by:
getInvStack
in interfaceFixedItemInvView
- Parameters:
slot
- The slot index. Must be a value between 0 (inclusive) andFixedItemInvView.getSlotCount()
(exclusive) to be valid. (Like in arrays, lists, etc).- Returns:
- A modifiable version of the
ItemStack
that is stored in this inventory. Note that this *may* be acopy
: changing the returnedItemStack
might not change the next returned stack.
-
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).
-