自定义物品 NBT
向物品添加自定义 NBT 属性
你可以指定自定义 NBT 属性以合并到自定义物品中。
该功能支持过时的 NBT 与 1.20.5+ 的新版 NBT! 如果需要,会自动转换过时 NBT。
1.20.5 的更改详见此处。
确保提供有效的 NBT (json),否则它将无法工作!
从文件中注入 NBT 属性
info:
namespace: test
items:
test_inject_nbt_from_file:
display_name: "Test inject NBT from file"
components_nbt_file: "test_inject_nbt_from_file.json"
resource:
material: IRON_CHESTPLATE
generate: false
model_path: minecraft:item/diamond旧方法,从 NBT 字符串注入
注意
确保使用 \ 转义 " 字符。
在将字符串用于 YML 之前,请使用我的 转义/取消转义工具 来转义字符串。
示例自定义属性
例如,我想将这些标签合并到我的物品中:
nbt: '{my-custom-nbt-tag:"hello this is a custom tag", another-tag:"useless"}'
示例 NBT 与物品名称组件
nbt: "{components:{"minecraft:custom_name":'{"text":"TEST", "font": "alt", "italic":false}', "minecraft:custom_data": {"bro":'asd'}}}"
1.20.4 组件 - 请勿使用
这是旧版方式,请勿使用。
nbt: "{display:{Name:'{"text":"TEST", "font": "alt", "italic":false}'}}"
Last updated
Was this helpful?