English
Triggers
To make a node or codex entry complete automatically when a player performs a certain game action, listen to the right events and write the matching conditions
A trigger (a rule that does something automatically when a player does something else) lets a vanilla node or a category entry unlock when the player meets a gameplay condition, so you no longer need a command or API grant. Whether triggers run at all is controlled by config.yml > advancement.triggers_enabled, documented in Configuration
Both places share the same event and condition syntax but land in different systems:
| Location | Key | Effect on match |
|---|---|---|
advancements/*.yml node | triggers.entries | Completes the vanilla advancement and runs actions.complete |
codex/*.yml entry | unlock.triggers | Moves the category entry to unlocked, without activating or claiming |
For the page and node fields, see Advancements; for category-entry fields, see Configuration and Category GUI
triggers.entries
Vanilla node triggers are defined under a node:
yaml
triggers:
entries:
- event: "craft_item"
condition:
type: "all_of"
entries:
- '%result_type% == "CRAFTING_TABLE"'Fields:
| Field | Type | Required | Default | Allowed values | Description |
|---|---|---|---|---|---|
event | string | Yes | — | CoreLib event ID (see below) | Trigger type, normalized as a CoreLib ID; a blank value skips that entry |
condition | CoreLib condition group | No | empty | condition.type + condition.entries | Optional. If omitted, the event grants the node whenever it fires |
A node may have multiple triggers; any matching trigger can grant the node
unlock.triggers
Category-entry triggers are defined under the entry's unlock block, using exactly the same event and condition syntax:
yaml
entries:
master_miner:
unlock:
triggers:
- event: "block_break"
condition:
type: "all_of"
entries:
- '%block_type% == "DIAMOND_ORE"'
advancements:
- "emakicodex:example/first_step"Keep the match semantics in mind: unlock.triggers and unlock.advancements are parallel paths and either one unlocks the entry, but a match changes only the unlocked state; attribute rewards require a left-click activation in the GUI, and one-time rewards require a right-click claim
Available triggers
For the complete shared event ID reference, see CoreLib Gameplay Event IDs. Listed here are the variables commonly used by both EmakiCodex trigger systems
| event | Scenario | Variables |
|---|---|---|
entity_kill | Kill a normal entity | %entity_type% |
mythic_mob_kill | Kill a MythicMobs mob | %mythic_id%, %mythic_level% |
block_break | Break a block | %block_type% |
crop_harvest | Break a mature crop | %block_type% |
craft_item | Craft an item | %result_type%, %result_amount% |
furnace_extract | Extract a furnace result | %result_type%, %result_amount% |
player_fish | Fishing event | %fish_state% |
brew_complete | Brewing completes | %potion_type% |
entity_tame | Tame an entity | %entity_type% |
Every trigger also provides:
| Variable | Description |
|---|---|
%player% | Player name |
%world% | Player world name |
Trigger conditions first replace event variables, then resolve remaining PlaceholderAPI placeholders when PlaceholderAPI is installed
Condition examples
Kill an Ender Dragon or Wither:
yaml
triggers:
entries:
- event: "entity_kill"
condition:
type: "any_of"
entries:
- '%entity_type% == "ENDER_DRAGON"'
- '%entity_type% == "WITHER"'Craft at least 16 target items:
yaml
triggers:
entries:
- event: "craft_item"
condition:
type: "all_of"
entries:
- '%result_type% == "DIAMOND_BLOCK"'
- '%result_amount% >= 16'Kill a specific MythicMobs mob:
yaml
triggers:
entries:
- event: "mythic_mob_kill"
condition:
type: "all_of"
entries:
- '%mythic_id% == "ancient_guardian"'
- '%mythic_level% >= 10'The examples above use a vanilla node's triggers.entries. To use them for a category entry, place the same list under the entry's unlock.triggers
Related Pages
- Advancements: node fields and
actions.complete - Category GUI: the four-state flow and reward interactions after
unlock.triggersmatches - Configuration: the
advancement.triggers_enabledswitch and category-entry fields - Gameplay Event IDs: the complete event list on the CoreLib side