GuiContext
A context class that provides a more declarative DSL for building GUIs. This class also supports state management.
Example usage:
val gui = inventory(3, Component.text("My GUI")) {
var counter by state(0)
slot(SLOT_2_5) {
icon(Material.DIAMOND)
name(Component.text("Clicked $counter times"))
onClick {
counter++ // This automatically triggers update()
}
}
}
gui.open(player)Content copied to clipboard
Inheritors
Types
Properties
Functions
Link copied to clipboard
Builds the GUI. This is where you define slots and states.
Builds the GUI using the provided GuiCreator.
Link copied to clipboard
Fills all slots in the GUI with a material.
Link copied to clipboard
Fills the border of the GUI with a material.
Link copied to clipboard
fun fillRect(s1: Slot, s2: Slot, material: Material, pickable: Boolean = false, creator: SlotCreator.() -> Unit = {})
Fills a rectangular area defined by two slots with a material.
fun fillRect(x1: Int, y1: Int, x2: Int, y2: Int, material: Material, pickable: Boolean = false, creator: SlotCreator.() -> Unit = {})
Fills a rectangular area of the GUI with a material.
Link copied to clipboard
Configures a slot by a Slot instance.
Configures a slot by its raw index (0-indexed).
Configures a slot by its X and Y coordinates (1-indexed).
Link copied to clipboard
Includes another builder block as a template.