手册:制作附加包/物品组件

From Minecraft基岩版开发Wiki
物品组件
系列教程
所属系列
难度
初级
前置知识
适用版本
国际版
实践设备
常用
Windows 10IOSAndroid
推荐
Windows 10
建议软件
Visual Studio Code icon.svg
相关阅读

物品组件用于定义该物品所具备的功能和特性。

语法结构[edit]

组件列表[edit]

示例[edit]

食物[edit]

{
    "format_version": "1.16.100",
    "minecraft:item": {
      "description": {
        "identifier": "example:food"
      },
      "components": {
        "minecraft:food":{
            "can_always_eat": false,
            "nutrition" : 3,
            "effects" : [
                  {
                    "name": "poison",
                    "chance": 1.0,
                    "duration": 5,
                    "amplifier": 0
                  }
            ],
            "saturation_modifier": "normal",
            "using_converts_to": "bowl"
        }
        "minecraft:max_stack_size": 64,
        "minecraft:icon": {
          "texture": "example:food"
        },
        "minecraft:hand_equipped": true,
        "minecraft:display_name": {
          "value": "Food"
        }
      }
    }
  }

药水[edit]

武器[edit]

近战武器[edit]

这是一个名称为wiki:sword,位于剑分类内,使用ye:gem修复,有384耐久和9点攻击伤害的武器,贴图的短名称为sword。

{
    "format_version": "1.16.100",
    "minecraft:item": {
        "description": {
            "identifier": "wiki:gem_sword",
            "category": "equipment"
        },
        "components": {
            "minecraft:max_stack_size": 1,
            "minecraft:hand_equipped": true,
            "minecraft:durability": {
                "max_durability": 384
            },
            "minecraft:creative_category": {
                "parent": "itemGroup.name.sword"
            },
            "minecraft:repairable": {
                "repair_items": [
                    {
                        "items": [
                            "ye:gem"
                        ],
                        "repair_amount": 80
                    }
                ]
            },
            "minecraft:icon": {
                "texture": "gem_sword"
            },
            "minecraft:damage": 9,
            "minecraft:enchantable": {
                "slot": "sword",
                "value": 10
            },
            "minecraft:mining_speed": 1.5,
            "minecraft:can_destroy_in_creative": false,
            "minecraft:weapon": {
                "on_hurt_entity": {
                    "event": "wiki:damage"
                }
            }
        },
        "events": {
            "wiki:damage": {
                "damage": {
                    "type": "durability",
                    "amount": 1,
                    "target": "self"
                }
            }
        }
    }
}

远程武器[edit]

盔甲[edit]

{
  "format_version": "1.16.100",
  "minecraft:item": {
    "description": {
      "category": "equipment",
      "identifier": "example:helmet"
    },
    "components": {
    "tag:minecraft:is_helmet": {},
			"minecraft:display_name": {},
			"minecraft:weapon": {},
    "minecraft:creative_category": {
				"parent": "itemGroup.name.helmet"
			},
			"minecraft:icon": {
				"texture": "example:helmet"
			},
      "minecraft:max_stack_size": 1,
      "minecraft:enchantable": {
        "value": 15,
        "slot": "armor_head"
      },
      "minecraft:damageable": {
        "max_damage": 1000,
        "damage_chance": {
          "min": 60,
          "max": 100
        }
      },
      "minecraft:mining_speed": 9,
      "minecraft:damage": 4,
      "minecraft:armor": {
        "protection": 3
      },
      "minecraft:wearable": {
        "slot": "slot.armor.head"
      },
      "minecraft:knockback_resistance": {
        "protection": 0.1
      }
    }
  }
}

弹射物[edit]

{
  "format_version": "1.16.100",
  "minecraft:item": {
    "description": {
      "category": "equipment",
      "identifier": "example:projectile"
    },
    "components": {
      "minecraft:display_name": {},
      "minecraft:creative_category": {
        "parent": "itemGroup.name.arrow"
      },
      "minecraft:icon": {
        "texture": "example:projectile"
      },
      "minecraft:max_stack_size": 16,
      "minecraft:projectile": {
        "projectile_entity": "example:projectile_entity"
      }
    }
  }
}

< 物品 | 方块 >