Class ItemReferenceSlot

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.
  • 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.client.input.MouseButtonEvent event)
      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
      Returns:
      true if the click was handled