Interface FixedItemInv.ModifiableFixedItemInv

All Superinterfaces:
AbstractItemInvView, Convertible, FixedItemInv, FixedItemInvView
All Known Implementing Classes:
CombinedFixedItemInv.OfModifiable, DelegatingFixedItemInv.OfModifiable, DirectFixedItemInv, EmptyFixedItemInv, FixedInventoryVanillaWrapper, FixedSidedInventoryVanillaWrapper, MappedFixedItemInv.OfModifiable, SimpleLimitedFixedItemInv.OfModifiable, SubFixedItemInv.OfModifiable
Enclosing interface:
FixedItemInv

public static interface FixedItemInv.ModifiableFixedItemInv extends FixedItemInv
The "simpler" variant of FixedItemInv which allows callers to freely modify the current ItemStack contained in it's inventory.
  • Method Details

    • getInvStack

      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:
      The ItemStack that is stored in this FixedItemInv. Changing this will always change this inventory. As such you must always call markDirty() or setInvStack(int, ItemStack, Simulation) after you have finished modifying it.
    • isItemValidForSlot

      boolean isItemValidForSlot(int slot, net.minecraft.item.ItemStack stack)
      Checks to see if the given stack is valid for a given slot. This ignores any current stacks in the slot. Note that this should only compare the Item contained in ItemStack's, because callers can always modify any other properties (like count or NBT) themselves
      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).
      stack - 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.
    • getFilterForSlot

      default ItemFilter getFilterForSlot(int slot)
      Note that this filter should only compare the Item contained in ItemStack's, because callers can always modify any other properties (like count or NBT) themselves.
      Specified by:
      getFilterForSlot 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:
      An ItemFilter for what may be present in this slot. If this slot is filtered by an ItemFilter internally then it is highly recommended that this be overridden to return that filter rather than the default opaque wrapper around FixedItemInvView.isItemValidForSlot(int, ItemStack).
    • setInvStack

      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
      Parameters:
      to - The new stack to set this to. If this is identically equal (with ==) to the stack held in this inventory (so it was returned by getInvStack(int)) then this will return true.
      Returns:
      True if the modification was allowed, false otherwise. (For example if the given stack doesn't pass the FixedItemInvView.isItemValidForSlot(int, ItemStack) test).
    • markDirty

      void markDirty()
      Informs this inventory that the ItemStack returned by getInvStack(int) has been changed.