Interface IAdvancedItemHandler

All Superinterfaces:
net.minecraftforge.items.IItemHandler
All Known Subinterfaces:
IAdvancedItemHandlerModifiable
All Known Implementing Classes:
BaseItemStackHandler

public interface IAdvancedItemHandler extends net.minecraftforge.items.IItemHandler
Rich interface that provides some default methods to an IItemHandler. Just implement this together with IItemHandler. If you have an IItemHandlerModifiable, use IAdvancedItemHandlerModifiable instead.
  • Method Summary

    Modifier and Type
    Method
    Description
    default net.minecraft.world.item.ItemStack
    extractItem(int amount, boolean simulate)
    Works like IItemHandler.extractItem(int, int, boolean) but without a specific slot.
    default net.minecraft.world.item.ItemStack
    extractItem(Predicate<net.minecraft.world.item.ItemStack> predicate, int amount, boolean simulate)
    Works like IItemHandler.extractItem(int, int, boolean) but with a predicate instead of a slot.
    default boolean
    hasSpaceFor(List<net.minecraft.world.item.ItemStack> stacks)
    Gets whether the item handler has space for all the items given.
    default boolean
    hasSpaceFor(List<net.minecraft.world.item.ItemStack> stacks, int startInclusive, int endExclusive)
    Gets whether the item handler has space for all the items given.
    default net.minecraft.world.item.ItemStack
    insertItem(net.minecraft.world.item.ItemStack stack, boolean simulate)
    Works like IItemHandler.insertItem(int, ItemStack, boolean) but without a specific slot.
    wrap(net.minecraftforge.items.IItemHandler handler)
    Creates a new IAdvancedItemHandler from an IItemHandler.

    Methods inherited from interface net.minecraftforge.items.IItemHandler

    extractItem, getSlotLimit, getSlots, getStackInSlot, insertItem, isItemValid
  • Method Details

    • insertItem

      default net.minecraft.world.item.ItemStack insertItem(net.minecraft.world.item.ItemStack stack, boolean simulate)
      Works like IItemHandler.insertItem(int, ItemStack, boolean) but without a specific slot.
    • hasSpaceFor

      default boolean hasSpaceFor(List<net.minecraft.world.item.ItemStack> stacks)
      Gets whether the item handler has space for all the items given. This does not check whether the item handler can take the stacks via IItemHandler.insertItem(int, ItemStack, boolean). However it checks for IItemHandler.isItemValid(int, ItemStack).
    • hasSpaceFor

      default boolean hasSpaceFor(List<net.minecraft.world.item.ItemStack> stacks, int startInclusive, int endExclusive)
      Gets whether the item handler has space for all the items given. This does not check whether the item handler can take the stacks via IItemHandler.insertItem(int, ItemStack, boolean). However it checks for IItemHandler.isItemValid(int, ItemStack).
      Parameters:
      startInclusive - The first slot to test.
      endExclusive - The first slot to after the range of slots to test.
    • extractItem

      default net.minecraft.world.item.ItemStack extractItem(int amount, boolean simulate)
      Works like IItemHandler.extractItem(int, int, boolean) but without a specific slot.
    • extractItem

      default net.minecraft.world.item.ItemStack extractItem(Predicate<net.minecraft.world.item.ItemStack> predicate, int amount, boolean simulate)
      Works like IItemHandler.extractItem(int, int, boolean) but with a predicate instead of a slot.
    • wrap

      static IAdvancedItemHandler wrap(net.minecraftforge.items.IItemHandler handler)
      Creates a new IAdvancedItemHandler from an IItemHandler.