Class AbstractGUIElement
java.lang.Object
me.eddie.inventoryguiapi.gui.elements.AbstractGUIElement
- All Implemented Interfaces:
GUIElement
- Direct Known Subclasses:
ActionItem,InputSlot,LabelItem
A basic and incomplete implementation of GUIElement that provides code for managing the desired slot for a GUIElement.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe value of slot that, internally, indicates that the element has no desired slot. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturn the desired display position of this GUI Element in the inventory.booleanReturns true if this element has a specific place it wants to be placed in a GUI or false if it doesn't matter.voidsetDesiredDisplayPosition(int slot) Sets the desired display position of this GUIElement.voidsetHasDesiredDisplayPosition(boolean has) Sets if this GUIElement has a desired display position.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface me.eddie.inventoryguiapi.gui.elements.GUIElement
canAutoInsertIntoSlot, getDisplay, getFormImage, onEvent
-
Field Details
-
NO_DESIRED_SLOT
public static final int NO_DESIRED_SLOTThe value of slot that, internally, indicates that the element has no desired slot. This shouldn't be relied on, use ofhasDesiredDisplayPosition()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 makehasDesiredDisplayPosition()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:GUIElementReturns 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:
hasDesiredDisplayPositionin interfaceGUIElement- Returns:
- True if element has desired display position, False otherwise
-
getDesiredDisplayPosition
public int getDesiredDisplayPosition()Description copied from interface:GUIElementReturn the desired display position of this GUI Element in the inventory. IfGUIElement.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:
getDesiredDisplayPositionin interfaceGUIElement- Returns:
- The desired display position of the GUIElement
-