Package xyz.xenondevs.invui.gui
Interface ScrollGui<C>
- All Superinterfaces:
Gui
- All Known Implementing Classes:
AbstractScrollGui
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidaddScrollHandler(@NotNull BiConsumer<Integer, Integer> scrollHandler) Adds a scroll handler to thisScrollGui.voidbake()Bakes the elements of thisPagedGuibased on the current content.booleancanScroll(int lines) Checks if it is possible to scroll the specified amount of lines.intGets the current line of thisScrollGui.intGets the max line index of thisScrollGui.static @NotNull ScrollGui.Builder<@NotNull Gui> guis()guis(@NotNull Consumer<@NotNull ScrollGui.Builder<@NotNull Gui>> consumer) Creates a newScrollGuithat usesGuisas content after configuring aGui Builderusing the givenConsumer.static @NotNull ScrollGui.Builder<@NotNull Inventory> inventories(@NotNull Consumer<@NotNull ScrollGui.Builder<@NotNull Inventory>> consumer) Creates a newScrollGuithat usesVirtualInventoriesas content after configuring aGui Builderusing the givenConsumer.static @NotNull ScrollGui.Builder<@NotNull Item> items()items(@NotNull Consumer<@NotNull ScrollGui.Builder<@NotNull Item>> consumer) Creates a newScrollGuithat usesItemsas content after configuring aGui Builderusing 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.voidremoveScrollHandler(@NotNull BiConsumer<Integer, Integer> scrollHandler) Removes the specified scroll handler from thisScrollGui.voidscroll(int lines) Scrolls the specified amount of lines.voidsetContent(@Nullable List<@NotNull C> content) Sets the content of thisScrollGuifor all lines.voidsetCurrentLine(int line) Sets the current line of thisScrollGui.voidsetScrollHandlers(@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 newScrollGuithat usesItemsas content after configuring aGui Builderusing the givenConsumer.- Parameters:
consumer- TheConsumerto 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 newScrollGuithat usesGuisas content after configuring aGui Builderusing the givenConsumer.- Parameters:
consumer- TheConsumerto 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 newScrollGuithat usesVirtualInventoriesas content after configuring aGui Builderusing the givenConsumer.- Parameters:
consumer- TheConsumerto 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- TheVirtualInventoriesto 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- TheStructureto use.inventories- TheVirtualInventoriesto 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 thisScrollGuifor all lines.- Parameters:
content- The content to set.
-
bake
void bake()Bakes the elements of thisPagedGuibased 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.
-