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.

  • Constructor Details

  • Method Details

    • inv

      protected static dev.emi.iteminventory.api.ItemInventory inv​(net.minecraft.item.ItemStack stack)
    • getSlotCount

      public int getSlotCount()
      Specified by:
      getSlotCount in interface FixedItemInvView
      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 of ItemFilter.matches(ItemStack), so this must not care about the ItemStack.getCount(). Passing empty 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 interface FixedItemInv
      Specified by:
      isItemValidForSlot in 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).
      offered - The ItemStack to check. It's undefined what is returned if an empty 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 interface FixedItemInv
      Specified by:
      getInvStack in 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:
      A modifiable version of the ItemStack that is stored in this inventory. Note that this *may* be a copy: changing the returned ItemStack might not change the next returned stack.
    • setInvStack

      public boolean setInvStack​(int slot, net.minecraft.item.ItemStack to, Simulation simulation)
      Description copied from interface: FixedItemInv
      Sets the stack in the given slot to the given stack.
      Specified by:
      setInvStack in interface FixedItemInv
      to - The new ItemStack. 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).