Class ValidatedSlot

java.lang.Object
net.minecraft.screen.slot.Slot
io.github.cottonmc.cotton.gui.ValidatedSlot

public class ValidatedSlot extends Slot
  • Field Details

  • Constructor Details

    • ValidatedSlot

      public ValidatedSlot(Inventory inventory, int index, int x, int y)
  • Method Details

    • canInsert

      public boolean canInsert(ItemStack stack)
      Overrides:
      canInsert in class Slot
    • canTakeItems

      public boolean canTakeItems(PlayerEntity player)
      Overrides:
      canTakeItems in class Slot
    • getStack

      public ItemStack getStack()
      Overrides:
      getStack in class Slot
    • markDirty

      public void markDirty()
      Overrides:
      markDirty in class Slot
    • getInventoryIndex

      public int getInventoryIndex()
      Gets the index of this slot in its inventory.
      Returns:
      the inventory index
    • isInsertingAllowed

      public boolean isInsertingAllowed()
      Returns whether items can be inserted into this slot.
      Returns:
      true if items can be inserted, false otherwise
      Since:
      1.10.0
    • setInsertingAllowed

      public void setInsertingAllowed(boolean insertingAllowed)
      Sets whether inserting items into this slot is allowed.
      Parameters:
      insertingAllowed - true if items can be inserted, false otherwise
      Since:
      1.10.0
    • isTakingAllowed

      public boolean isTakingAllowed()
      Returns whether items can be taken from this slot.
      Returns:
      true if items can be taken, false otherwise
      Since:
      1.10.0
    • setTakingAllowed

      public void setTakingAllowed(boolean takingAllowed)
      Sets whether taking items from this slot is allowed.
      Parameters:
      takingAllowed - true if items can be taken, false otherwise
      Since:
      1.10.0
    • getInputFilter

      public Predicate<ItemStack> getInputFilter()
      Gets the item stack input filter of this slot.
      Returns:
      the item input filter
      Since:
      8.1.0
    • setInputFilter

      public void setInputFilter(Predicate<ItemStack> inputFilter)
      Sets the item stack input filter of this slot.
      Parameters:
      inputFilter - the new item input filter
      Since:
      8.1.0
    • getOutputFilter

      public Predicate<ItemStack> getOutputFilter()
      Gets the item stack output filter of this slot.
      Returns:
      the item output filter
      Since:
      8.1.0
    • setOutputFilter

      public void setOutputFilter(Predicate<ItemStack> outputFilter)
      Sets the item stack output filter of this slot.
      Parameters:
      outputFilter - the new item output filter
      Since:
      8.1.0
    • addChangeListener

      public void addChangeListener(WItemSlot owner, WItemSlot.ChangeListener listener)
      Adds a change listener to this slot. Does nothing if the listener is already registered.
      Parameters:
      owner - the owner of this slot
      listener - the listener
      Throws:
      NullPointerException - if either parameter is null
      Since:
      3.0.0
    • isEnabled

      public boolean isEnabled()
      Overrides:
      isEnabled in class Slot
    • isVisible

      public boolean isVisible()
      Tests whether this slot is visible.
      Returns:
      true if this slot is visible, false otherwise
      Since:
      3.0.0
    • setVisible

      public void setVisible(boolean visible)
      Sets whether this slot is visible.
      Parameters:
      visible - true if this slot if visible, false otherwise
      Since:
      3.0.0