Understand a GUI menu
The GUI extension does not require every slot to be placed in code. Describe a layout tree, then the engine creates a player session and renders the visible part of the menu.
The complete flow
- An
open_guientry is triggered by a quest, NPC, command, or another extension. layoutPoolcontains named layouts.mainLayoutIdselects the root layout.- The engine creates a session for the player.
- Clicks, page changes, and scrolling update that session.
Vocabulary
| Term | Practical meaning |
|---|---|
open_gui | Action that opens the menu and carries its main options. |
| Menu | Visible window, title, container, and player session. |
| Layout | Composition rule that produces positions and components. |
| Component | Item, button, frame, or child layout placed in the menu. |
layoutPool | List of layouts referenced by identifier. |
mainLayoutId | Identifier of the starting layout. |
| Viewport | Area actually visible to the player. |
| Virtual area | Complete logical area of a scrollable layout. |
GuiItem | Visual item with appearance, permissions, and interactions. |
| Session | Player state: active view, history, page, and scroll position. |
Create a first menu
In the web interface:
- Create an
open_guientry namedmy_first_menu. - Choose
guiType: CHEST, a suitable size, and atitle. - Add a
simplelayout with the identifiermain. - Select
maininmainLayoutId. - Add a
GuiItematx: 4,y: 1. - Set its
item,displayName, andlore. - Add a
LEFTinteraction. - Enable
closeMenuif the button must close the menu after its action.
In practice
Start with one simple layout. Add composite, frame, scrollable, or paginated after the simple menu works.
Repeat a slot
count, direction, gap, and repeatY repeat a component. For example, one item can create a row of nine panes with count: 9 and a horizontal direction. These fields do not change the Minecraft item stack size.
If direction is not set, count, gap, and repeatY do not create a useful repetition. Negative or unsupported coordinates are rejected by the parser.
Control visibility and clicks
viewPermissionhides the slot when the player lacks the permission.clickPermissionleaves the slot visible but prevents activation.criteriacan add a functional condition.allowPickupcontrols whether the player can take the item.
This distinction lets you show a locked button without making it usable.
Open, go back, and close
- Another entry can trigger
OpenGuiAction. executeReturnadds the internalgui:backaction.closeMenuadds the internalgui:closeaction.- A command or extension can also trigger navigation when it registers the corresponding handler.