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.
Menu Definition Shape
{
"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"
}
}
]
}| Field | Purpose |
|---|---|
priority | Non-negative ordering priority used when menu contributions are merged. |
slot | Non-negative button position. A single definition cannot contain duplicate slots. |
id | Unique logical ID for the button. |
text | Text displayed to the player. |
action | Namespaced DAI action/objective executed when selected. |
conditions | Optional condition list used by dynamic Available menus. |
style | Optional 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.
{
"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.
data/my_pack/menus/actions/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.
{
"type": "update_menu",
"menu": "action",
"open": "tools"
}Contributing to the Automation Menu
Files at menus/actions/automation.json or beneath menus/actions/automation/ are merged into the shared Automation menu.
{
"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 = huntThe special available.json form remains compatible as menu ID available.
{
"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
}
]
}
]
}{
"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
slotand 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.