占位符参考
PlaceholderAPI 占位符
扩展标识符:emakicooking
安装 PlaceholderAPI 后,EmakiCooking 会自动注册以下占位符。
| 占位符 | 说明 | 示例 |
|---|---|---|
%emakicooking_recipe_count% | 所有烹饪站配方总数。 | 42 |
%emakicooking_recipe_count_chopping_board% | 砧板配方数量。 | 8 |
%emakicooking_recipe_count_wok% | 炒锅配方数量。 | 12 |
%emakicooking_recipe_count_grinder% | 研磨机配方数量。 | 5 |
%emakicooking_recipe_count_steamer% | 蒸锅配方数量。 | 6 |
%emakicooking_recipe_count_oven% | 烤箱配方数量。 | 4 |
%emakicooking_recipe_count_juicer% | 榨汁机配方数量。 | 3 |
%emakicooking_recipe_count_fermentation_barrel% | 发酵桶配方数量。 | 4 |
营养占位符
营养相关占位符同样使用 emakicooking 标识符。营养玩法见 营养系统。
| 占位符 | 说明 | 示例 |
|---|---|---|
%emakicooking_nutrition_<type>% | 玩家某营养类型当前值。 | 60 |
%emakicooking_nutrition_<type>_max% | 营养类型上限。 | 100 |
%emakicooking_nutrition_<type>_min% | 营养类型下限。 | 0 |
%emakicooking_nutrition_combo_count_<ruleId>% | 指定组合阈值规则当前达标的营养类型数量。 | 3 |
<type> 为营养类型 id(如 fruit、protein),<ruleId> 为组合阈值规则 id。营养占位符依赖玩家状态,需要在线玩家上下文。
工位运行态占位符
工位运行态占位符用于读取玩家当前关联工位的实时状态,同样使用 emakicooking 标识符。有两种写法:
%emakicooking_station_<字段>%:自动取玩家当前关联的工位。%emakicooking_station_<工位类型>_<字段>%:仅当玩家关联工位与指定类型一致时才返回,否则返回空串。工位类型为文件夹名(chopping_board、wok、grinder、steamer、oven、juicer、fermentation_barrel)。
工位关联方式:优先取玩家最近一次交互的工位(需玩家仍在同一世界且距离不超过内置上限),其次取玩家正打开的工位 GUI 会话(蒸锅 / 烤炉 / 榨汁机 / 发酵桶)。玩家无关联工位或工位为空态时返回空串。
| 字段 | 说明 | 示例 |
|---|---|---|
type | 工位类型(文件夹名)。 | chopping_board |
type_name | 工位显示名。 | 砧板 |
world | 工位所在世界名。 | world |
x | 工作方块 X 坐标。 | 100 |
y | 工作方块 Y 坐标。 | 64 |
z | 工作方块 Z 坐标。 | -200 |
location | 工位坐标合并串 世界,x,y,z,便于整串匹配。 | world,100,64,-200 |
block | 工作方块 id(自定义方块 id 或原版 Material 名)。 | minecraft:oak_log |
heat_block | 热源方块 id(工作方块下方,无热源为空)。 | minecraft:furnace |
burning | 热源是否正在燃烧。 | true |
burning_seconds | 热源剩余燃烧秒数。 | 40 |
heat | 热度(烤炉)/ 火力等级(炒锅)。 | 60 |
moisture | 水分(蒸锅)。 | 80 |
steam | 蒸汽(蒸锅)。 | 30 |
input | 主输入物品纯文本名。 | 苹果 |
input_source | 主输入物品来源简写。 | minecraft-apple |
input_amount | 主输入物品数量。 | 16 |
ingredient_count | 输入物品种类数。 | 3 |
recipe | 当前匹配 / 进行中的配方显示名。 | 苹果汁 |
recipe_id | 当前配方 id。 | apple_juice |
progress | 进度当前值。 | 2 |
progress_target | 进度目标值。 | 5 |
progress_percent | 进度百分比(保留 1 位小数)。 | 40.0 |
completed | 是否已完成(可收取)。 | false |
fluid | 流体名(榨汁机)。 | 苹果汁 |
fluid_amount | 流体毫升量(榨汁机)。 | 500 |
player | 操作 / 查看玩家名。 | Steve |
不适用于当前工位的字段返回空串或 0(例如砧板没有热源,heat_block 为空、burning 为 false)。
条件配方玩法示例
配合配方的 availability_condition / condition,可以用工位坐标区分同种工位的具体个体。例如摆放两个相同砧板,只让特定坐标的砧板能完成某配方(坐标合并串含逗号,作字符串比较需加引号):
availability_condition:
type: all_of
entries:
- '%emakicooking_station_location% == "world,100,64,-200"'也可以只用单个坐标字段匹配:
availability_condition:
type: all_of
entries:
- '%emakicooking_station_x% == 100'
- '%emakicooking_station_z% == -200'条件块的完整语法(type / entries / on_fail 等)见 条件系统。
使用示例
lore:
- '<gray>总配方数: <white>%emakicooking_recipe_count%'
- '<gray>炒锅配方: <white>%emakicooking_recipe_count_wok%'内部模板变量
以下变量可用于配方的 structured_presentation(名称与 Lore 操作模板)中,使用 %variable% 格式。
| 变量 | 说明 | 示例 |
|---|---|---|
%recipe_id% | 配方 ID。 | grilled_steak |
%recipe_name% | 配方显示名。 | 烤牛排 |
%station_type% | 工位类型(文件夹名)。 | oven |
%phase% | 当前烹饪阶段。 | cooking |
%output_source% | 产出物品来源简写。 | minecraft-cooked_beef |
%output_amount% | 产出数量。 | 1 |
%output_chance% | 产出概率。 | 100% |
%output_amount_min% | 产出数量范围最小值。仅在结果写了 amount_range 时存在。 | 1 |
%output_amount_max% | 产出数量范围最大值。仅在结果写了 amount_range 时存在。 | 3 |
%output_source% 使用 CoreLib ItemSource 简写形式,例如 minecraft-cooked_beef。
模板示例
structured_presentation:
lore_actions:
- action: "append"
content:
- ""
- "<gray>配方: <white>%recipe_name%"
- "<gray>工位: <white>%station_type%"
- "<gray>产出: <white>%output_amount%x %output_source%"动作上下文变量
烹饪奖励动作(CookingRewardService)触发时,以下变量会注入到 Action 上下文中:
| 变量 | 说明 | 示例 |
|---|---|---|
%player% | 玩家名称。 | Steve |
%player_uuid% | 玩家 UUID。 | 00000000-0000-0000-0000-000000000000 |
%world% | 世界名称。 | world |
%x% | 工位方块 X 坐标。 | 100 |
%y% | 工位方块 Y 坐标。 | 64 |
%z% | 工位方块 Z 坐标。 | -200 |
%recipe_id% | 当前配方 ID。 | grilled_steak |
%recipe_name% | 配方显示名。 | 烤牛排 |
%station_type% | 工位类型(文件夹名)。 | oven |
%cooking_recipe_id% | %recipe_id% 的带前缀写法。 | grilled_steak |
%cooking_recipe_name% | %recipe_name% 的带前缀写法。 | 烤牛排 |
%cooking_station_type% | %station_type% 的带前缀写法。 | oven |
%input_count% | 本次参与结算的输入种类数。 | 3 |
部分工位在完成结算时还会额外注入自己的变量:
| 变量 | 注入方 | 说明 |
|---|---|---|
%outcome% | 炒锅 | 命中的结果分支名。 |
%slot_index% | 烤炉、蒸锅、榨汁机 | 本次结算的槽位索引。 |
产物级模板(structured_presentation)在上述变量基础上再追加 %phase%、%output_source%、%output_amount%、%output_chance%、%output_amount_min%、%output_amount_max%。
动作示例
配方结果分支中的 actions 是 CoreLib 动作字符串列表:
actions:
- 'sendmessage text="<green>%player% 在 %station_type% 完成了 %recipe_id% 的烹饪!</green>"'说明
- PAPI 占位符不依赖玩家状态,
recipe_count系列为全局值,适合用于管理面板或计分板。 - CoreLib 的内置上下文变量(
%player_name%、%player_uuid%等)同样可用。