事件触发器
触发器让节点在玩家达成某个玩法条件时自动完成,不需要命令或 API 授予。是否启用由 config.yml > advancement.triggers-enabled 控制,见配置详解。
节点与页面字段见成就页定义。
triggers.entries
触发器写在节点下:
yaml
triggers:
entries:
- event: "craft_item"
condition:
type: "all_of"
entries:
- '%result_type% == "CRAFTING_TABLE"'字段:
| 字段 | 类型 | 说明 |
|---|---|---|
event | string | 触发器类型。会按 CoreLib 规范 ID 归一化。 |
condition | CoreLib condition group | 可选。省略时只要事件发生就授予。 |
同一节点可配置多个 trigger,满足任意一个即尝试授予节点。
可用触发器
完整共享事件 ID 说明见 CoreLib 的 共享玩法事件 ID。本页只列出 EmakiCodex 成就触发器常用变量。
| event | 场景 | 条件变量 |
|---|---|---|
entity_kill | 击杀普通实体 | %entity_type% |
mythic_mob_kill | 击杀 MythicMobs 生物 | %mythic_id%、%mythic_level% |
block_break | 破坏方块 | %block_type% |
crop_harvest | 破坏成熟作物 | %block_type% |
craft_item | 合成物品 | %result_type%、%result_amount% |
furnace_extract | 从熔炉取出产物 | %result_type%、%result_amount% |
player_fish | 钓鱼事件 | %fish_state% |
brew_complete | 酿造完成 | %potion_type% |
entity_tame | 驯服生物 | %entity_type% |
所有触发器都会额外提供:
| 变量 | 说明 |
|---|---|
%player% | 玩家名。 |
%world% | 玩家所在世界名。 |
触发条件会先替换上述事件变量,再在安装 PlaceholderAPI 时继续解析剩余 PAPI 占位符。
条件组示例
击杀末影龙或凋灵:
yaml
triggers:
entries:
- event: "entity_kill"
condition:
type: "any_of"
entries:
- '%entity_type% == "ENDER_DRAGON"'
- '%entity_type% == "WITHER"'合成至少 16 个目标物品:
yaml
triggers:
entries:
- event: "craft_item"
condition:
type: "all_of"
entries:
- '%result_type% == "DIAMOND_BLOCK"'
- '%result_amount% >= 16'击杀指定 MythicMobs:
yaml
triggers:
entries:
- event: "mythic_mob_kill"
condition:
type: "all_of"
entries:
- '%mythic_id% == "ancient_guardian"'
- '%mythic_level% >= 10'