# 盔甲

### 盔甲配置的组成

上文已经提及，使用物品的 **CustomModelData** 只能帮助我们切换物品的基本材质，因而盔甲在修改材质以后，也只能做到拿在手里的物品的材质变了，但一旦穿在身上即变为本来的物品，例如皮革盔甲。

幸运的是，原版在 **1.17** 版本后提供了自定义不同染色皮革的材质的功能，因此我们可以通过自定义染色皮革的材质来实现自定义盔甲的上身效果。

综上，一个盔甲配置由它本来拿在手中的物品的材质和盔甲上身的材质两个部分组成。

### 盔甲注册

我们首先需要在物品配置中注册一套盔甲，并规定它的材质。在一个物品配置中增加如下内容：

```
armors_rendering:
  copper_set_armor:
    color: '#d60000'
    layer_1: armors/copper_layer_1
    layer_2: armors/copper_layer_2
    use_color: false
```

其中，`copper_set_armor` 为 **盔甲的id**，盔甲的 **id** 没有限制，你也可以以同样的格式创建无数多的盔甲，下面为它的配置：

* color：指定盔甲的颜色，为 **RGB** 颜色代码，只有在 `use_color` 选项为 `true` 后才会生效，否则随机分配。
* layer1、layer\_2：盔甲的上身材质，在下面有具体说明。
* use\_color：上文已提及。

### 为物品增加盔甲属性

注册完盔甲以后，我们需要指定哪个物品才能作为盔甲在拿走物品手里时的材质。在配置中继续添加如下内容：

```
items:
  copper_helmet:
    display_name: 铜头盔
    nbt: '{AureliumSkills: {Requirements: {Armor: {Defense: 10}}}}'
    durability:
      max_custom_durability: 220
    mmoitem:
      type: ARMOR
      id: COPPER_HELMET
    resource:
      generate: true
      textures:
      - armors/copper_helmet.png
    specific_properties:
      armor:
        slot: head
        custom_armor: copper_set_armor
    attribute_modifiers:
      head:
        armor: 8
        armorToughness: 3
```

从前面的学习，我们已经很快的看出，`copper_helmet` 为物品id，下面为它的配置：

* display\_name、lore：在 **物品属性** 一节已介绍。
* nbt：设置物品 **NBT**，你只会在你用到时候知道如何填写这里，配置中所给的即为 **AureliumSkills** 插件提供的 **限制玩家使用等级** 的NBT，在其 Wiki 有详细介绍。
* durability：同样在 **物品属性** 一节已介绍。
* mmoitem：在 **物品挂钩** 一节已介绍。
* resource：在 **物品基础** 一节已介绍。
* specific\_properties：物品的特殊属性，盔甲将会使用到，在自定义方块时还会使用，下面将会详细讲解。
* attribute\_modifiers：在 物品属性 一节已介绍。在那里，我们介绍了 `mainhand` 和 `offhand`（主手和副手），这里盔甲将会单独有 `head、chest、legs、feet`（分布对应头盔、胸甲、护腿和靴子），记住需要准确无误。

### 盔甲特殊属性

```
    specific_properties:
      armor:
        slot: head
        custom_armor: copper_set_armor
```

盔甲特殊属性由以下组成：

* armor：代表以下部分均为盔甲的特殊属性，请不要修改。
* slot：盔甲上身的部位，有 `head、chest、legs、feet`（分布对应头盔、胸甲、护腿和靴子）。
* custom\_armor：填写注册的盔甲名称。

由于在使用 **MMOItems** 挂钩后，**ItemsAdder** 物品配置除 **resource** 外全部失效，因此本节所给的示例的赘余的，但这只是为了给你进行复习之作用。

### 盔甲的上身材质

盔甲的上身材质如下所示：

![](/files/ID0RdlG4kKP1hxLNVYTZ)

![](/files/rLwrEH2IwFWRpZT2Y7dd)

它有两层材质，与皮肤类似，是 **3D** 的平面展开图，你可以使用 MCSkin 等软件绘制。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.superiormc.cn/itemsadder-doc/wu-pin/kui-jia.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
