Class Pane
java.lang.Object
com.github.stefvanschie.inventoryframework.pane.Pane
- Direct Known Subclasses:
- CycleButton,- MasonryPane,- OutlinePane,- PaginatedPane,- PatternPane,- StaticPane,- ToggleButton,- VariableBar
The base class for all panes.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumAn enum representing the rendering priorities for the panes.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected intLength is horizontal, height is verticalprotected intLength is horizontal, height is verticalprotected @Nullable Consumer<InventoryClickEvent>The consumer that will be called once a players clicks in this paneprotected UUIDA unique identifier for panes to locate them byprotected intThe starting position of this pane, which is 0 by defaultprotected intThe starting position of this pane, which is 0 by default
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedPane(int length, int height) Constructs a new default pane, with no positionprotectedPane(int x, int y, int length, int height) Constructs a new default paneprotectedPane(int x, int y, int length, int height, @NotNull Pane.Priority priority) Constructs a new default pane
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidcallOnClick(@NotNull InventoryClickEvent event) Calls the consumer (if it's not null) that was specified usingsetOnClick(Consumer), so the consumer that should be called whenever this pane is clicked in.abstract voidclear()Clears the entire pane of any items/panes.abstract booleanclick(@NotNull Gui gui, @NotNull InventoryComponent inventoryComponent, @NotNull InventoryClickEvent event, int slot, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) Called whenever there is being clicked on this pane@NotNull Panecopy()Makes a copy of this pane and returns it.abstract voiddisplay(@NotNull InventoryComponent inventoryComponent, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) Has to set all the items in the right spot inside the inventoryprotected static <T extends GuiItem>
 TfindMatchingItem(@NotNull Collection<T> items, @NotNull ItemStack item) intReturns the height of this paneabstract @NotNull Collection<GuiItem>getItems()Gets all the items in this pane and all underlying panes.intReturns the length of this paneabstract @NotNull Collection<Pane>getPanes()Gets all the panes in this panes, including any child panes from other panes.@NotNull Pane.PriorityReturns the priority of the pane@NotNull UUIDgetUUID()Gets theUUIDassociated with this pane.intgetX()Gets the x coordinate of this paneintgetY()Gets the y coordinate of this panebooleanReturns the pane's visibility statestatic voidstatic @NotNull GuiItemLoads an item from an instance and an elementstatic voidregisterProperty(@NotNull String attributeName, @NotNull Function<String, Object> function) Registers a property that can be used inside an XML file to add additional new properties.voidsetHeight(int height) Set the height of this panevoidsetLength(int length) Set the length of this panevoidsetOnClick(@Nullable Consumer<InventoryClickEvent> onClick) Set the consumer that should be called whenever this pane is clicked in.voidsetPriority(@NotNull Pane.Priority priority) Sets the priority of this panevoidsetVisible(boolean visible) Sets whether this pane is visible or notvoidsetX(int x) Set the x coordinate of this panevoidsetY(int y) Set the y coordinate of this pane
- 
Field Details- 
xprotected int xThe starting position of this pane, which is 0 by default
- 
yprotected int yThe starting position of this pane, which is 0 by default
- 
lengthprotected int lengthLength is horizontal, height is vertical
- 
heightprotected int heightLength is horizontal, height is vertical
- 
onClickThe consumer that will be called once a players clicks in this pane
- 
uuidA unique identifier for panes to locate them by
 
- 
- 
Constructor Details- 
PaneConstructs a new default pane- Parameters:
- x- the upper left x coordinate of the pane
- y- the upper left y coordinate of the pane
- length- the length of the pane
- height- the height of the pane
- priority- the priority of the pane
 
- 
Paneprotected Pane(int length, int height) Constructs a new default pane, with no position- Parameters:
- length- the length of the pane
- height- the height of the pane
 
- 
Paneprotected Pane(int x, int y, int length, int height) Constructs a new default pane- Parameters:
- x- the upper left x coordinate of the pane
- y- the upper left y coordinate of the pane
- length- the length of the pane
- height- the height of the pane
 
 
- 
- 
Method Details- 
copyMakes a copy of this pane and returns it. This makes a deep copy of the pane. This entails that the underlying panes and/or items will be copied as well. The returned pane will never be reference equal to the current pane.- Returns:
- a copy of this pane
- Since:
- 0.6.2
 
- 
setLengthpublic void setLength(int length) Set the length of this pane- Parameters:
- length- the new length
 
- 
setHeightpublic void setHeight(int height) Set the height of this pane- Parameters:
- height- the new height
 
- 
setXpublic void setX(int x) Set the x coordinate of this pane- Parameters:
- x- the new x coordinate
 
- 
setYpublic void setY(int y) Set the y coordinate of this pane- Parameters:
- y- the new y coordinate
 
- 
getLength@Contract(pure=true) public int getLength()Returns the length of this pane- Returns:
- the length
 
- 
getHeight@Contract(pure=true) public int getHeight()Returns the height of this pane- Returns:
- the height
 
- 
getUUIDGets theUUIDassociated with this pane.- Returns:
- the uuid
- Since:
- 0.7.1
 
- 
getX@Contract(pure=true) public int getX()Gets the x coordinate of this pane- Returns:
- the x coordinate
 
- 
getY@Contract(pure=true) public int getY()Gets the y coordinate of this pane- Returns:
- the y coordinate
 
- 
displaypublic abstract void display(@NotNull @NotNull InventoryComponent inventoryComponent, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) Has to set all the items in the right spot inside the inventory- Parameters:
- inventoryComponent- the inventory component in which the items should be displayed
- paneOffsetX- the pane's offset on the x axis
- paneOffsetY- the pane's offset on the y axis
- maxLength- the maximum length of the pane
- maxHeight- the maximum height of the pane
 
- 
isVisible@Contract(pure=true) public boolean isVisible()Returns the pane's visibility state- Returns:
- the pane's visibility
 
- 
setVisiblepublic void setVisible(boolean visible) Sets whether this pane is visible or not- Parameters:
- visible- the pane's visibility
 
- 
clickpublic abstract boolean click(@NotNull @NotNull Gui gui, @NotNull @NotNull InventoryComponent inventoryComponent, @NotNull @NotNull InventoryClickEvent event, int slot, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) Called whenever there is being clicked on this pane- Parameters:
- gui- the gui in which was clicked
- inventoryComponent- the inventory component in which this pane resides
- event- the event that occurred while clicking on this item
- slot- the slot that was clicked in
- paneOffsetX- the pane's offset on the x axis
- paneOffsetY- the pane's offset on the y axis
- maxLength- the maximum length of the pane
- maxHeight- the maximum height of the pane
- Returns:
- whether the item was found or not
 
- 
setPrioritySets the priority of this pane- Parameters:
- priority- the priority
 
- 
loadItem@NotNull @Contract(pure=true) public static @NotNull GuiItem loadItem(@NotNull @NotNull Object instance, @NotNull @NotNull Element element) Loads an item from an instance and an element- Parameters:
- instance- the instance
- element- the element
- Returns:
- the gui item
 
- 
load
- 
findMatchingItem@Nullable @Contract(pure=true) protected static <T extends GuiItem> T findMatchingItem(@NotNull @NotNull Collection<T> items, @NotNull @NotNull ItemStack item) Finds a type ofGuiItemfrom the provided collection of items based on the providedItemStack. The items will be compared using internal data. When the item does not have this data, this method will return null. If the item does have such data, but its value cannot be found in the provided list, null is also returned. This method will not mutate any of the provided arguments, nor any of the contents inside of the arguments. The provided collection may be unmodifiable if preferred. This method will always return a type ofGuiItemthat is in the provided collection - when the returned result is not null - such that an element E inside the provided collection reference equals the returned type ofGuiItem.- Type Parameters:
- T- a type of GuiItem, which will be used in the provided collection and as return type
- Parameters:
- items- a collection of items in which will be searched
- item- the item for which an- GuiItemshould be found
- Returns:
- the found type of GuiItemor null if none was found
- Since:
- 0.5.14
 
- 
getPriorityReturns the priority of the pane- Returns:
- the priority
 
- 
getItemsGets all the items in this pane and all underlying panes. The returned collection is not guaranteed to be mutable or to be a view of the underlying data. (So changes to the gui are not guaranteed to be visible in the returned value.)- Returns:
- all items
 
- 
getPanesGets all the panes in this panes, including any child panes from other panes. The returned collection is not guaranteed to be mutable or to be a view of the underlying data. (So changes to the gui are not guaranteed to be visible in the returned value.)- Returns:
- all panes
 
- 
clearpublic abstract void clear()Clears the entire pane of any items/panes. Underlying panes will not be cleared.- Since:
- 0.3.2
 
- 
setOnClickSet the consumer that should be called whenever this pane is clicked in.- Parameters:
- onClick- the consumer that gets called
- Since:
- 0.4.0
 
- 
callOnClickCalls the consumer (if it's not null) that was specified usingsetOnClick(Consumer), so the consumer that should be called whenever this pane is clicked in. Catches and logs all exceptions the consumer might throw.- Parameters:
- event- the event to handle
- Since:
- 0.6.0
 
- 
registerPropertypublic static void registerProperty(@NotNull @NotNull String attributeName, @NotNull @NotNull Function<String, Object> function) Registers a property that can be used inside an XML file to add additional new properties. The use ofGui.registerProperty(String, Function)is preferred over this method.- Parameters:
- attributeName- the name of the property. This is the same name you'll be using to specify the property type in the XML file.
- function- how the property should be processed. This converts the raw text input from the XML node value into the correct object type.
- Throws:
- IllegalArgumentException- when a property with this name is already registered.
 
 
-