Build a Custom Ability
Turn a key press or physical input into a reliable gameplay ability with readiness state, authoritative execution and visible feedback.
Ability Loop
input edge ↓ conditions: correct item + ready + server capability ↓ set ready=false ↓ execute effect ↓ show cooldown/readiness feedback ↓ restore ready=true
1. Detect the Input Edge
DAI 3.0 documents keybind_pressed, keybind_held, keybind_released and keybind_exists. Use a press edge for one-shot abilities and held/tick input only when the design genuinely needs charging or combinations.
{
"type": "keybind_held",
"parameter": "jump",
"operator": "is_true"
}{
"type": "keybind_pressed",
"parameter": "examplemod:special_ability",
"operator": "is_true"
}2. Gate Before You Spend
Keep readiness/resource checks in conditions before the expensive gameplay action. DAI's central condition evaluator supports boolean, numeric and string comparisons, so one ability can branch cleanly on state rather than hiding rules inside commands.
3. Execute Authoritatively
If the ability changes health, blocks, inventories, entities or other authoritative game state, use the server action layer or call a datapack function with server_run_function. Client presentation can still happen immediately around that authoritative core.
4. Make Cooldown Readable
Item state
Change model/data-component-driven presentation or use a durability-style indicator.
Glint
Use native item components such as minecraft:enchantment_glint_override when a glowing ready state fits the design.
Overlay
Show a screen-space cooldown/readiness cue without changing the item model.
5. Add Complexity Only After One Ability Works
- Separate cooldown state per skill instead of one global lock.
- Use press/hold/release edges for charged or combo abilities.
- Check
keybind_existsbefore relying on optional mod mappings. - Keep visual readiness independent from the authoritative cooldown timer so presentation can be replaced later.