- 致编者:请牢记我们的域名wiki.mcbe-dev.net!
- 致编者:欢迎加入本Wiki的官方交流QQ群或Discord服务器!
- 基岩版1.19.31现已发布!(了解更多)
- Inner Core现已支持Xbox模组联机!(了解更多)
- 如果您是第一次来到本Wiki,欢迎注册一个账户
- 点击顶部的“编辑”或“编辑源代码”按钮即可编辑当前页面
- 请知悉:在不登录时也可以编辑和新建页面,但是您当前的IP地址会记录在编辑历史中
手册:实例/附加包/物品/盔甲
来自Minecraft基岩版开发Wiki
引言[编辑]
1.16.100更新后的新物品组件大大扩展了附加包自定义物品的可玩性,本实例将讲述如何自定义盔甲。
教程[编辑]
行为[编辑]
在行为包的items
文件夹中新建一个JSON
文件,并将下面的代码复制进文件:
{
"format_version": "1.16.100",
"minecraft:item": {
"description": {
"identifier": "wiki:chestplate",
"category": "equipment"
},
"components": {
"minecraft:creative_category": {
"parent": "itemGroup.name.chestplate"
},
// 在此处定义物品纹理短名称
"minecraft:icon": {
"texture": "wiki.chestplate"
},
// 胸甲不需要堆叠
"minecraft:max_stack_size": 1,
"minecraft:enchantable": {
"value": 10,
"slot": "armor_torso"
},
// 该物品给予玩家的护甲值
"minecraft:armor": {
"protection": 5
},
"minecraft:repairable": {
"repair_items": [
{
"items": ["wiki:chestplate"],
// 下面的这串Molang你无需理解,复制就行
"repair_amount": "context.other->q.remaining_durability + 0.05 * context.other->q.max_durability"
}
]
},
// 将其可以被装备进胸甲槽
"minecraft:wearable": {
"dispensable": true,
"slot": "slot.armor.chest"
},
"minecraft:durability": {
"max_durability": 200
}
}
}
}
纹理[编辑]
物品纹理[编辑]
首先按照Manual:制作附加包/物品中所述方法给胸甲物品分配纹理:
{
"resource_pack_name": "实例资源包",
"texture_name": "atlas.items",
"texture_data": {
"wiki.chestplate": {
"textures": "textures/items/wiki_chestplate"
}
}
}
完成后进入游戏,胸甲应该已经注册到了游戏中,但穿上后没有显示纹理,下一节将会解决这个问题。
附加纹理[编辑]
在资源包的attachables
目录中新建一个JSON
文件[注 1],插入以下内容:
{
"format_version": "1.8.0",
"minecraft:attachable": {
"description": {
// 胸甲ID
"identifier": "wiki:chestplate",
"materials": {
"default": "armor",
"enchanted": "armor_enchanted"
},
"textures": {
// 这是我们盔甲纹理(模型)的路径
// 你可以照着原版包的模型纹理制作纹理
"default": "textures/models/armor/wiki_armor_1",
// 这个文件是附魔纹理,存在于原版资源包
"enchanted": "textures/misc/enchanted_item_glint"
},
// 纹理使用的模型
"geometry": {
"default": "geometry.player.armor.chestplate"
},
"scripts": {
"parent_setup": "variable.chest_layer_visible = 0.0;"
},
// 物品的渲染控制器
"render_controllers": ["controller.render.armor"]
}
}
}
恭喜!你已经学会了自定义胸甲,自定义头盔、护腿、靴子的方法与自定义胸甲相似,你可以参照下面的示例代码来创建一套属于自己的自定义盔甲。
代码[编辑]
物品[编辑]
胸甲[编辑]
{
"format_version": "1.16.100",
"minecraft:item": {
"description": {
"identifier": "wiki:chestplate",
"category": "equipment"
},
"components": {
"minecraft:creative_category": {
"parent": "itemGroup.name.chestplate"
},
// 在此处定义物品纹理短名称
"minecraft:icon": {
"texture": "wiki.chestplate"
},
// 胸甲不需要堆叠
"minecraft:max_stack_size": 1,
"minecraft:enchantable": {
"value": 10,
"slot": "armor_torso"
},
// 该物品给予玩家的护甲值
"minecraft:armor": {
"protection": 5
},
"minecraft:repairable": {
"repair_items": [
{
"items": ["wiki:chestplate"],
// 下面的这串Molang你无需理解,复制就行
"repair_amount": "context.other->q.remaining_durability + 0.05 * context.other->q.max_durability"
}
]
},
// 将其可以被装备进胸甲槽
"minecraft:wearable": {
"dispensable": true,
"slot": "slot.armor.chest"
},
"minecraft:durability": {
"max_durability": 200
}
}
}
}
头盔[编辑]
{
"format_version": "1.16.100",
"minecraft:item": {
"description": {
"identifier": "wiki:helmet",
"category": "equipment"
},
"components": {
"minecraft:creative_category": {
"parent": "itemGroup.name.helmet"
},
"minecraft:icon": {
"texture": "wiki.helmet"
},
"minecraft:max_stack_size": 1,
"minecraft:enchantable": {
"value": 10,
"slot": "armor_head"
},
"minecraft:armor": {
"protection": 3
},
"minecraft:repairable": {
"repair_items": [
{
"items": ["wiki:helmet"],
"repair_amount": "context.other->q.remaining_durability + 0.05 * context.other->q.max_durability"
}
]
},
"minecraft:wearable": {
"dispensable": true,
"slot": "slot.armor.head"
},
"minecraft:durability": {
"max_durability": 200
}
}
}
}
护腿[编辑]
{
"format_version": "1.16.100",
"minecraft:item": {
"description": {
"identifier": "wiki:leggings",
"category": "equipment"
},
"components": {
"minecraft:creative_category": {
"parent": "itemGroup.name.leggings"
},
"minecraft:icon": {
"texture": "wiki.leggings"
},
"minecraft:max_stack_size": 1,
"minecraft:enchantable": {
"value": 10,
"slot": "armor_legs"
},
"minecraft:armor": {
"protection": 3
},
"minecraft:repairable": {
"repair_items": [
{
"items": ["wiki:leggings"],
"repair_amount": "context.other->q.remaining_durability + 0.05 * context.other->q.max_durability"
}
]
},
"minecraft:wearable": {
"dispensable": true,
"slot": "slot.armor.legs"
},
"minecraft:durability": {
"max_durability": 200
}
}
}
}
靴子[编辑]
{
"format_version": "1.16.100",
"minecraft:item": {
"description": {
"identifier": "wiki:boots",
"category": "equipment"
},
"components": {
"minecraft:creative_category": {
"parent": "itemGroup.name.boots"
},
"minecraft:icon": {
"texture": "wiki.boots"
},
"minecraft:max_stack_size": 1,
"minecraft:enchantable": {
"value": 10,
"slot": "armor_feet"
},
"minecraft:armor": {
"protection": 3
},
"minecraft:repairable": {
"repair_items": [
{
"items": ["wiki:boots"],
"repair_amount": "context.other->q.remaining_durability + 0.05 * context.other->q.max_durability"
}
]
},
"minecraft:wearable": {
"dispensable": true,
"slot": "slot.armor.feet"
},
"minecraft:durability": {
"max_durability": 200
}
}
}
}
附加纹理[编辑]
胸甲[编辑]
{
"format_version": "1.8.0",
"minecraft:attachable": {
"description": {
// 胸甲ID
"identifier": "wiki:chestplate",
"materials": {
"default": "armor",
"enchanted": "armor_enchanted"
},
"textures": {
// 这是我们盔甲纹理(模型)的路径
// 你可以照着原版包的模型纹理制作纹理
"default": "textures/models/armor/wiki_armor_1",
// 这个文件是附魔纹理,存在于原版资源包
"enchanted": "textures/misc/enchanted_item_glint"
},
// 纹理使用的模型
"geometry": {
"default": "geometry.player.armor.chestplate"
},
"scripts": {
"parent_setup": "variable.chest_layer_visible = 0.0;"
},
// 物品的渲染控制器
"render_controllers": ["controller.render.armor"]
}
}
}
头盔[编辑]
{
"format_version": "1.8.0",
"minecraft:attachable": {
"description": {
"identifier": "wiki:helmet",
"materials": {
"default": "armor",
"enchanted": "armor_enchanted"
},
"textures": {
"default": "textures/models/armor/wiki_armor_1",
"enchanted": "textures/misc/enchanted_item_glint"
},
"geometry": {
"default": "geometry.player.armor.helmet"
},
"scripts": {
"parent_setup": "v.chest_layer_visible = 0.0;"
},
"render_controllers": ["controller.render.armor"]
}
}
}
护腿[编辑]
{
"format_version": "1.8.0",
"minecraft:attachable": {
"description": {
"identifier": "wiki:leggings",
"materials": {
"default": "armor",
"enchanted": "armor_enchanted"
},
"textures": {
"enchanted": "textures/misc/enchanted_item_glint",
// 请注意,护腿使用独立的模型纹理
"default": "textures/models/armor/wiki_armor_2"
},
"geometry": {
"default": "geometry.humanoid.armor.leggings"
},
"scripts": {
"parent_setup": "v.leg_layer_visible = 0.0;"
},
"render_controllers": ["controller.render.armor"]
}
}
}
靴子[编辑]
{
"format_version": "1.8.0",
"minecraft:attachable": {
"description": {
"identifier": "wiki:boots",
"materials": {
"default": "armor",
"enchanted": "armor_enchanted"
},
"textures": {
"default": "textures/models/armor/wiki_armor_1",
"enchanted": "textures/misc/enchanted_item_glint"
},
"geometry": {
"default": "geometry.player.armor.boots"
},
"scripts": {
"parent_setup": "v.chest_layer_visible = 0.0;"
},
"render_controllers": ["controller.render.armor"]
}
}
}
物品纹理[编辑]
{
"resource_pack_name": "实例资源包",
"texture_name": "atlas.items",
"texture_data": {
"wiki.chestplate": {
"textures": "textures/items/wiki_chestplate"
},
"wiki.helmet": {
"textures": "textures/items/wiki_helmet"
},
"wiki.leggings": {
"textures": "textures/items/wiki_leggings"
},
"wiki.boots": {
"textures": "textures/items/wiki_boots"
}
}
}
本地化[编辑]
item.wiki:chestplate=示例胸甲
item.wiki:helmet=示例头盔
item.wiki:leggings=示例护腿
item.wiki:boots=示例靴子
注释[编辑]
- ↑ 如有
attachables
文件夹就可以直接创建