Class PatternPane
java.lang.Object
com.github.stefvanschie.inventoryframework.pane.Pane
com.github.stefvanschie.inventoryframework.pane.PatternPane
A pattern pane allows you to specify a textual pattern and assign items to individual characters.
- Since:
- 0.9.8
-
Nested Class Summary
Nested classes/interfaces inherited from class com.github.stefvanschie.inventoryframework.pane.Pane
Pane.Priority -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionPatternPane(int x, int y, int length, int height, @NotNull Pane.Priority priority, @NotNull Pattern pattern) Constructs a new pattern pane.PatternPane(int x, int y, int length, int height, @NotNull Pattern pattern) Constructs a new pattern pane.PatternPane(int length, int height, @NotNull Pattern pattern) Constructs a new pattern pane, with no position.PatternPane(@NotNull Slot slot, int length, int height, @NotNull Pane.Priority priority, @NotNull Pattern pattern) Constructs a new pattern pane.PatternPane(@NotNull Slot slot, int length, int height, @NotNull Pattern pattern) Constructs a new pattern pane. -
Method Summary
Modifier and TypeMethodDescriptionvoidBinds a character to a specific item or if the character was already bound, this overwrites the previously binding with the provided one.voidBinds a character to a specific item or if the character was already bound, this overwrites the previously binding with the provided one.voidclear()Clears the entire pane of any items/panes.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 PatternPanecopy()Makes a copy of this pane and returns it.voiddisplay(@NotNull InventoryComponent inventoryComponent, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) Has to set all the items in the right spot inside the inventoryvoidflipHorizontally(boolean flipHorizontally) Sets whether this pane should flip its items horizontallyvoidflipVertically(boolean flipVertically) Sets whether this pane should flip its items vertically@NotNull Collection<GuiItem> getItems()Gets all the items in this pane and all underlying panes.@NotNull Collection<Pane> getPanes()Gets all the panes in this panes, including any child panes from other panes.@NotNull PatternGets the pattern.intGets the rotation specified to this pane.booleanGets whether this pane's items are flipped horizontallybooleanGets whether this pane's items are flipped verticallystatic @NotNull PatternPaneDeprecated.static @NotNull PatternPaneLoads a pattern pane from a given elementvoidsetHeight(int height) Set the height of this panevoidsetLength(int length) Set the length of this panevoidsetPattern(@NotNull Pattern pattern) Overrides the pattern set on this pane.voidsetRotation(int rotation) Sets the rotation of this pane.Methods inherited from class com.github.stefvanschie.inventoryframework.pane.Pane
callOnClick, createBorder, createBorder, findMatchingItem, getHeight, getLength, getPriority, getSlot, getUUID, getX, getY, isVisible, load, loadItem, loadItem, matchesItem, registerProperty, setOnClick, setPriority, setSlot, setVisible, setX, setY
-
Constructor Details
-
PatternPane
public PatternPane(@NotNull @NotNull Slot slot, int length, int height, @NotNull @NotNull Pane.Priority priority, @NotNull @NotNull Pattern pattern) Constructs a new pattern pane.- Parameters:
slot- the slot of the panelength- the length of the paneheight- the height of the panepriority- the priority of the panepattern- the pattern of the pane- Throws:
IllegalArgumentException- when the pane and pattern dimensions don't match- Since:
- 0.10.8
-
PatternPane
public PatternPane(int x, int y, int length, int height, @NotNull @NotNull Pane.Priority priority, @NotNull @NotNull Pattern pattern) Constructs a new pattern pane.- Parameters:
x- the upper left x coordinate of the paney- the upper left y coordinate of the panelength- the length of the paneheight- the height of the panepriority- the priority of the panepattern- the pattern of the pane- Throws:
IllegalArgumentException- when the pane and pattern dimensions don't match- Since:
- 0.9.8
-
PatternPane
Constructs a new pattern pane, with no position.- Parameters:
length- the length of the paneheight- the height of the panepattern- the pattern of the pane- Throws:
IllegalArgumentException- when the pane and pattern dimensions don't match- Since:
- 0.9.8
-
PatternPane
public PatternPane(@NotNull @NotNull Slot slot, int length, int height, @NotNull @NotNull Pattern pattern) Constructs a new pattern pane.- Parameters:
slot- the slot of the panelength- the length of the paneheight- the height of the panepattern- the pattern of the pane- Throws:
IllegalArgumentException- when the pane and pattern dimensions don't match- Since:
- 0.10.8
-
PatternPane
Constructs a new pattern pane.- Parameters:
x- the upper left x coordinate of the paney- the upper left y coordinate of the panelength- the length of the paneheight- the height of the panepattern- the pattern of the pane- Throws:
IllegalArgumentException- when the pane and pattern dimensions don't match- Since:
- 0.9.8
-
-
Method Details
-
display
public void display(@NotNull @NotNull InventoryComponent inventoryComponent, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) Description copied from class:PaneHas to set all the items in the right spot inside the inventory- Specified by:
displayin classPane- Parameters:
inventoryComponent- the inventory component in which the items should be displayedpaneOffsetX- the pane's offset on the x axispaneOffsetY- the pane's offset on the y axismaxLength- the maximum length of the panemaxHeight- the maximum height of the pane
-
click
public boolean click(@NotNull @NotNull Gui gui, @NotNull @NotNull InventoryComponent inventoryComponent, @NotNull @NotNull InventoryClickEvent event, int slot, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) Description copied from class:PaneCalled whenever there is being clicked on this pane- Specified by:
clickin classPane- Parameters:
gui- the gui in which was clickedinventoryComponent- the inventory component in which this pane residesevent- the event that occurred while clicking on this itemslot- the slot that was clicked inpaneOffsetX- the pane's offset on the x axispaneOffsetY- the pane's offset on the y axismaxLength- the maximum length of the panemaxHeight- the maximum height of the pane- Returns:
- whether the item was found or not
-
copy
Description copied from class:PaneMakes 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. -
setRotation
public void setRotation(int rotation) Description copied from interface:RotatableSets the rotation of this pane. The rotation is in degrees and can only be in increments of 90. Anything higher than 360, will be lowered to a value in between [0, 360) while maintaining the same rotational value. E.g. 450 degrees becomes 90 degrees, 1080 degrees becomes 0, etc. This method fails for any pane that has a length and height which are unequal.- Specified by:
setRotationin interfaceRotatable- Parameters:
rotation- the rotation of this pane, must be divisible by 90.
-
getItems
Gets 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.) This only returns the items for which their binding also appears in the given pattern. An item bound to 'x', where 'x' does not appear in the pattern will not be returned. -
setPattern
Overrides the pattern set on this pane.- Parameters:
pattern- the new pattern to set- Throws:
IllegalArgumentException- when the pane and pattern dimensions don't match- Since:
- 0.9.8
-
setHeight
public void setHeight(int height) Description copied from class:PaneSet the height of this pane -
setLength
public void setLength(int length) Description copied from class:PaneSet the length of this pane -
bindItem
Binds a character to a specific item or if the character was already bound, this overwrites the previously binding with the provided one. To bind characters above the 16-bit range, seebindItem(int, GuiItem).- Parameters:
character- the characteritem- the item this represents- Since:
- 0.9.8
-
bindItem
Binds a character to a specific item or if the character was already bound, this overwrites the previously binding with the provided one.- Parameters:
character- the characteritem- the item this represents- Since:
- 0.9.8
- See Also:
-
clear
public void clear()Description copied from class:PaneClears the entire pane of any items/panes. Underlying panes will not be cleared. -
flipHorizontally
public void flipHorizontally(boolean flipHorizontally) Description copied from interface:FlippableSets whether this pane should flip its items horizontally- Specified by:
flipHorizontallyin interfaceFlippable- Parameters:
flipHorizontally- whether the pane should flip items horizontally
-
flipVertically
public void flipVertically(boolean flipVertically) Description copied from interface:FlippableSets whether this pane should flip its items vertically- Specified by:
flipVerticallyin interfaceFlippable- Parameters:
flipVertically- whether the pane should flip items vertically
-
getPanes
Description copied from class:PaneGets 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.) -
getPattern
Gets the pattern.- Returns:
- the pattern
- Since:
- 0.9.8
-
isFlippedHorizontally
public boolean isFlippedHorizontally()Description copied from interface:FlippableGets whether this pane's items are flipped horizontally- Specified by:
isFlippedHorizontallyin interfaceFlippable- Returns:
- true if the items are flipped horizontally, false otherwise
-
isFlippedVertically
public boolean isFlippedVertically()Description copied from interface:FlippableGets whether this pane's items are flipped vertically- Specified by:
isFlippedVerticallyin interfaceFlippable- Returns:
- true if the items are flipped vertically, false otherwise
-
getRotation
public int getRotation()Description copied from interface:RotatableGets the rotation specified to this pane. If no rotation has been set, or if this pane is not capable of having a rotation, 0 is returned.- Specified by:
getRotationin interfaceRotatable- Returns:
- the rotation for this pane
-
load
@NotNull public static @NotNull PatternPane load(@NotNull @NotNull Object instance, @NotNull @NotNull Element element, @NotNull @NotNull Plugin plugin) Loads a pattern pane from a given element- Parameters:
instance- the instance classelement- the elementplugin- the plugin that will own the underlying items- Returns:
- the pattern pane
- Since:
- 0.10.8
-
load
@NotNull @Deprecated public static @NotNull PatternPane load(@NotNull @NotNull Object instance, @NotNull @NotNull Element element) Deprecated.this method is no longer used internally and has been superseded byload(Object, Element, Plugin)Loads a pattern pane from a given element- Parameters:
instance- the instance classelement- the element- Returns:
- the pattern pane
-
load(Object, Element, Plugin)