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.DefaultChangeTrackerNested 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.ItemStackgetInvStack(int slot)intgetSlotCount()protected static dev.emi.iteminventory.api.ItemInventoryinv(net.minecraft.item.ItemStack stack)booleanisItemValidForSlot(int slot, net.minecraft.item.ItemStack offered)Checks to see if the given stack would be valid for this slot, ignoring the current contents.booleansetInvStack(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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface alexiil.mc.lib.attributes.item.AbstractItemInvView
addListener, getChangeValueMethods inherited from interface alexiil.mc.lib.attributes.item.FixedItemInv
createLimitedFixedInv, extractStack, forceSetInvStack, getExtractable, getGroupedInv, getInsertable, getMappedInv, getSlot, getSubInv, getTransferable, insertStack, modifySlot, slotIterableMethods 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:
getSlotCountin interfaceFixedItemInvView- Returns:
- The number of slots in this inventory.
-
isItemValidForSlot
public boolean isItemValidForSlot(int slot, net.minecraft.item.ItemStack offered)Description copied from interface:FixedItemInvChecks 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.Note that just because an
ItemStackpasses this validity test, and is stackable with the current stack, does not mean that you can insert the stack into this inventory..- Specified by:
isItemValidForSlotin interfaceFixedItemInv- Specified by:
isItemValidForSlotin 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- TheItemStackto check. It's undefined what is returned if anemptystack is passed in, but it is not generally expected to be useful.
-
getInvStack
public net.minecraft.item.ItemStack getInvStack(int slot)- Specified by:
getInvStackin interfaceFixedItemInv- Specified by:
getInvStackin 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
ItemStackthat is stored in this inventory. Note that this *may* be acopy: changing the returnedItemStackmight not change the next returned stack.
-
setInvStack
Description copied from interface:FixedItemInvSets the stack in the given slot to the given stack.- Specified by:
setInvStackin interfaceFixedItemInvto- 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).
-