--- front: hard: 入门 time: 分钟 --- # 自定义配方 ## 概述 开发者可以在addon的bevavior目录下新增netease_recipes文件夹, 然后配置json来添加自定义配方。 ## 定义配方Json 目前可以通过json自定义的配方主要有以下类型: ### 有序合成配方 `minecraft:recipe_shaped`代表一个[**工作台**]的有序合成配方。 在`pattern`中可以使用任何除了空格(` `)以外的字符作为`key`,因为空格代表一个空的合成栏位。 配方的输出物品不能设置自定义NBT数据标签。 **配方共同属性** ```css . ├── pattern:由单字符键所组成的数组,用于描述一个2×2或3×3的有序合成图案。该数组中的一个字符串代表合成方格中的一行。每个字符串应写至多3个键,并且包含键的个数应当相同。空格代表一个空的合成栏位。 └── key:所有该有序合成配方用到的键。 | ├── one-key:该键所代表的物品。 | │ └── item:物品ID | | └── data:物品附加值 | ├── one-key:该键所代表的物品。 | │ └── item:物品ID | | └── data:物品附加值 └── result:该配方的输出物品。可以是数组,包含多个输出物品。 ├── item:物品ID ├── data:物品附加值 ``` 例子:木锹 + 木板 合成 船 ```json { "format_version": "1.20.10", "minecraft:recipe_shaped": { "description": { "identifier": "netease:acacia_boat" }, "tags": ["crafting_table"], "pattern": [ "#P#", "###" ], "key": { "P": {"item": "minecraft:wooden_shovel"}, "#": {"item": "minecraft:planks", "data": 4} }, "unlock": {"context": "PlayerInWater"}, "result": {"item": "minecraft:boat", "data": 4} } } ``` ### 无序合成配方 `minecraft:recipe_shapeless`代表一个[**工作台**]的无序合成配方。 配方的输出物品不能设置自定义NBT数据标签。 **配方共同属性** ```css . └── ingredients:该无序合成配方的一系列原料。数量应在1至9个之间。 | ├── :该键所代表的物品。 | │ └── item:物品ID | | └── data:物品附加值 | ├── :该键所代表的物品。 | │ └── item:物品ID | | └── data:物品附加值 └── result:该配方的输出物品。与有序配方不同,只能有一个输出物品。 ├── item:物品ID ├── data:物品附加值 ├── count:物品个数 ``` 例子:闪长岩 + 圆石 -> 安山岩 ```json { "format_version": "1.12", "minecraft:recipe_shapeless": { "description": { "identifier": "minecraft:netease_andesite" }, "tags": [ "crafting_table" ], "ingredients": [ { "item": "minecraft:stone", "data": 3 }, { "item": "minecraft:cobblestone" } ], "result": { "item": "minecraft:stone", "data": 5, "count": 2 } } } ``` 其中,`ingredients`定义的数量应该在1~9之间。 ### 熔炉配方 `minecraft:recipe_furnace`代表一个[**熔炉**]配方。 **配方共同属性** ```css . └── input:熔炉配方的输入材料,放在熔炉左上方的格子里。 └── output:熔炉配方的输出物品,产出在熔炉右边的格子中。 ``` ![熔炉烧炼](../../picture/furnace_cactus.png) 例子:仙人掌 -> 仙人掌绿 ```json { "format_version": "1.12", "minecraft:recipe_furnace": { "description": { "identifier": "minecraft:netease_furnace_cactus" }, "tags": ["furnace"], "input": "minecraft:cactus", "output": "minecraft:dye:2" } } ``` ### 混合酿造配方 `minecraft:recipe_brewing_mix`代表一个[**酿造台**]混合酿造配方。 混合酿造配方,指的是将一个具有某种状态效果的药水放入酿造台后,再加入某个物品,可以酿造出具有另一种状态效果的药水的配方。 **配方共同属性** ```css . └── input:一个物品ID,该配方接受的药水类型。 └── reagent:一个物品ID,酿造所需要的额外物品。 └── output:该配方输出的药水类型。注:输出的物品无法和原来的物品合一起 ``` **注:输出的物品无法和原来的物品堆叠一起** 例子:粗制药水 + 烈焰粉 -> 力量药水 ```json { "format_version": "1.12", "minecraft:recipe_brewing_mix": { "description": { "identifier": "minecraft:netease_brew_awkward_blaze_powder" }, "tags": [ "brewing_stand" ], "input": "minecraft:potion_type:awkward", "reagent": "minecraft:blaze_powder", "output": "minecraft:potion_type:strength" } } ``` ### 换容酿造配方 `minecraft:recipe_brewing_container`代表一个[**酿造台**]换容酿造配方。 换容酿造配方,指的是一瓶药水被酿造后将会改变容器的配方。例如从普通玻璃瓶转换为喷溅型玻璃瓶或滞留型玻璃瓶等。 例子: ```json { "format_version": "1.12", "minecraft:recipe_brewing_container": { "description": { "identifier": "minecraft:netease_brew_potion_sulphur" }, "tags": [ "brewing_stand" ], "input": "minecraft:potion", "reagent": "minecraft:gunpowder", "output": "minecraft:splash_potion" } } ``` ### 锻造转换配方 `minecraft:recipe_smithing_transform`代表一个[**锻造台**]的锻造转换配方。 锻造转换配方用于定义锻造台中的输入物品、转换材料、锻造模板以及输出物品。只要物品具有特定的物品标签且类型为装备或者工具时,就会转换出对应的成品,并保留物品原先的属性。由于配方的限制,目前转换材料只能使用下界合金锭,相应的物品ID为"minecraft:netherite_ingot"。 例子: ```json { "format_version": "1.17", "minecraft:recipe_smithing_transform": { "description": { "identifier": "minecraft:smithing_netherite_boots" }, "tags": ["smithing_table"], "template": "minecraft:netherite_upgrade_smithing_template", "base": "minecraft:diamond_boots", "addition": "minecraft:netherite_ingot", "result": "minecraft:netherite_boots" } } ``` | 字段 | 名称 | 描述 | | --------- | -------- | ----------------------------------------------------------------------------------------------------- | | tags | 配方标签 | 请填写“smithing_table” | | template | 锻造模板 | 可不填,执行转换操作所需的锻造模板,物品需要具有minecraft:transform_templates标签才能放入对应槽位 | | base | 输入物品 | 要转换的物品。输入物品的属性将被复制到输出物品,物品需要具有minecraft:transformable_items标签才能放入对应槽位,例如原版盔甲和工具 | | addition | 转换材料 | 转换所需的材料。目前只支持minecraft:netherite_ingot(下界合金锭) | | result | 输出物品 | 转换后的结果物品 | ### 锻造纹饰配方 `minecraft:recipe_smithing_trim`代表一个[**锻造台**]的锻造纹饰配方。 锻造纹饰配方用于定义锻造台中的输入物品、纹饰材料、锻造模板。只要给予合适的材料,就会输出对应纹路的装备,并保留物品原先的属性。由于游戏自身的限制,目前锻造纹饰配方无法为自定义装备添加上原版或自定义的纹路。 例子:钻石靴 + 海岸纹饰模板 + 石英(表示白色) ```json { "format_version": "1.17", "minecraft:recipe_smithing_trim": { "description": { "identifier": "minecraft:smithing_diamond_boots_coast_quartz_trim" }, "tags": ["smithing_table"], "template": "minecraft:coast_armor_trim_smithing_template", "base": "minecraft:diamond_boots", "addition": "minecraft:quartz" } } ``` | 字段 | 名称 | 描述 | | --------- | -------- | -------------------- | | tags | 配方标签 | 请填写“smithing_table” | | template | 锻造模板 | 将决定盔甲纹饰的图案,物品需要具有minecraft:trim_templates标签才能放入对应槽位 | | base | 输入物品 | 物品需要具有minecraft:trimmable_armors标签才能放入对应槽位 | | addition | 转换材料 | 将决定盔甲纹饰的颜色,物品需要具有minecraft:trim_materials标签才能放入对应槽位 | 锻造转换配方和锻造纹饰配方需要物品具有特定的tag,需要在物品行为包添加[minecraft:tags](./1-自定义物品/1-自定义基础物品.md#minecraft-tags)组件。 ### tags说明 tags有以下几种值: #### crafting_table 使用工作台合成配方 #### stonecutter 使用切石机合成配方。注:由于**切石机**的合成格子只有一个,因此合成配方ingredients的物品的count值的和不能大于1! 例子: ```json { "format_version": "1.12", "minecraft:recipe_shapeless": { "description": { "identifier": "minecraft:netease_stonecutter_polished_andesite_slab" }, "tags": ["stonecutter"], "priority": 4, //对于多个配方, 优先级越高越先合成 "ingredients": [{ "item": "minecraft:stone", "data": 5 }], "result": { "item": "minecraft:double_stone_slab3", "data": 2, "count": 2 } } } ``` #### cartography_table 使用制图台合成配方 例子: ```python { "format_version": "1.12", "minecraft:recipe_shapeless": { "description": { "identifier": "minecraft:netease_cartography_table_locator_map" }, "tags": [ "cartography_table" ], "ingredients": [ { "item": "minecraft:paper" }, { "item": "minecraft:compass" } ], "result": { "item": "minecraft:emptymap", "data": 2 } } } ``` #### furnace 使用熔炉合成配方 熔炉(Furnace)是一种用来烧炼方块和物品并把它们转换为另一种方块或物品的方块。 #### blast_furnace 使用高炉合成配方 高炉(Blast Furnace)是与熔炉和烟熏炉相似的方块实体,专用于烧炼矿石、盔甲和工具。 #### smoker 使用烟熏炉合成配方 烟熏炉(Smoker)是屠夫村民的工作站点方块,是专门用于烹制熟食的熔炉变种。 #### campfire 使用营火合成配方 营火(Campfire) 是一种可用于烹饪食物并作为光源或烟雾信号使用的方块。 #### brewing_stand 酿造台配方 酿造台(Brewing Stand)是一个用于酿造药水、喷溅药水和滞留药水的方块。 #### smithing_table 锻造台配方 锻造台(Smithing Table)是一个用于升级下界合金装备、添加盔甲纹饰的方块。 ***其中需要注意的是data为item对应的附加值** ## 使用标签 在过去,假如你想支持任意原木合成家具,你需要添加多个配方(log、log2、以及后续更新的原木)。还需要时刻关注游戏更新,因为每新增一种原木,开发者就需要额外增加一个配方。 好消息是,在1.19.50之后,可以使用tag代替原来的item字段,将标签用作配方输入,直接表示一类物品,使合成表配置更简单。 例如,箱子支持任意木板合成: ``` { "format_version": "1.20.10", "minecraft:recipe_shaped": { "description": { "identifier": "minecraft:Chest_recipeId" }, "tags": ["crafting_table"], "pattern": [ "AAA", "A A", "AAA" ], "key": { "A": { "tag": "minecraft:planks" } }, "unlock": { "context": "PlayerHasManyItems" }, "result": { "item": "chest", "count": 1 } } } ``` 以下是支持的标签列表: - 箭 - "minecraft:arrow"(普通箭、药水箭) - 旗帜 - "minecraft:banner" - 船 - "minecraft:boats" - 箱子船 - "minecraft:chest_boat" - 书架书籍 - "minecraft:bookshelf_books"(书、书与笔、成书、附魔书) - 讲台书籍 - "minecraft:lectern_books"(书与笔、成书) - 木等级 - "minecraft:wooden_tier"(木剑、木镐、木斧、木锹、木锄) - 金等级 - "minecraft:golden_tier"(金剑、金镐、金斧、金锹、金锄、金盔甲) - 石等级 - "minecraft:stone_tier"(石剑、石镐、石斧、石锹、石锄) - 铁等级 - "minecraft:iron_tier"(铁剑、铁镐、铁斧、铁锹、铁锄、铁盔甲) - 钻石等级 - "minecraft:diamond_tier"(钻石剑、钻石镐、钻石斧、钻石锹、钻石锄、钻石盔甲) - 下界合金等级 - "minecraft:netherite_tier"(下界合金剑、下界合金镐、下界合金斧、下界合金锹、下界合金锄、下界合金盔甲) - 盔甲 - "minecraft:is_armor" - 锁链等级 - "minecraft:chainmail_tier"(锁链盔甲) - 皮革等级 - "minecraft:leather_tier"(皮革盔甲) - 马铠 - "minecraft:horse_armor"(铁马铠、金马铠、钻石马铠、皮革马铠) - 工具 - "minecraft:is_tool"(剑、镐、斧、锹、锄) - 挖掘工具 - "minecraft:digger"(铁锹、金锹、钻石锹、石锹、木锹、下界合金锹) - 斧头 - "minecraft:is_axe"(木斧、石斧、铁斧、金斧、钻石斧、下界合金斧) - 锄头 - "minecraft:is_hoe"(木锄、石锄、铁锄、金锄、钻石锄、下界合金锄) - 剑 - "minecraft:is_sword"(木剑、石剑、铁剑、金剑、钻石剑、下界合金剑) - 铲子 - "minecraft:is_shovel"(木铲、石铲、铁铲、金铲、钻石铲、下界合金铲) - 镐 - "minecraft:is_pickaxe"(木镐、石镐、铁镐、金镐、钻石镐、下界合金镐) - 煤碳 - "minecraft:coals"(煤炭、木炭) - 绯红茎 - "minecraft:crimson_stems"(绯红菌柄、绯红菌核、绯红菌丝) - 诡异茎 - "minecraft:warped_stems"(诡异菌柄、诡异菌核、诡异菌丝) - 门 - "minecraft:door" - 鱼 - "minecraft:is_fish"(生鳕鱼、生鲑鱼、热带鱼、河豚) - 食物 - "minecraft:is_food"(苹果、面包、胡萝卜、熟牛排、熟猪排、熟鸡肉、熟羊排、熟兔肉、熟鳕鱼、熟鲑鱼、金苹果) - 熟食 - "minecraft:is_cooked"(熟牛排、熟猪排、熟鸡肉、熟羊排、熟兔肉、熟鳕鱼、熟鲑鱼) - 肉类 - "minecraft:is_meat"(牛肉、猪肉、鸡肉、羊肉、兔肉) - 悬挂实体 - "minecraft:hanging_actor"(画、物品展示框) - 悬挂告示牌 - "minecraft:hanging_sign" - 原木 - "minecraft:logs" - 可燃原木 - "minecraft:logs_that_burn"(不包括:绯红菌柄、扭曲菌柄) - 红树原木 - "minecraft:mangrove_logs"(红树原木) - 木板 - "minecraft:planks" - 木台阶 - "minecraft:wooden_slabs" - 矿车 - "minecraft:is_minecart"(矿车、带箱子的矿车、带漏斗的矿车、带TNT的矿车) - 音乐唱片 - "minecraft:music_disc" - 猪灵喜爱物 - "minecraft:piglin_loved"(金锭、金块、金苹果、附魔金苹果、金盔甲、金工具、金剑、金靴子、金头盔) - 猪灵驱避物 - "minecraft:piglin_repellents"(灵魂火炬、灵魂灯笼、灵魂营火) - 沙子 - "minecraft:sand"(沙子、红沙) - 告示牌 - "minecraft:sign" - 灵魂火焰基块 - "minecraft:soul_fire_base_blocks"(灵魂沙、灵魂土) - 生物蛋 - "minecraft:spawn_egg"(僵尸生成蛋、骷髅生成蛋、蜘蛛生成蛋、爬行者生成蛋、村民生成蛋等) - 石砖 - "minecraft:stone_bricks"(石砖、青苔石砖、裂石砖、雕刻石砖) - 石头合成材料 - "minecraft:stone_crafting_materials"(圆石、黑石、石头) - 石头工具材料 - "minecraft:stone_tool_materials"(圆石、黑石) - 振动减震器 - "minecraft:vibration_damper"(羊毛、地毯) - 羊毛 - "minecraft:wool" ## 配方解锁 从1.20.10版本开始,游戏加入了配方解锁功能,支持在配方JSON中使用`unlock`字段来控制配方解锁方式。玩家可以在设置-游戏-世界选项中关闭配方解锁功能。 目前**有序合成配方**、**无序合成配方**、**熔炉配方**已支持配方解锁功能。 和国际版不同,为了兼容旧版组件,若自定义配方缺乏unlock字段,且format_version小于1.20.10时,默认解锁配方。 ``` { "format_version": "1.20.10", "minecraft:recipe_shaped": { ... "unlock": { "context": "AlwaysUnlocked" } ... } } ``` ### 基于物品解锁 指定用于解锁的物品列表,可以使用`tag`字段指定某一类物品。 金合欢木板: ```json "unlock": [ { "item": "minecraft:wood", "data": 4 } ], ``` 熔炉: ```json "unlock": [ { "tag": "minecraft:stone_crafting_materials" } ], ``` ### 基于条件解锁 解锁条件可以是以下三种值之一: - **AlwaysUnlocked**:总是解锁此配方 - **PlayerInWater**:玩家进入水中 - **PlayerHasManyItems**:玩家背包有至少10格物品 工作台: ```json "unlock": { "context": "AlwaysUnlocked" }, ``` 箱子: ```json "unlock": { "context": "PlayerHasManyItems" }, ``` 船: ```json "unlock": { "context": "PlayerInWater" }, ``` ## 支持耐久度配置的配方 目前【工作台】**有序合成配方**与**无序合成配方**已支持配置耐久度。 例子: ``` { "format_version": "1.12", "minecraft:recipe_shaped": { "description": { "identifier": "minecraft:recipe_shaped_test14" }, "tags": ["crafting_table"], "pattern": [ " P#", " # " ], "key": { "P": { "item": "minecraft:diamond_sword", "durability": [1, 1560] }, "#": { "item": "minecraft:iron_sword" } }, "result": { "item": "minecraft:bow", "durability": [1, 300] } } } ``` 该例子表示一把耐久度在1至1560之间的钻石剑和两把任意耐久度的铁剑合成一把耐久度在1至300之间的弓。配置耐久度格式为`"durability": [min, max]`,其中min和max均为正整数,且max大于等于min。生成物品的耐久度为min与max之间的随机值,若大于物品的最大耐久度将以物品的最大耐久度为准。 **注:若生成物品配置了耐久度参数且该物品支持耐久度(如武器、装备等),在工作台生成预览界面中将随机显示该参数范围内的耐久度,但不代表最终耐久度。只有完成合成从工作台中取出合成物品时耐久度才最终确定。** ## 注意事项 如果配方的identifier和引擎的已有配方或者自己mod的已有配方重复,则这几个重复的配方将会只有其中一个生效(不保证是哪个),开发包也将会报一个**Recipe for ×× already exists**的错误。这个时候就要把配方的identifier修改成不同的即可