Page 5 · Menus

Menus as Gameplay Interfaces

Datapacks can contribute normal action menus, add entries to the shared Automation menu, and create named Available menus whose buttons appear and disappear according to live conditions.

Normal MenusStatic action choices defined by datapacks.
Automation ContributionsMultiple packs merge into one shared menu.
Available MenusLive condition-filtered action choices.

Menu Definition Shape

Menu definition
{
  "priority": 100,
  "buttons": [
    {
      "slot": 0,
      "id": "my_button",
      "text": "My Button",
      "action": "my_pack:my_action",
      "conditions": [],
      "style": {
        "background": "#263545",
        "hover": "#334A60",
        "selected": "#75D5FF",
        "text": "#FFFFFF",
        "border": "#8EE3A1"
      }
    }
  ]
}
FieldPurpose
priorityNon-negative ordering priority used when menu contributions are merged.
slotNon-negative button position. A single definition cannot contain duplicate slots.
idUnique logical ID for the button.
textText displayed to the player.
actionNamespaced DAI action/objective executed when selected.
conditionsOptional condition list used by dynamic Available menus.
styleOptional custom background, hover, selected, text, and border colors. Omit it for vanilla rendering.

Custom Button Colors

Every menu button may optionally define its own visual style. Each field is independent; omitted fields fall back to DAI's normal rendering.

Styled button
{
  "slot": 0,
  "id": "harvest",
  "text": "Harvest",
  "action": "my_pack:harvest",
  "style": {
    "background": "#263545",
    "hover": "#334A60",
    "selected": "#75D5FF",
    "text": "#FFFFFF",
    "border": "#8EE3A1"
  }
}

Colors accept #RRGGBB or #AARRGGBB. Custom styling does not change menu slots, conditions, dynamic Available-menu repacking, or action dispatch.

Normal Action Menus

Normal datapack action menus live under menus/actions/. Their resource path becomes the menu ID.

Example path
data/my_pack/menus/actions/tools.json
tools.json
{
  "priority": 100,
  "buttons": [
    {
      "slot": 0,
      "id": "gather_wood",
      "text": "Gather Wood",
      "action": "my_pack:harvest_wood"
    },
    {
      "slot": 1,
      "id": "mine_stone",
      "text": "Mine Stone",
      "action": "my_pack:mine_stone"
    }
  ]
}

Opening a Menu

All named action menus—including Available menus—open through the same update_menu action.

Open tools
{
  "type": "update_menu",
  "menu": "action",
  "open": "tools"
}
Menu actions are control-plane input. Selecting a menu action interrupts stale autonomous runtime work and dispatches the chosen menu command immediately.

Contributing to the Automation Menu

Files at menus/actions/automation.json or beneath menus/actions/automation/ are merged into the shared Automation menu.

data/my_pack/menus/actions/automation/my_pack.json
{
  "priority": 100,
  "buttons": [
    {
      "slot": 0,
      "id": "my_pack_start",
      "text": "[My Pack] Start",
      "action": "my_pack:open_main_menu"
    }
  ]
}

DAI orders contributions, reindexes the merged buttons, and structurally pins Stop Automation last.

Named Available Menus

Place a definition under menus/actions/available/ to make it a dynamic condition-filtered action menu.

data/my_pack/menus/actions/available/hunt.json
                         ↓
                  menu id = hunt

The special available.json form remains compatible as menu ID available.

hunt.json
{
  "priority": 100,
  "buttons": [
    {
      "slot": 0,
      "id": "hunt_cow",
      "text": "Hunt Cow",
      "action": "my_pack:hunt_cow",
      "conditions": [
        {
          "type": "nearby_entity_count",
          "parameter": "minecraft:cow",
          "operator": "greater_than",
          "number_value": 0.0,
          "parameter_number": 24.0
        }
      ]
    }
  ]
}
Open the named Available menu
{
  "type": "update_menu",
  "menu": "action",
  "open": "hunt"
}

How Available Menus Behave

  • The open definition is reevaluated from the menu's normal client tick.
  • Every button's condition list is evaluated.
  • Ineligible buttons disappear.
  • Eligible entries are sorted by slot and presented without holes.
  • If the previously selected button is still eligible, DAI attempts to preserve that selection.
  • If world state changes, buttons can appear or disappear without reopening the menu.
World State
   ↓
Button Conditions
   ↓
Eligible Actions Only
   ↓
Live Available Menu

Example Menu Tree

Automation
   ↓
[My Pack] Survival
   ↓
Main Available Menu
   ├── Explore
   ├── Attack  (only when enemies exist)
   ├── Hunt    (only when animals exist)
   └── Harvest
          ↓
       Harvest Menu
          ├── Wood   (only when a tree is recognized)
          └── Grass  (only when harvestable vegetation is recognized)

Menus can therefore act as both a user interface and a live representation of what the datapack believes is currently possible.