Перейти к основному содержимому

Layouts, frames, and slots

A layout is a composition component. It receives an identifier in layoutPool; other layouts find it through that identifier.

Choose the right layout

LayoutUse it forImportant fields or elements
simpleStatic menu, decoration, fixed buttonsid, items, x, y
flexAlignement automatique et contenu adaptablejustifyContent, alignItems, wrap, virtualHeight
paginatedList split across several pagesitemsPerPage, slots, navigationButtons
scrollableContent larger than the windowinnerId, virtualWidth, virtualHeight, buttons
frameSeveral independent areasframes, layoutId, x, y, width, height
compositeSuperposer plusieurs coucheschildren, ordre des enfants
bookPages d’un livrepages et GuiType: BOOK
merchantTrades Minecrafttrades et GuiType: MERCHANT
storageItems persistantsentry, groupKey, slots
leaderboardRanking built from Typewriter factsleaderboard, x, y, width, height, previousButton, nextButton

simple

The simple layout is the starting point.

In layoutPool, create a simple layout, give it an identifier, then add items. Each item receives an x/y position. Use a composite when decoration and content should be separated.

flex: align content

flex is useful when content changes size or item count. justifyContent and alignItems control alignment, wrap allows line wrapping, and virtualHeight defines the logical height.

paginated: change page

A paginated layout separates displayed items, available slots, and navigation buttons. Navigation roles are NEXT, PREVIOUS, BACK, and INDICATOR. Reserve button slots so the list does not cover them.

scrollable

The scrollable layout displays a large area.

A scrollable layout wraps an inner layout through innerId. The virtual area can be larger than the visible inventory. Add ScrollButtonData with a direction UP, DOWN, LEFT, or RIGHT, a step, and a stepMode of PAGE or ITEM.

warning

Scroll arrows are not added automatically. If no button is configured, the content stays at its initial position.

Buttons are anchored to the visible window; they do not move with the content.

frame: split the menu

A FrameLayoutData defines several rectangles. Each frame contains id, x, y, width, height, and layoutId. The target layout can itself be scrollable. Give each scrollable area a unique identifier to isolate positions.

Example: a fixed navigation column on the left, scrollable content in the center, and an action bar at the bottom.

composite

The composite layout overlays layers.

A CompositeLayoutData receives children by identifier. They render in the supplied order; later children appear above earlier ones. Use it to separate backgrounds, content, buttons, and overlays.

Slots and items

FieldRole
itemResolved material or item.
displayNameVisible name.
loreLines below the name.
x, yPosition.
countNumber of component repetitions, not the displayed stack size.
directionRepetition direction.
gapStep between repetitions, not a spacing: 1 = adjacent slots (default), 2 = one empty slot between each. Applies to both axes.
repeatYVertical repetition according to the configuration.
viewPermissionHides the slot without the permission.
clickPermissionMakes the slot inactive without the permission.

Connect layouts

A layout is connected when another layout references its id: mainLayoutId, innerId, a frame's layoutId, or a composite child. If an identifier is missing or cyclic, the parser cannot produce the expected tree.

In practice

For a shop menu, use a simple or flex layout for the grid, a composite for the background, then add Shops buttons. For a long list, put the list in a scrollable or paginated layout and keep controls in a fixed frame.