Minecraft Wiki

除另有声明,转载时均必须注明出处若簡繁轉換出錯,請以遊戲內為準请勇于扩充与修正内容有兴趣逛逛我们的微博沟通交流,欢迎到社区专页需要协助,请在告示板留言

了解更多

Minecraft Wiki
Advertisement
Information icon
此特性为基岩版独有。
Dark Oak Sapling
此条目仍需完善。

你可以帮助我们扩充关于该主题的更多信息。
原因:这是一篇中文原创教程,与英文页面有较大差异

本教程版本为基岩版1.16.100.56及以上版本。在浏览本教程前,请先确保自身已有一定的行为包及资源包基础。如果还未掌握,请先浏览教程/制作行为包页面后再来浏览本教程。在浏览完本教程之后,你将学会如何制作一个全新的自定义物品。

行为包部分

自定义物品在行为包的部分很简单,只需要创建一个items文件夹,然后在其中创建物品json并编辑即可(名称为“物品子名.json”)以下以钻石剑为简单示例:

{
  "format_version": "1.16.100",
  "minecraft:item": {
    "description": {
      "identifier": "minecraft:diamond_sword",
      "category": "Equipment",
      "is_experimental": false
    },
    "components": {
      "minecraft:max_stack_size": 1,
      "minecraft:use_duration": 3600,
      "minecraft:hand_equipped": true,
      "minecraft:durability": {
        "max_damage": 1561
      },
      "minecraft:mining_speed": 1.5,
      "minecraft:damage": 7,
      "minecraft:enchantable": {
        "value": 10,
        "slot": "sword"
      },
      "minecraft:can_destroy_in_creative": false,
      "minecraft:digger": {
        "use_efficiency": false,
        "destroy_speeds": [
          {
            "block": "minecraft:web",
            "speed": 15
          },
          {
            "block": "minecraft:bamboo",
            "speed": 10
          }
        ]
      },
      "minecraft:weapon": {}
    }
  }
}

详解请见基岩版物品文档

资源包部分

在材质包中创建一个items文件夹并创建物品json。

注:在这里有两种命名方法,一种是官方的“物品子名_texture.json”,一种则是常用的“物品子名.json”的命名方法,两种都可被正常识别。

以下以钻石胸甲为简单示例:

{
  "format_version": "1.16.100",
  "minecraft:item": {
    "description": {
      "identifier": "minecraft:diamond_chestplate"
      "category": "Equipment"
    },
    "components": {
      "minecraft:creative_category": {
        "parent": "itemGroup.name.chestplate"
      },
      "minecraft:icon": {
        "texture": "chestplate",
        "frame_index": 4
      },
	  "minecraft:armor": {
		"texture_type": "diamond"
      },
      "minecraft:render_offsets": "chestplates",
      "minecraft:hover_text_color": "aqua",//物品名称颜色(无须样式代码)
      "minecraft:display_name": {}//物品名称定义
    }
  }
}

详解请见基岩版物品文档

然后在textures文件夹中,新建一个item_texture.json的文件,并在里面定义物品的贴图路径,以下为简单示例:

{
  "resource_pack_name": "vanilla",
  "texture_name": "atlas.items",
  "texture_data": {
	"chestplate": {
	  "textures": [
        "textures/items/leather_chestplate",
        "textures/items/chainmail_chestplate",
        "textures/items/iron_chestplate",
        "textures/items/gold_chestplate",
        "textures/items/diamond_chestplate"
        "textures/items/netherite_chestplate"
      ]//有多个路径时使用中括号框起来
	}
  }
}

最后在对应路径放入相应贴图即可。

注:一般情况下物品名称在语言文件中的定义为item.物品id.name

本教程为基础教程,有关自定义物品的详解请前往基岩版物品文档查看。

参见

Advertisement