Package xyz.xenondevs.invui.gui
Interface ScrollGui<C>
- All Superinterfaces:
Gui
- All Known Implementing Classes:
AbstractScrollGui
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addScrollHandler
(@NotNull BiConsumer<Integer, Integer> scrollHandler) Adds a scroll handler to thisScrollGui
.void
bake()
Bakes the elements of thisPagedGui
based on the current content.boolean
canScroll
(int lines) Checks if it is possible to scroll the specified amount of lines.int
Gets the current line of thisScrollGui
.int
Gets the max line index of thisScrollGui
.static @NotNull ScrollGui.Builder
<@NotNull Gui> guis()
guis
(@NotNull Consumer<@NotNull ScrollGui.Builder<@NotNull Gui>> consumer) Creates a newScrollGui
that usesGuis
as content after configuring aGui Builder
using the givenConsumer
.static @NotNull ScrollGui.Builder
<@NotNull Inventory> inventories
(@NotNull Consumer<@NotNull ScrollGui.Builder<@NotNull Inventory>> consumer) Creates a newScrollGui
that usesVirtualInventories
as content after configuring aGui Builder
using the givenConsumer
.static @NotNull ScrollGui.Builder
<@NotNull Item> items()
items
(@NotNull Consumer<@NotNull ScrollGui.Builder<@NotNull Item>> consumer) Creates a newScrollGui
that usesItems
as content after configuring aGui Builder
using the givenConsumer
.Creates a newScrollGui
.Creates a newScrollGui
.ofInventories
(int width, int height, @NotNull List<@NotNull Inventory> inventories, int... contentListSlots) Creates a newScrollGui
.ofInventories
(@NotNull Structure structure, @NotNull List<@NotNull Inventory> inventories) Creates a newScrollGui
.Creates a newScrollGui
.Creates a newScrollGui
.void
removeScrollHandler
(@NotNull BiConsumer<Integer, Integer> scrollHandler) Removes the specified scroll handler from thisScrollGui
.void
scroll
(int lines) Scrolls the specified amount of lines.void
setContent
(@Nullable List<@NotNull C> content) Sets the content of thisScrollGui
for all lines.void
setCurrentLine
(int line) Sets the current line of thisScrollGui
.void
setScrollHandlers
(@NotNull List<@NotNull BiConsumer<Integer, Integer>> scrollHandlers) Replaces the currently registered scroll handlers with the specified ones.Methods inherited from interface xyz.xenondevs.invui.gui.Gui
addItems, addSlotElements, applyStructure, cancelAnimation, closeForAllViewers, fill, fill, fillBorders, fillColumn, fillRectangle, fillRectangle, fillRectangle, fillRectangle, fillRow, findAllCurrentViewers, findAllWindows, getBackground, getHeight, getItem, getItem, getSize, getSlotElement, getSlotElement, getSlotElements, getWidth, hasSlotElement, hasSlotElement, isFrozen, isIgnoreObscuredInventorySlots, playAnimation, remove, remove, setBackground, setFrozen, setIgnoreObscuredInventorySlots, setItem, setItem, setSlotElement, setSlotElement
-
Method Details
-
items
- Returns:
- The new
Gui Builder
.
-
items
@NotNull static @NotNull ScrollGui<@NotNull Item> items(@NotNull @NotNull Consumer<@NotNull ScrollGui.Builder<@NotNull Item>> consumer) Creates a newScrollGui
that usesItems
as content after configuring aGui Builder
using the givenConsumer
.- Parameters:
consumer
- TheConsumer
to configure theGui Builder
.- Returns:
- The created
ScrollGui
.
-
ofItems
@NotNull static @NotNull ScrollGui<@NotNull Item> ofItems(int width, int height, @NotNull @NotNull List<@NotNull Item> items, int... contentListSlots) Creates a newScrollGui
. -
ofItems
@NotNull static @NotNull ScrollGui<@NotNull Item> ofItems(@NotNull @NotNull Structure structure, @NotNull @NotNull List<@NotNull Item> items) Creates a newScrollGui
. -
guis
- Returns:
- The new
Gui Builder
.
-
guis
@NotNull static @NotNull ScrollGui<@NotNull Gui> guis(@NotNull @NotNull Consumer<@NotNull ScrollGui.Builder<@NotNull Gui>> consumer) Creates a newScrollGui
that usesGuis
as content after configuring aGui Builder
using the givenConsumer
.- Parameters:
consumer
- TheConsumer
to configure theGui Builder
.- Returns:
- The created
ScrollGui
.
-
ofGuis
@NotNull static @NotNull ScrollGui<@NotNull Gui> ofGuis(int width, int height, @NotNull @NotNull List<@NotNull Gui> guis, int... contentListSlots) Creates a newScrollGui
. -
ofGuis
@NotNull static @NotNull ScrollGui<@NotNull Gui> ofGuis(Structure structure, @NotNull @NotNull List<@NotNull Gui> guis) Creates a newScrollGui
. -
inventories
- Returns:
- The new
Gui Builder
.
-
inventories
@NotNull static @NotNull ScrollGui<@NotNull Inventory> inventories(@NotNull @NotNull Consumer<@NotNull ScrollGui.Builder<@NotNull Inventory>> consumer) Creates a newScrollGui
that usesVirtualInventories
as content after configuring aGui Builder
using the givenConsumer
.- Parameters:
consumer
- TheConsumer
to configure theGui Builder
.- Returns:
- The created
ScrollGui
.
-
ofInventories
@NotNull static @NotNull ScrollGui<@NotNull Inventory> ofInventories(int width, int height, @NotNull @NotNull List<@NotNull Inventory> inventories, int... contentListSlots) Creates a newScrollGui
.- Parameters:
width
- The width of theScrollGui
.height
- The height of theScrollGui
.inventories
- TheVirtualInventories
to use.contentListSlots
- The slots where content should be displayed.- Returns:
- The created
ScrollGui
.
-
ofInventories
@NotNull static @NotNull ScrollGui<@NotNull Inventory> ofInventories(@NotNull @NotNull Structure structure, @NotNull @NotNull List<@NotNull Inventory> inventories) Creates a newScrollGui
.- Parameters:
structure
- TheStructure
to use.inventories
- TheVirtualInventories
to use.- Returns:
- The created
ScrollGui
.
-
getCurrentLine
int getCurrentLine()Gets the current line of thisScrollGui
.- Returns:
- The current line of this
ScrollGui
.
-
getMaxLine
int getMaxLine()Gets the max line index of thisScrollGui
.- Returns:
- The max line index of this
ScrollGui
.
-
setCurrentLine
void setCurrentLine(int line) Sets the current line of thisScrollGui
.- Parameters:
line
- The line to set.
-
canScroll
boolean canScroll(int lines) Checks if it is possible to scroll the specified amount of lines.- Parameters:
lines
- The amount of lines to check.- Returns:
- Whether it is possible to scroll the specified amount of lines.
-
scroll
void scroll(int lines) Scrolls the specified amount of lines.- Parameters:
lines
- The amount of lines to scroll.
-
setContent
Sets the content of thisScrollGui
for all lines.- Parameters:
content
- The content to set.
-
bake
void bake()Bakes the elements of thisPagedGui
based on the current content.This method does not need to be called when using
setContent(List)
, but is required when the size of the content itself changes. -
setScrollHandlers
Replaces the currently registered scroll handlers with the specified ones.- Parameters:
scrollHandlers
- The new scroll handlers.
-
addScrollHandler
Adds a scroll handler to thisScrollGui
.- Parameters:
scrollHandler
- The scroll handler to add.
-
removeScrollHandler
Removes the specified scroll handler from thisScrollGui
.- Parameters:
scrollHandler
- The scroll handler to remove.
-