GuiPage
Description & Properties
The GuiPage
class is used to represent a single page within a GUI. It contains a list of item stacks that are displayed on the page. The class has the following properties and methods:
content
: A list ofItemStack
objects that represent the items displayed on the page.addItem(itemStack: ItemStack)
: Adds an item stack to the page and returns theGuiPage
object.addItem(itemStack: ItemStack, index: Int)
: Adds an item stack to the page at a specific index and returns theGuiPage
object.removeItem(index: Int)
: Removes an item stack from the page at the specified index and returns theGuiPage
object.removeItem(itemStack: ItemStack)
: Removes a specific item stack from the page and returns theGuiPage
object.filterContent(predicate: (ItemStack) -> Boolean)
: Filters the content of the page based on a predicate and returns theGuiPage
object.getContent(): MutableList<ItemStack>
: Returns the list of item stacks on the page.
Example
You can create a GuiPage
object, add item stacks to it, and manipulate its content using the provided methods. The content
property of the GuiPage
class stores the item stacks that are displayed on the page.
Here is an example of how to create a GuiPage
object in Kotlin:
In this example, we create a GuiPage
object and add item stacks to it. We then remove an item stack at a specific index and remove a specific item stack from the page. Finally, we retrieve the content of the page as a list of item stacks for further processing or display in a GUI.
Summary
The GuiPage
class is a fundamental building block for creating paginated GUIs with multiple pages. By managing the content of each page separately, you can easily organize and display items in a structured manner within your GUIs. The GuiPage
class provides methods to add, remove, and filter item stacks on a page, allowing you to customize the content dynamically based on user interactions or other events.