⚔️ 装备
简介

CraftEngine 提供两种自定义装备方案:使用盔甲纹饰(Minecraft 1.20+),或使用可装备组件(Minecraft 1.21.2+)。
以下内容定义的是装备资源,而不是具体物品。要将装备资源应用到盔甲物品,请参阅物品设置中的 equipment。
items:
my:custom_helmet:
settings:
equipment:
asset_id: my:custom_armor
equipments:
my:custom_armor:
...
关于 3D 头盔
3D 头盔并不通过本页介绍的装备资源实现。下面说明其渲染原理和正确配置方法。
盔甲类物品默认带有 equippable 组件,其中的 asset_id 会让 Minecraft 使用硬编码的盔甲渲染器。因此,即使为钻石头盔材质的物品指定自定义 3D 模型,穿戴后仍会按普通盔甲渲染。
要显示自定义 3D 模型,需要禁用盔甲渲染器,让头盔改用普通物品渲染器。
方案 1(Minecraft 1.21.2+)
重写 equippable 组件并移除 asset_id 选项。示例如下:
items:
default:my_3d_helmet:
material: diamond_helmet
data:
equippable:
slot: head
解决方案2(适用于1.20+版本):
使用 client_bound_material 来修改头盔在客户端的渲染方式,而不影响其服务端功能。示例如下:
items:
default:my_3d_helmet:
material: diamond_helmet
client_bound_material: paper
基于组件
1.21.2+ 推荐equipments:
# 装备资源命名空间 ID
default:topaz:
type: component
humanoid: "minecraft:entity/equipment/humanoid/topaz"
humanoid_leggings: "minecraft:entity/equipment/humanoid_leggings/topaz"
# 更多预设模型类型(根据需求添加)
happy_ghast_body: "minecraft:entity/equipment/happy_ghast_body/topaz"
支持的预设模型类型:
- humanoid
- humanoid_leggings
- wings
- wolf_body
- horse_body
- llama_body
- pig_saddle
- strider_saddle
- camel_saddle
- horse_saddle
- donkey_saddle
- mule_saddle
- skeleton_horse_saddle
- zombie_horse_saddle
- happy_ghast_body
- camel_husk_saddle
- nautilus_body
你也可通过配置块形式设置额外选项:
equipments:
default:topaz:
type: component
humanoid:
texture: "minecraft:leather"
dyeable:
color_when_undyed: -6265536 # 皮革染色配置
# 鞘翅纹理配置
use_player_texture: false
也可通过列表组合多个纹理,以下是两个示例:
equipments:
custom:partialy_dyeable_armor:
type: component
humanoid:
- texture: "minecraft:dyeable_part"
dyeable:
color_when_undyed: -6265536
- texture: "minecraft:undyeable_part"
equipments:
custom:red_flower_wreath:
type: component
humanoid:
- texture: "minecraft:wreath"
- texture: "minecraft:red_flower"
custom:yellow_flower_wreath:
type: component
humanoid:
- texture: "minecraft:wreath"
- texture: "minecraft:yellow_flower"
custom:white_flower_wreath:
type: component
humanoid:
- texture: "minecraft:wreath"
- texture: "minecraft:white_flower"
基于盔甲纹饰
1.20+ 盔甲纹饰不可用CraftEngine 移除原版盔甲的基础贴图后,盔甲在穿戴时会变为透明。此时应用自定义纹饰即可显示自定义盔甲贴图,但这件盔甲之后无法再叠加其他纹饰。
equipments:
# 装备资源命名空间 ID
default:topaz:
type: trim
humanoid: minecraft:entity/equipment/humanoid/topaz
humanoid_leggings: minecraft:entity/equipment/humanoid_leggings/topaz
执行 /ce resource enable legacy_armor 可以恢复原版锁链甲外观。该资源通过特殊纹饰图案和 CraftEngine 的 client_bound_data 功能实现。
基于纹饰的盔甲仅支持 humanoid 和 humanoid_leggings 模型类型。如果出现盔甲贴图未正确应用或玩家被踢出服务器的情况,请先重新进入服务器;问题仍然存在时,请检查配置。
3D 盔甲
1.21.6+ 基于着色器使用 CraftEngine Toolbox,可将 Blockbench .bbmodel 模型转换为兼容 CraftEngine 的 3D 盔甲资源包。
