Class SlotItemHandler

java.lang.Object
net.minecraft.world.inventory.Slot
net.neoforged.neoforge.items.SlotItemHandler

public class SlotItemHandler extends Slot
  • Field Details

    • emptyInventory

      private static Container emptyInventory
    • itemHandler

      private final IItemHandler itemHandler
    • index

      protected final int index
  • Constructor Details

    • SlotItemHandler

      public SlotItemHandler(IItemHandler itemHandler, int index, int xPosition, int yPosition)
  • Method Details

    • mayPlace

      public boolean mayPlace(ItemStack stack)
      Description copied from class: Slot
      Check if the stack is allowed to be placed in this slot, used for armor slots as well as furnace fuel.
      Overrides:
      mayPlace in class Slot
    • getItem

      public ItemStack getItem()
      Overrides:
      getItem in class Slot
    • set

      public void set(ItemStack stack)
      Description copied from class: Slot
      Helper method to put a stack in the slot.
      Overrides:
      set in class Slot
    • initialize

      public void initialize(ItemStack stack)
    • onQuickCraft

      public void onQuickCraft(ItemStack oldStackIn, ItemStack newStackIn)
      Description copied from class: Slot
      if par2 has more items than par1, onCrafting(item,countIncrease) is called
      Overrides:
      onQuickCraft in class Slot
    • getMaxStackSize

      public int getMaxStackSize()
      Overrides:
      getMaxStackSize in class Slot
    • getMaxStackSize

      public int getMaxStackSize(ItemStack stack)
      Overrides:
      getMaxStackSize in class Slot
    • mayPickup

      public boolean mayPickup(Player playerIn)
      Description copied from class: Slot
      Return whether this slot's stack can be taken from this slot.
      Overrides:
      mayPickup in class Slot
    • remove

      public ItemStack remove(int amount)
      Description copied from class: Slot
      Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new stack.
      Overrides:
      remove in class Slot
    • getItemHandler

      public IItemHandler getItemHandler()