Cookbook
Four patterns to adapt. Each lists the layouts involved and the fields to set in the Open GUI entry.
1. Scrollable list with arrows
Layouts: composite, scrollable, two simple.
- Create a
simplelayoutlist_contentholding the rows of the list. It can be taller than the window: put items aty0 to 14. - Create a
scrollablelayoutlist_scrollwithinnerIdlist_content,virtualWidth9 andvirtualHeight15. - In its
buttons, add adirectionUPbutton atx8,y0 and aDOWNbutton atx8,y5, each withstep1 and an arrow item. - Create a
simplelayoutborderwith a glass pane atx8,y1,count4,directiondown,displayNamea single space. - Create a
compositelayoutmainwithchildrenlist_scrollthenborder, and setmainLayoutIdtomain.
The buttons stay anchored to the window and disappear when there is nothing left to scroll in their direction.
2. Paginated list
Layouts: composite, simple, paginated.
- Create a
paginatedlayoutshopwithitemsPerPage21 andslots10 to 16, 19 to 25 and 28 to 34. - Add one item per product to
items, with aLEFT_CLICKinteraction that runs your command or trigger. - In
navigationButtons, add aPREVIOUSbutton atx0,y5, aNEXTbutton atx8,y5 and anINDICATORatx4,y5 with the name<gray>{page_indicator}. - Put a
simplelayout with the border in acompositebelow it.
For a real shop with prices and stock, use Shops, which fills a paginated layout for you.
3. Confirmation menu
Shows closeMenu, executeReturn and the session history.
- Open the confirmation from the dangerous button: add a
gui:open <confirm menu entry id>command to its interaction, or link the Open GUI entry intriggers. - Create an Open GUI with
guiTypeCUSTOM,sizeSIZE_27and asimplelayout. - Add a green wool at
x2,y1 with aLEFT_CLICKinteraction running the command andcloseMenuenabled. - Add a red wool at
x6,y1 with aLEFT_CLICKinteraction andexecuteReturnenabled. It returns to whichever menu opened this one.
4. Quota deposit
Shows storage slots, a required item and a trigger.
- Create a GUI Storage artifact.
- In the Open GUI
storagePool, add a configuration with anidsuch asiron_bank, the artifact inentry,requiredIteman iron ingot,requiredAmount32 and the unlock entry inonReachRequired. Setplaceholderto a gray glass pane. - In a
simplelayout, add an item atx4,y1 withstorageIdiron_bank. Its name and lore can use{stored_name},{stored_amount}and{stored_max}.
Leave group empty for per-player storage, or choose a group entry (an island, a guild) to share the storage.
Tips
- Layer order in a
compositeis draw order: background first, buttons last. - Give every scrollable and paginated layout a unique
id. - Use
criteriaon items to show or hide buttons per player. - Set the
displayNameof decorative panes to a single space to hide the vanilla item name.