Class SizeLimitedItemHandlerWrapper

java.lang.Object
me.desht.pneumaticcraft.common.util.SizeLimitedItemHandlerWrapper
All Implemented Interfaces:
net.minecraftforge.items.IItemHandler

public class SizeLimitedItemHandlerWrapper extends Object implements net.minecraftforge.items.IItemHandler
An item handler wrapper which pretends to be smaller than its wrapped item handler; only as large as its last non-empty slot. Useful for tile entities with a large recipe list which might need to search the same mostly empty inventory multiple times (once for each recipe).
  • Constructor Details

    • SizeLimitedItemHandlerWrapper

      public SizeLimitedItemHandlerWrapper(net.minecraftforge.items.IItemHandler wrapped)
  • Method Details

    • getSlots

      public int getSlots()
      Specified by:
      getSlots in interface net.minecraftforge.items.IItemHandler
    • getStackInSlot

      @Nonnull public net.minecraft.world.item.ItemStack getStackInSlot(int slot)
      Specified by:
      getStackInSlot in interface net.minecraftforge.items.IItemHandler
    • insertItem

      @Nonnull public net.minecraft.world.item.ItemStack insertItem(int slot, @Nonnull net.minecraft.world.item.ItemStack stack, boolean simulate)
      Specified by:
      insertItem in interface net.minecraftforge.items.IItemHandler
    • extractItem

      @Nonnull public net.minecraft.world.item.ItemStack extractItem(int slot, int amount, boolean simulate)
      Specified by:
      extractItem in interface net.minecraftforge.items.IItemHandler
    • getSlotLimit

      public int getSlotLimit(int slot)
      Specified by:
      getSlotLimit in interface net.minecraftforge.items.IItemHandler
    • isItemValid

      public boolean isItemValid(int slot, @Nonnull net.minecraft.world.item.ItemStack stack)
      Specified by:
      isItemValid in interface net.minecraftforge.items.IItemHandler