Class ResourceHandlerSlot


public class ResourceHandlerSlot extends StackCopySlot
Base implementation for a Slot backed by a ResourceHandler<ItemResource>. Requires the handler to expose a direct mutation function, such as StacksResourceHandler.set(int, T, int).
  • Field Details

  • Constructor Details

  • 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
    • getStackCopy

      protected ItemStack getStackCopy()
      Description copied from class: StackCopySlot
      Gets the itemstack from the storage.
      Specified by:
      getStackCopy in class StackCopySlot
      Returns:
      the stack in this slot
    • setStackCopy

      protected void setStackCopy(ItemStack stack)
      Description copied from class: StackCopySlot
      Sets the itemstack from the storage.
      Specified by:
      setStackCopy in class StackCopySlot
      Parameters:
      stack - the stack to put into this slot
    • 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 player)
      Description copied from class: Slot
      Return whether this slot's stack can be taken from this slot.
      Overrides:
      mayPickup in class Slot
    • getResourceHandler

      public ResourceHandler<ItemResource> getResourceHandler()
    • isSameInventory

      public boolean isSameInventory(Slot other)
      Description copied from class: Slot
      Checks if the other slot is in the same inventory, by comparing the inventory reference.
      Overrides:
      isSameInventory in class Slot
      Parameters:
      other -
      Returns:
      true if the other slot is in the same inventory