Interface IAdvancedItemHandler

All Superinterfaces:
net.neoforged.neoforge.transfer.ResourceHandler<net.neoforged.neoforge.transfer.item.ItemResource>
All Known Subinterfaces:
IAdvancedItemHandlerModifiable
All Known Implementing Classes:
BaseItemStackHandler, FilterItemHandler, StackItemResourceHandler

public interface IAdvancedItemHandler extends net.neoforged.neoforge.transfer.ResourceHandler<net.neoforged.neoforge.transfer.item.ItemResource>
Rich interface that provides some default methods to a ResourceHandler<ItemResource>. Just implement this together with ResourceHandler. If you also need direct slot modification, use IAdvancedItemHandlerModifiable instead.
  • Method Summary

    Modifier and Type
    Method
    Description
    default net.minecraft.world.item.ItemStack
    extractItem(int amount, boolean simulate)
    Extracts up to amount items from any slot.
    default net.minecraft.world.item.ItemStack
    extractItem(Predicate<net.minecraft.world.item.ItemStack> predicate, int amount, boolean simulate)
    Extracts up to amount items matching a predicate from any 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 insert but without a specific slot.

    Methods inherited from interface net.neoforged.neoforge.transfer.ResourceHandler

    extract, extract, getAmountAsInt, getAmountAsLong, getCapacityAsInt, getCapacityAsLong, getResource, insert, insert, isValid, size
  • Method Details

    • insertItem

      default net.minecraft.world.item.ItemStack insertItem(net.minecraft.world.item.ItemStack stack, boolean simulate)
      Works like insert 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.
    • 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.
      Parameters:
      startInclusive - The first slot to test.
      endExclusive - The first slot after the range of slots to test.
    • extractItem

      default net.minecraft.world.item.ItemStack extractItem(int amount, boolean simulate)
      Extracts up to amount items from any slot.
    • extractItem

      default net.minecraft.world.item.ItemStack extractItem(Predicate<net.minecraft.world.item.ItemStack> predicate, int amount, boolean simulate)
      Extracts up to amount items matching a predicate from any slot.