Class AbstractGUIElement

java.lang.Object
me.eddie.inventoryguiapi.gui.elements.AbstractGUIElement
All Implemented Interfaces:
GUIElement
Direct Known Subclasses:
ActionItem, InputSlot, LabelItem

public abstract class AbstractGUIElement extends Object implements GUIElement
A basic and incomplete implementation of GUIElement that provides code for managing the desired slot for a GUIElement.
  • Field Details

    • NO_DESIRED_SLOT

      public static final int NO_DESIRED_SLOT
      The value of slot that, internally, indicates that the element has no desired slot. This shouldn't be relied on, use of hasDesiredDisplayPosition() should be used instead
      See Also:
  • Constructor Details

    • AbstractGUIElement

      public AbstractGUIElement()
    • AbstractGUIElement

      public AbstractGUIElement(int slot)
  • Method Details

    • setHasDesiredDisplayPosition

      public void setHasDesiredDisplayPosition(boolean has)
      Sets if this GUIElement has a desired display position. True will indicate that it has, false will indicate it hasn't
      Parameters:
      has - Whether or not it has a desired display position
    • setDesiredDisplayPosition

      public void setDesiredDisplayPosition(int slot)
      Sets the desired display position of this GUIElement. Will also make hasDesiredDisplayPosition() be true
      Parameters:
      slot - The slot in the GUI to make this element's desired display position
    • hasDesiredDisplayPosition

      public boolean hasDesiredDisplayPosition()
      Description copied from interface: GUIElement
      Returns true if this element has a specific place it wants to be placed in a GUI or false if it doesn't matter. (Insertion order is then used)
      Specified by:
      hasDesiredDisplayPosition in interface GUIElement
      Returns:
      True if element has desired display position, False otherwise
    • getDesiredDisplayPosition

      public int getDesiredDisplayPosition()
      Description copied from interface: GUIElement
      Return the desired display position of this GUI Element in the inventory. If GUIElement.hasDesiredDisplayPosition() is false this is ignored, otherwise it is used when calculating an inventory to be displayed. The slot number returned should be greater than or equal to 0 and less than the maximum size of the inventory it's being inserted into
      Specified by:
      getDesiredDisplayPosition in interface GUIElement
      Returns:
      The desired display position of the GUIElement