Skip to content

图纸与材料

Forge 通过图纸限制配方入口,通过材料决定锻造成本、品质和附加效果。图纸通常代表"会不会做",材料代表"用什么做、做得多好"。

图纸要求

yaml
blueprint_requirements:
  - item_sources:
      - "minecraft-enchanted_book"
    amount: 1
字段类型说明
item_sourceslist需要的图纸物品来源。
amountnumber需要数量。

图纸不消耗,仅检测持有。用于实现"需要先获得配方图纸"的玩法。

材料列表

yaml
materials:
  - item_sources:
      - "minecraft-iron_ingot"
    amount: 3
    capacity_cost: 5
    effects:
      - type: "variables"
        variables:
          physical_damage: 5
      - type: "ea_attribute"
        ea_attributes:
          physical_attack: 5.0
字段说明
item_sources材料物品来源列表。
amount需要数量。
capacity_cost该材料占用的锻造容量。
optional是否为可选材料(默认 false)。
effects此材料提供的效果列表。

容量与可选材料

forge_capacity 限制配方允许投入的材料总容量。所有材料的 capacity_cost 总和不能超过此值。

yaml
forge_capacity: 35

建议:

  • 基础配方容量小,避免玩家一次投入过多难以理解。
  • 高级配方可以给更多可选材料空间,让玩家追求更高品质。
  • 可选材料要在 GUI 中展示清楚,否则玩家不知道为什么品质变化。

材料匹配建议

  • 使用稳定的 item_sources 格式("提供者-物品ID")。
  • 贵重材料建议开启精确匹配,避免玩家用伪造物品替代。
  • 如果材料来自其他模块,确认该模块加载顺序早于 Forge。

材料效果

材料可以附带效果(effects),在锻造成功后对结果物品产生影响。效果定义在材料配置的 effects 列表中。

效果类型

类型说明
variables为锻造结果贡献文本/模板变量值,不会自动写入 Attribute PDC。
ea_attribute向结果物品写入 PDC 属性(需要 EmakiAttribute)。
es_skill向结果物品绑定技能 ID(需要 EmakiSkills);payload 使用 es_skills 列表。
name_action对结果物品的名称执行操作。
lore_action对结果物品的 Lore 执行操作。
quality_modify修改品质结果(强制或设置下限)。
capacity_bonus贡献额外锻造容量(材料本身 capacity_cost 为 0)。

效果值的最终计算公式:配置值 × 材料数量 × 品质倍率。这适用于 variablesea_attribute 效果,但两者语义不同:variables 只用于文本/模板上下文,真实属性输出必须写在 ea_attributes

variables 效果

向锻造结果注入变量值,这些值可以被品质倍率影响,也可以在 lore_actionsname_actions 模板中使用。

yaml
effects:
  - type: "variables"
    variables:
      fire_damage: 10
      fire_resistance: 5

ea_attribute 效果

向结果物品写入 PDC 属性层(需要安装 EmakiAttribute)。

yaml
effects:
  - type: "ea_attribute"
    ea_attributes:
      physical_attack: 15.0
      physical_defense: 5.0

当前配置线不再使用 ea_attribute_meta。属性值最终为 配置值 × 材料数量 × 品质倍率

es_skill 效果

向结果物品绑定技能 ID(需要安装 EmakiSkills)。

yaml
effects:
  - type: "es_skill"
    es_skills:
      - "fire_slash"
      - "flame_shield"

当前推荐只使用 es_skills 列表写法;旧的单个 es_skill 字段不再作为当前文档推荐形式。

name_action 效果

对锻造结果物品的名称执行操作,支持 CoreLib 名称操作系统的所有动作类型。

yaml
effects:
  - type: "name_action"
    name_actions:
      - action: "prepend_prefix"
        value: "<red>烈焰 </red>"
      - action: "append_suffix"
        value: " <gray>[锻造]</gray>"

lore_action 效果

对锻造结果物品的 Lore 执行操作,支持 CoreLib Lore 操作系统的所有动作类型。

yaml
effects:
  - type: "lore_action"
    lore_actions:
      - action: "insert_below"
        anchor: "锻造属性:"
        content:
          - "<gray>物理伤害: <red>+%physical_damage%</red></gray>"
          - "<gray>生命值: <green>+%max_health%</green></gray>"

模板变量

name_actionsvalue 字段和 lore_actionscontent 字段中,可以使用以下变量:

变量说明
%quality%品质 ID。
%quality_name%品质显示名。
%multiplier%品质倍率。
%player_name%执行锻造的玩家名称。
%player_uuid%执行锻造的玩家 UUID。
{变量名}任何通过 variables 效果注入的变量值。

quality_modify 效果

修改品质计算结果。支持两种模式:

模式说明
force强制将品质设为指定等级,忽略随机结果。
minimum设置品质下限,随机结果低于此值时提升到该等级。
yaml
effects:
  - type: "quality_modify"
    mode: "force"
    tier: "史诗"

当前推荐字段名是 tier。旧的 quality 不再作为当前文档推荐写法。force 模式会跳过保底计数器逻辑。

capacity_bonus 效果

携带此效果的材料本身 capacity_cost 为 0,并向配方贡献额外容量。

yaml
effects:
  - type: "capacity_bonus"
    value: 20

当前推荐字段名是 value。旧的 amountbonuscapacity 不再作为当前文档推荐写法。

完整示例

yaml
id: "example_recipe"
display_name: "<gold>烈焰之剑锻造配方</gold>"
forge_capacity: 35

blueprint_requirements:
  - item_sources:
      - "minecraft-enchanted_book"
    amount: 1

materials:
  - item_sources:
      - "minecraft-iron_ingot"
    amount: 3
    capacity_cost: 5
    effects:
      - type: "variables"
        variables:
          physical_damage: 5
          max_health: 2
      - type: "ea_attribute"
        ea_attributes:
          physical_attack: 5.0
          max_health: 2.0
      - type: "lore_action"
        lore_actions:
          - action: "insert_below"
            anchor: "锻造属性:"
            content:
              - "<gray>物理伤害: <red>+%physical_damage%</red></gray>"
              - "<gray>生命值: <green>+%max_health%</green></gray>"

  - item_sources:
      - "minecraft-blaze_powder"
    amount: 1
    capacity_cost: 10
    effects:
      - type: "variables"
        variables:
          fire_damage: 10
          critical_chance: 5
      - type: "ea_attribute"
        ea_attributes:
          fire_damage: 10.0
          physical_crit_rate: 5.0
      - type: "es_skill"
        es_skills:
          - "flame_strike"
      - type: "name_action"
        name_actions:
          - action: "prepend_prefix"
            value: "<red>烈焰 </red>"
      - type: "lore_action"
        lore_actions:
          - action: "insert_below"
            anchor: "锻造属性:"
            content:
              - "<red>火焰伤害: +%fire_damage%</red>"