Interface InternalInventory

All Superinterfaces:
ItemTransfer, Iterable<net.minecraft.world.item.ItemStack>
All Known Subinterfaces:
IUpgradeInventory
All Known Implementing Classes:
BaseInternalInventory, DelegateItemUpgradeInventory, PlatformInventoryWrapper, appeng.util.inv.SupplierInternalInventory

public interface InternalInventory extends Iterable<net.minecraft.world.item.ItemStack>, ItemTransfer
  • Method Summary

    Modifier and Type
    Method
    Description
    default net.minecraft.world.item.ItemStack
    addItems(net.minecraft.world.item.ItemStack stack)
    Attempts to insert as much of the given item into this inventory as possible.
    default net.minecraft.world.item.ItemStack
    addItems(net.minecraft.world.item.ItemStack stack, boolean simulate)
    Attempts to insert as much of the given item into this inventory as possible.
    default void
     
     
    default net.minecraft.world.item.ItemStack
    extractItem(int slot, int amount, boolean simulate)
     
    default int
     
    getSlotInv(int slotIndex)
     
    default int
    getSlotLimit(int slot)
     
    net.minecraft.world.item.ItemStack
    getStackInSlot(int slotIndex)
     
    getSubInventory(int fromSlotInclusive, int toSlotExclusive)
     
    default net.minecraft.world.item.ItemStack
    insertItem(int slot, net.minecraft.world.item.ItemStack stack, boolean simulate)
     
    default boolean
     
    default boolean
    isItemValid(int slot, net.minecraft.world.item.ItemStack stack)
     
    default Iterator<net.minecraft.world.item.ItemStack>
     
    default net.minecraft.world.item.ItemStack
    removeItems(int amount, net.minecraft.world.item.ItemStack filter, @Nullable Predicate<net.minecraft.world.item.ItemStack> destination)
     
    default net.minecraft.world.item.ItemStack
    removeSimilarItems(int amount, net.minecraft.world.item.ItemStack filter, FuzzyMode fuzzyMode, Predicate<net.minecraft.world.item.ItemStack> destination)
    For fuzzy extract, we will only ever extract one slot, since we're afraid of merging two item stacks with different damage values.
    default void
    Forces a change notification to any listeners for the given slot.
    void
    setItemDirect(int slotIndex, net.minecraft.world.item.ItemStack stack)
    Puts the given stack in the given slot and circumvents any potential filters.
    default net.minecraft.world.item.ItemStack
    simulateAdd(net.minecraft.world.item.ItemStack stack)
     
    default net.minecraft.world.item.ItemStack
    simulateRemove(int amount, net.minecraft.world.item.ItemStack filter, Predicate<net.minecraft.world.item.ItemStack> destination)
     
    default net.minecraft.world.item.ItemStack
    simulateSimilarRemove(int amount, net.minecraft.world.item.ItemStack filter, FuzzyMode fuzzyMode, Predicate<net.minecraft.world.item.ItemStack> destination)
     
    int
     
    default net.minecraft.world.Container
     
    default net.neoforged.neoforge.items.IItemHandler
     
    static @Nullable ItemTransfer
    wrapExternal(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction side)
     

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Method Details

    • wrapExternal

      @Nullable static @Nullable ItemTransfer wrapExternal(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction side)
    • empty

      static InternalInventory empty()
    • clear

      default void clear()
    • isEmpty

      default boolean isEmpty()
    • toItemHandler

      default net.neoforged.neoforge.items.IItemHandler toItemHandler()
    • toContainer

      default net.minecraft.world.Container toContainer()
    • size

      int size()
    • getSlotLimit

      default int getSlotLimit(int slot)
    • getStackInSlot

      net.minecraft.world.item.ItemStack getStackInSlot(int slotIndex)
    • setItemDirect

      void setItemDirect(int slotIndex, net.minecraft.world.item.ItemStack stack)
      Puts the given stack in the given slot and circumvents any potential filters.
    • isItemValid

      default boolean isItemValid(int slot, net.minecraft.world.item.ItemStack stack)
    • getSubInventory

      default InternalInventory getSubInventory(int fromSlotInclusive, int toSlotExclusive)
    • getSlotInv

      default InternalInventory getSlotInv(int slotIndex)
    • getRedstoneSignal

      default int getRedstoneSignal()
      Returns:
      The redstone signal indicating how full this container is in the [0-15] range.
    • iterator

      default Iterator<net.minecraft.world.item.ItemStack> iterator()
      Specified by:
      iterator in interface Iterable<net.minecraft.world.item.ItemStack>
    • addItems

      default net.minecraft.world.item.ItemStack addItems(net.minecraft.world.item.ItemStack stack)
      Attempts to insert as much of the given item into this inventory as possible.
      Specified by:
      addItems in interface ItemTransfer
      Parameters:
      stack - The stack to insert. Will not be mutated.
      Returns:
      The overflow, which can be the same object as stack.
    • simulateAdd

      default net.minecraft.world.item.ItemStack simulateAdd(net.minecraft.world.item.ItemStack stack)
      Specified by:
      simulateAdd in interface ItemTransfer
    • addItems

      default net.minecraft.world.item.ItemStack addItems(net.minecraft.world.item.ItemStack stack, boolean simulate)
      Attempts to insert as much of the given item into this inventory as possible.
      Specified by:
      addItems in interface ItemTransfer
      Parameters:
      stack - The stack to insert. Will not be mutated.
      Returns:
      The overflow, which can be the same object as stack.
    • removeItems

      default net.minecraft.world.item.ItemStack removeItems(int amount, net.minecraft.world.item.ItemStack filter, @Nullable @Nullable Predicate<net.minecraft.world.item.ItemStack> destination)
      Specified by:
      removeItems in interface ItemTransfer
    • simulateRemove

      default net.minecraft.world.item.ItemStack simulateRemove(int amount, net.minecraft.world.item.ItemStack filter, Predicate<net.minecraft.world.item.ItemStack> destination)
      Specified by:
      simulateRemove in interface ItemTransfer
    • removeSimilarItems

      default net.minecraft.world.item.ItemStack removeSimilarItems(int amount, net.minecraft.world.item.ItemStack filter, FuzzyMode fuzzyMode, Predicate<net.minecraft.world.item.ItemStack> destination)
      For fuzzy extract, we will only ever extract one slot, since we're afraid of merging two item stacks with different damage values.
      Specified by:
      removeSimilarItems in interface ItemTransfer
    • simulateSimilarRemove

      default net.minecraft.world.item.ItemStack simulateSimilarRemove(int amount, net.minecraft.world.item.ItemStack filter, FuzzyMode fuzzyMode, Predicate<net.minecraft.world.item.ItemStack> destination)
      Specified by:
      simulateSimilarRemove in interface ItemTransfer
    • insertItem

      default net.minecraft.world.item.ItemStack insertItem(int slot, net.minecraft.world.item.ItemStack stack, boolean simulate)
      Returns:
      The overflow
    • extractItem

      default net.minecraft.world.item.ItemStack extractItem(int slot, int amount, boolean simulate)
    • sendChangeNotification

      @Internal default void sendChangeNotification(int slot)
      Forces a change notification to any listeners for the given slot. For internal use only. This should also cause the inventory to be saved.