- 致编者:请牢记我们的域名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
資料夾就可以直接建立