跳到主要内容

起源 JSON 格式

起源(Origin)定义了一种可选择的起源,为玩家授予特殊能力。

文件位置​

起源 JSON 文件放在数据包内的 data/<namespace>/origins/origin/ 目录中。

文件名与其 ID 相对应。例如,data/origins/origins/origin/avian.json 的 ID 为 origins:avian。

字段​

字段类型默认值说明
name文本组件可选起源的显示名称。更推荐使用翻译键 origin.<namespace>.<path>.name
description文本组件可选起源提示框中显示的描述。更推荐使用翻译键 origin.<namespace>.<path>.description
powers引用或标签列表[]此起源授予的能力 ID 或标签。使用 "origins:xxx" 或 "#origins:tag_name"
icon物品堆叠可选在选择界面中作为起源图标显示的物品
unchoosable布尔值false若为 true,此起源不会出现在选择界面中,但仍可通过命令或升级分配
order整数Integer.MAX_VALUE选择界面中的排序顺序;数值越小越靠前
impact整数0影响等级:0 = NONE,1 = LOW,2 = MEDIUM,3 = HIGH
upgradesUpgrade 对象列表[]起源升级配置列表

示例​

{
"powers": [
"#origins:avian"
],
"icon": {
"id": "minecraft:feather"
},
"order": 0,
"impact": 1
}

使用能力标签的 Avian 起源:

{
"powers": [
"example:my_power",
"#origins:common_powers"
],
"icon": {
"id": "minecraft:player_head"
},
"order": 5,
"impact": 2,
"unchoosable": false
}
备注

与旧版(Fabric)版本的主要区别:

  • 移除了 loading_priority 字段
  • impact 使用整数,而不是字符串枚举
  • powers 支持标签引用(#namespace:tag)

升级格式​

升级(Upgrade)定义了起源在达成特定进度后如何转变为另一个起源。

字段类型默认值描述
conditionIdentifier必填触发此升级的进度 ID
originIdentifier必填升级后的目标起源 ID
announcementText Component可选升级发生时显示的聊天通知

示例​

用于起源 JSON 的 upgrades 字段中:

{
"powers": [...],
"icon": {"id": "minecraft:diamond"},
"upgrades": [
{
"condition": "minecraft:end/kill_dragon",
"origin": "origins:elytrian",
"announcement": "You have slain the Ender Dragon! You have evolved into an Elytrian."
},
{
"condition": "minecraft:nether/brew_potion",
"origin": "origins:blazeborn"
}
]
}

如果省略 announcement,则不会显示任何通知消息。