Saltar al contenido principal

Addressable Views

Addressable views let one open_gui entry expose several screens without duplicating its inventory shell, tabs, borders, or navigation row. They are useful for dashboards, quest books, profiles, shops, and any menu with a stable chrome and changing content.

How resolution works

  1. Create a frame layout for the menu shell.
  2. Set the content frame's layoutId to "@view".
  3. Declare one MenuViewData object per screen.
  4. Map the content frame to a layout with frames, or follow the <viewId>_<frameId> naming convention.
  5. Tag tab items with buttonPrefix: "view:" and buttonType: "<viewId>".

The view resolver selects the first visible view in this order: an explicit target from gui:view <id>, defaultViewId, then the first declared visible view. Criteria and viewPermission make a view unreachable and hide its tab.

View fields

FieldDescription
idStable id used by gui:view and view:<id> tabs.
nameLabel used in breadcrumbs and the {view} title token.
titleOptional per-view title; supports {breadcrumb}, {view}, and {root}.
parentIdParent view for nested navigation and breadcrumb ancestry.
framesExplicit frame id → layout pool id mappings.
criteriaConditions required for the view to be visible.
viewPermissionPermission required to reach the view.
activeStyleMaterial, glint, name, lore, and custom-model-data overrides for active tabs.

Complete example

type: open_gui
id: profile_menu
guiType: CUSTOM
size: SIZE_54
title: "<gold>{breadcrumb}"
mainLayoutId: shell
defaultViewId: overview
breadcrumbSeparator: " <gray>›</gray> "
pushHistoryOnViewSwitch: true
views:
- id: overview
name: "Overview"
frames:
content: overview_content
- id: statistics
name: "Statistics"
parentId: overview
frames:
content: statistics_content
viewPermission: profile.stats
layoutPool:
- type: frame
id: shell
frames:
- { id: tabs, x: 0, y: 0, width: 9, height: 1, layoutId: tabs }
- { id: content, x: 0, y: 1, width: 9, height: 5, layoutId: "@view" }
- type: simple
id: tabs
items:
- { x: 2, y: 0, buttonPrefix: "view:", buttonType: overview, item: { material: BOOK } }
- { x: 3, y: 0, buttonPrefix: "view:", buttonType: statistics, item: { material: PAPER } }
- type: simple
id: overview_content
items: []
- type: simple
id: statistics_content
items: []

The view tab resolver automatically appends the gui:view command, hides the statistics tab when the player lacks profile.stats, and applies the active style to the selected view and its parents.

Inheritance and history

baseMenuId allows a menu to inherit a template's layout pool and view declarations. Local ids take precedence. Set pushHistoryOnViewSwitch: true when the back button should return to the previous view; gui:back then restores the previous menu/view without closing and reopening the inventory.

Menus without views retain their regular layout-pool behavior. Existing menus therefore need no migration merely to use OmniGUI v0.10.