java.lang.Object
com.portingdeadmods.portingdeadlibs.api.gui.menus.slots.AbstractSlot
com.portingdeadmods.portingdeadlibs.api.gui.menus.slots.ReferenceSlot<net.minecraft.world.item.ItemStack>
com.portingdeadmods.portingdeadlibs.api.gui.menus.slots.ItemReferenceSlot

public class ItemReferenceSlot extends ReferenceSlot<net.minecraft.world.item.ItemStack>
A slot that displays a reference ItemStack without actually consuming it. Perfect for filter/pattern settings.
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.portingdeadmods.portingdeadlibs.api.gui.menus.slots.ReferenceSlot

    ReferenceSlot.ReferenceListener<T>
  • Field Summary

    Fields inherited from class com.portingdeadmods.portingdeadlibs.api.gui.menus.slots.ReferenceSlot

    listener, reference

    Fields inherited from class com.portingdeadmods.portingdeadlibs.api.gui.menus.slots.AbstractSlot

    index, slot, x, y
  • Constructor Summary

    Constructors
    Constructor
    Description
    ItemReferenceSlot(int index, int x, int y, int width, int height, @Nullable ReferenceSlot.ReferenceListener<net.minecraft.world.item.ItemStack> listener)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    areReferencesEqual(net.minecraft.world.item.ItemStack reference1, net.minecraft.world.item.ItemStack reference2)
    Checks if two references are equal
    protected net.minecraft.world.item.ItemStack
    copyReference(net.minecraft.world.item.ItemStack reference)
    Creates a copy of the reference
    protected net.minecraft.world.item.ItemStack
    Returns an empty reference of type T
    boolean
    handleSpecialClick(net.minecraft.world.entity.player.Player player, net.minecraft.world.inventory.ClickType clickType, net.minecraft.world.inventory.ClickAction clickAction)
    Override this to handle clicking with a fluid container
    protected boolean
    isReferenceEmpty(net.minecraft.world.item.ItemStack reference)
    Checks if a reference is empty
    boolean
    setReference(net.minecraft.world.item.ItemStack stack)
    Called when a player clicks on this slot with an item

    Methods inherited from class com.portingdeadmods.portingdeadlibs.api.gui.menus.slots.ReferenceSlot

    clearReference, getReference, setReferenceDirectly

    Methods inherited from class com.portingdeadmods.portingdeadlibs.api.gui.menus.slots.AbstractSlot

    getX, getY

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ItemReferenceSlot

      public ItemReferenceSlot(int index, int x, int y, int width, int height, @Nullable @Nullable ReferenceSlot.ReferenceListener<net.minecraft.world.item.ItemStack> listener)
  • Method Details

    • getEmptyReference

      protected net.minecraft.world.item.ItemStack getEmptyReference()
      Description copied from class: ReferenceSlot
      Returns an empty reference of type T
      Specified by:
      getEmptyReference in class ReferenceSlot<net.minecraft.world.item.ItemStack>
    • setReference

      public boolean setReference(net.minecraft.world.item.ItemStack stack)
      Description copied from class: ReferenceSlot
      Called when a player clicks on this slot with an item
      Specified by:
      setReference in class ReferenceSlot<net.minecraft.world.item.ItemStack>
      Parameters:
      stack - The stack the player is holding
      Returns:
      true if the reference was set, false otherwise
    • copyReference

      protected net.minecraft.world.item.ItemStack copyReference(net.minecraft.world.item.ItemStack reference)
      Description copied from class: ReferenceSlot
      Creates a copy of the reference
      Specified by:
      copyReference in class ReferenceSlot<net.minecraft.world.item.ItemStack>
    • areReferencesEqual

      protected boolean areReferencesEqual(net.minecraft.world.item.ItemStack reference1, net.minecraft.world.item.ItemStack reference2)
      Description copied from class: ReferenceSlot
      Checks if two references are equal
      Specified by:
      areReferencesEqual in class ReferenceSlot<net.minecraft.world.item.ItemStack>
    • isReferenceEmpty

      protected boolean isReferenceEmpty(net.minecraft.world.item.ItemStack reference)
      Description copied from class: ReferenceSlot
      Checks if a reference is empty
      Specified by:
      isReferenceEmpty in class ReferenceSlot<net.minecraft.world.item.ItemStack>
    • handleSpecialClick

      public boolean handleSpecialClick(net.minecraft.world.entity.player.Player player, net.minecraft.world.inventory.ClickType clickType, net.minecraft.world.inventory.ClickAction clickAction)
      Description copied from class: ReferenceSlot
      Override this to handle clicking with a fluid container
      Overrides:
      handleSpecialClick in class ReferenceSlot<net.minecraft.world.item.ItemStack>
      Parameters:
      player - The player clicking
      clickType - The type of click
      clickAction - The click action
      Returns:
      true if the click was handled