更新文档导航顺序,添加新页面和翻译内容

This commit is contained in:
boybook
2025-03-26 10:59:30 +08:00
parent 7de24ab663
commit 5382f625fc
41 changed files with 3591 additions and 3119 deletions

View File

@@ -1,10 +1,10 @@
---
title: Recipes
category: Documentation
title: 配方系统
category: 文档
nav_order: 3
tags:
- Stable
- Last updated for Version 1.20.30
- 稳定版本
- 最后更新于1.20.30版本
mentions:
- Ciosciaa
- SirLich
@@ -14,21 +14,25 @@ mentions:
- QuazChick
---
Recipes are the means of handling several item transactions, namely those occurring in crafting tables, furnaces, campfires, and brewing stands.
# 配方系统
<!--@include: @/wiki/bedrock-wiki-mirror.md-->
配方系统用于处理多种物品转换逻辑,包括工作台、熔炉、营火和酿造台的合成流程。
![](/assets/images/loot/recipes/recipe.png)
::: tip
Anvil interactions are handled within an [item definition](/wiki/items/item-components), not via recipe files. Loom transactions are currently unavailable.
铁砧交互通过[物品定义](/wiki/items/item-components)实现,而非配方文件。织布机交互当前暂不可用。
:::
No experimental toggles are required to use recipes or any of their features.
使用配方功能无需开启任何实验性选项。
### Registration
## 注册方式
All recipes are stored in the `recipes` folder in the behavior pack root. The files can be named and organized under any folder hierarchy as desired.
所有配方文件需存放在行为包根目录的`recipes`文件夹中,支持任意子目录结构和命名方式。
This arbitrary structure is used for the paths in this document:
以下示例展示了本文档采用的目录结构:
<FolderView
:paths="[
@@ -41,10 +45,10 @@ This arbitrary structure is used for the paths in this document:
]"
/>
As an example, a "cold steel sword" might be crafted using the following [shaped recipe](#shaped-recipes):
例如,可通过以下[有序配方](#有序配方)制作"寒钢剑"
<CodeHeader>BP/recipes/crafting/weapons/cold_steel_sword.json</CodeHeader>
```json
::: code-group
```json [BP/recipes/crafting/weapons/cold_steel_sword.json]
{
"format_version": "1.17.41",
"minecraft:recipe_shaped": {
@@ -77,211 +81,217 @@ As an example, a "cold steel sword" might be crafted using the following [shaped
}
}
```
## Shared Properties and Structures
### Format Version
The [format version](/wiki/guide/format-version) is intended to version the schema used for the body of a recipe. It is provided with the top-level `"format_version"` property.
<CodeHeader>#/</CodeHeader>
```json
"format_version": "1.17.41"
```
In practice, the format version can be set to any value or even omitted.
::: warning
It's strongly recommended to include a format version anyway, choosing a value that represents an actual Minecraft version to help future-proof the code. Consider using the current release version or last major release version.
:::
### Description
## 通用属性与结构
The `"description"` object, required within any recipe type, holds the identifier of a recipe.
### 格式版本
<CodeHeader>#/minecraft:recipe_shaped/</CodeHeader>
```json
[格式版本](/wiki/guide/format-version)用于标识配方文件的架构版本,通过顶层`"format_version"`属性指定。
::: code-group
```json [#/]
"format_version": "1.17.41"
```
:::
实际使用中格式版本可设为任意值或省略。
::: warning
强烈建议仍保留格式版本并选择与当前Minecraft版本匹配的值以保证未来兼容性。推荐使用最新正式版或上一个主版本号。
:::
### 描述信息
`"description"`对象是所有配方类型的必填项,用于声明配方唯一标识符。
::: code-group
```json [#/minecraft:recipe_shaped/]
"description": {
"identifier": "wiki:cold_steel_sword"
}
```
:::
Its only child is the required `"identifier"` property, which is designed to uniquely identify a recipe across all packs applied to a world. There are no namespacing requirements for recipe identifiers except that no two full recipe identifiers in a single pack may match.
其中必填的`"identifier"`属性用于在世界中所有行为包范围内唯一标识配方。单个包内不允许存在重复的完整配方ID。
::: warning
It's strongly recommended to use a namespace. Namespaces are a standard in other add-on domains and assist in logically scoping the recipe to a pack, lessening possibilities of collisions for players wanting to use multiple behavior packs in their world.
强烈建议使用命名空间。命名空间是附加组件领域的通用规范,有助于将配方逻辑归属到特定行为包,减少多包混用时发生冲突的可能性。
:::
### Tags
### 标签系统
Recipes are linked to crafting interfaces using the required `"tags"` array property, which must be placed within any recipe type. These tags will make the recipe be shared across different blocks that uses the `minecraft:crafting_table` component. When the recipe does not inlcude the `crafting_table` tag, or any vanilla tag, but a tag from your custom block, the recipe will only be shared to that custom block and not the crafting table/stonecutter/etc. At least one tag must be provided.
通过必填的`"tags"`数组属性将配方与合成界面关联,该属性需置于任何配方类型中。这些标签会使配方在具有`minecraft:crafting_table`组件的不同方块间共享。若配方不包含`crafting_table`标签或任何原版标签,但包含自定义方块的标签,则该配方仅适用于该自定义方块而非工作台/切石机等。必须提供至少一个标签。
<CodeHeader>#/minecraft:recipe_shaped/</CodeHeader>
```json
::: code-group
```json [#/minecraft:recipe_shaped/]
"tags": ["crafting_table", "altar"]
```
Vanilla interfaces are exposed to tags for each set of recipe types.
Crafting:
- `crafting_table`
- `stonecutter`
- `smithing_table`
:::
warning Note that if you want to make a smithing recipe, you will need to use `<namespace>:netherite_ingot` for the second slot, though using a different identifier will not work. **This no longer works after 1.18.30**.
:::
Cooking and Smelting:
原版界面为各类配方类型开放了对应标签:
- `furnace`
- `blast_furnace`
- `smoker`
- `campfire`
- `soul_campfire`
合成类:
- `crafting_table`
- `stonecutter`
- `smithing_table`
Brewing:
::: warning
注意:若要制作锻造台配方,第二个槽位必须使用`<命名空间>:netherite_ingot`,使用其他标识符将无效。**此特性在1.18.30后已失效**。
:::
- `brewing_stand`
熔炼类:
- `furnace`
- `blast_furnace`
- `smoker`
- `campfire`
- `soul_campfire`
Education:
酿造类:
- `brewing_stand`
- `material_reducer`
教育版:
- `material_reducer`
::: tip
Additionally, [custom crafting tables](/wiki/blocks/block-components#crafting-table) can declare a custom tag for crafting recipes to use. Custom cooking and smelting blocks and custom brewing stands are not currently available.
::: tip
此外,[自定义工作台](/wiki/blocks/block-components#crafting-table)可声明自定义标签供合成配方使用。目前不支持自定义熔炉和酿造台。
:::
::: tip
To effectively disable a recipe (useful for [overriding](#overrides) a prior recipe), set the tag array to `[""]`.
要禁用配方(常用于[覆盖](#覆盖机制)已有配方),可将标签数组设为`[""]`。
:::
### Recipe Unlocking
Minecraft 1.20.30 added recipe unlocking to the game. In order to have your recipes use this function, you `manifest.json` must have a `min_engine_version` of 1.20.11 (1.20.30 is recommender). You also need to add the `unlock` array with its objects to your recipe.
### 配方解锁
Minecraft 1.20.30新增了配方解锁功能。要使用此功能,需确保`manifest.json`中的`min_engine_version`至少为1.20.11(推荐1.20.30),并在配方中添加`unlock`数组:
```json
"unlock": [
{
"item": "wiki:cold_steel" //item to unlock recipe
"item": "wiki:cold_steel" //解锁配方所需物品
},
{
"item": "minecraft:wool", //item to unlock recipe
"item": "minecraft:wool", //解锁配方所需物品
"data": 3
},
{
"context": "PlayerInWater" //event to unlock recipe
"context": "PlayerInWater" //解锁配方所需事件
}
]
```
Each object in this array contains `"item"` and this tells the recipe what item the player needs in their inventory in order for this recipe to be unlocked. It also accepts data values. `"context"` is used to determine what event unlocks this recipe. `"PlayerInWater"` will unlock this recipe when the player enters water. This is also the only known context for recipes.
数组中每个对象的`"item"`字段表示玩家背包中需要存在的物品(支持数据值)。`"context"`字段表示触发解锁的事件,目前仅知`"PlayerInWater"`会在玩家入水时解锁配方。
### Item Descriptors
### 物品描述符
Working with recipes entails referencing items across a number of properties. Items may be provided in one of two formats: a string reference or an item object. Both formats have means of handling data values, but only the item object may be used to specify a count for that item (usable in recipe outputs). For recipe inputs, if no data value is provided, items with any data value under that identifier will be usable for that input. The data value for an output defaults to `0` if one is not explicitly provided. Selecting recipe inputs by item tags is not supported.
配方系统中涉及多种物品引用方式,支持两种格式:字符串引用和物品对象。两种格式均可处理数据值,但只有物品对象能指定数量(用于配方输出)。对于配方输入,若未指定数据值,则该标识符下任意数据值的物品都可用作输入。输出物品的数据值默认为`0`(若未显式指定)。不支持通过物品标签选择配方输入。
#### String Reference
#### 字符串引用
Generally, a string reference is just the namespace and identifier combination for that item:
基本格式为物品的命名空间加标识符组合:
<CodeHeader>#/minecraft:recipe_shapeless/ingredients/0</CodeHeader>
```json
::: code-group
```json [#/minecraft:recipe_shapeless/ingredients/0]
"minecraft:planks"
```
:::
String references additionally support specification of a data value as a suffix:
字符串引用还支持通过后缀指定数据值:
<CodeHeader>#/minecraft:recipe_shapeless/ingredients/0</CodeHeader>
```json
::: code-group
```json [#/minecraft:recipe_shapeless/ingredients/0]
"minecraft:planks:2"
```
:::
#### Item Object
#### 物品对象
The item object is a more explicit construct for referencing items.
物品对象提供了更明确的物品引用结构。
<CodeHeader>#/minecraft:recipe_shapeless/ingredients/0</CodeHeader>
```json
::: code-group
```json [#/minecraft:recipe_shapeless/ingredients/0]
{
"item": "minecraft:planks",
"data": 2,
"count": 3
}
```
:::
The required `"item"` property functions the same as the string reference format. Although an explicit data field is available, the data suffix string format is still supported in the `"item"` property. However, unlike the suffix form, `"data"` can accept Molang. The Molang here is evaluated once on world load, not per-crafting attempt. Variables cannot be used to pass data between properties in a recipe. Furthermore, the nature of input items cannot be queried. Currently, the only known usable query in the `"data"` property is `q.get_actor_info_id`, used to look up the ID of an entity's spawn egg by its identifier:
必填的`"item"`属性功能同字符串引用。虽然提供了独立的数据字段,但`"item"`属性仍支持数据值后缀格式。不同于后缀形式,`"data"`可接受Molang表达式该表达式仅在世界加载时计算一次而非每次合成时计算。无法通过变量在配方属性间传递数据。目前已知`"data"`属性中唯一可用的查询是`q.get_actor_info_id`用于通过实体标识符获取其刷怪蛋ID
<CodeHeader>#/minecraft:recipe_shapeless/result</CodeHeader>
```json
::: code-group
```json [#/minecraft:recipe_shapeless/result]
{
"item": "minecraft:spawn_egg",
"data": "q.get_actor_info_id('minecraft:chicken')"
}
```
:::
The optional integer `"count"` property may be used to stack items. It defaults to `1`. Currently, setting the count only functions in [crafting](#crafting) and [furnace](#heating) recipe outputs and [shapeless recipe ingredients](#ingredients). A provided count is ignored in other locations.
可选的整数`"count"`属性用于堆叠物品,默认为`1`。当前仅在[合成](#合成)与[熔炼](#加热)配方输出及[无序配方原料](#原料)中有效,其他场景下会被忽略。
::: tip NOTE
If a count greater than `1` is provided for an item that does not stack, an error will be thrown. There is no way to force single-return recipe outputs, like those in shapeless recipes or brewing mixes, to return multiple items in one transaction.
::: tip 注意
若对不可堆叠物品设置数量大于`1`,将抛出错误。无法强制单次返回多个合成输出(如无序配方或酿造混合产物)。
:::
::: warning
Despite having similarities to trade [table item descriptors](/wiki/loot/trade-tables#items), recipe item descriptors cannot use functions.
尽管与交易[表物品描述符](/wiki/loot/trade-tables#items)相似,配方物品描述符不能使用函数。
:::
#### Identifier Additions
#### 特殊标识符
Additional identifiers not typically usable are available to recipes to describe basic potions.
配方系统额外支持描述基础药水的特殊标识符。
<CodeHeader>#/minecraft:recipe_brewing_mix/input</CodeHeader>
```json
::: code-group
```json [#/minecraft:recipe_brewing_mix/input]
"minecraft:potion_type:strength"
```
:::
These identifiers are not usable in the object notation, only the string notation. Variants are unavailable for splash and lingering potions. All such identifiers follow the format: <code>minecraft:potion_type:<em>potion_effect</em></code>, where <code><em>potion_effect</em></code> can be one of the following:
这些标识符仅支持字符串格式,不支持对象格式,且无喷溅/滞留药水变种。所有此类标识符遵循格式:<code>minecraft:potion_type:<em>药水效果</em></code>,其中<code><em>药水效果</em></code>可为以下之一:
- `water`
- `awkward`
- `mundane`
- `thick`
- `healing`
- `regeneration`
- `swiftness`
- `strength`
- `harming`
- `poison`
- `slowness`
- `weakness`
- `water_breathing`
- `fire_resistance`
- `nightvision`
- `invisibility`
- `leaping`
- `slow_falling`
- `turtle_master`
- `wither`
- `water`(水)
- `awkward`(粗制的)
- `mundane`(平凡的)
- `thick`(浓稠的)
- `healing`(治疗)
- `regeneration`(再生)
- `swiftness`(迅捷)
- `strength`(力量)
- `harming`(伤害)
- `poison`(剧毒)
- `slowness`(缓慢)
- `weakness`(虚弱)
- `water_breathing`(水下呼吸)
- `fire_resistance`(抗火)
- `nightvision`(夜视)
- `invisibility`(隐身)
- `leaping`(跳跃)
- `slow_falling`(缓降)
- `turtle_master`(神龟)
- `wither`(衰变)
Where supported, `long_` and `strong_` prefixes may be used to designate modified potions, such as `minecraft:potion_type:strong_poison`.
支持添加`long_`和`strong_`前缀表示强化药水,如`minecraft:potion_type:strong_poison`。
## Crafting
## 合成系统
Crafting operations instantly transform inputs to outputs using crafting grids. Two crafting recipe types are available: [shapeless recipes](#shapeless-recipes), whose inputs may be arranged in any way, and [shaped recipes](#shaped-recipes), used to define strict arrangements of inputs.
Crafting recipes support both crafting tables and stonecutters:
合成操作通过合成网格即时转换物品。支持两种配方类型:[无序配方](#无序配方)(原料可任意排列)和[有序配方](#有序配方)(需严格排列原料)。
合成配方同时支持工作台和切石机:
<CodeHeader>#/minecraft:recipe_shapeless/</CodeHeader>
```json
::: code-group
```json [#/minecraft:recipe_shapeless/]
"tags": ["crafting_table", "stonecutter"]
```
:::
`"crafting_table"` applies to both vanilla crafting tables and the player 2 × 2 crafting grid in their inventory. There is currently no way to opt into one but not the other. Crafting recipes additionally support custom tags, linking recipes to a [crafting grid provided by a custom block](/wiki/blocks/block-components#crafting-table).
`"crafting_table"`同时适用于原版工作台和玩家物品栏中的2×2合成网格当前无法单独启用其中一种。合成配方还支持自定义标签可将配方关联到[自定义方块提供的合成网格](/wiki/blocks/block-components#crafting-table)。
### Shapeless Recipes
### 无序配方
Shapeless recipes simply bind a collection of inputs to a single output on a crafting grid.
无序配方将原料集合与单个输出简单绑定。
![](/assets/images/loot/recipes/shapeless_recipe.png)
<CodeHeader>BP/recipes/decorations/knobs/brass.json</CodeHeader>
```json
::: code-group
```json [BP/recipes/decorations/knobs/brass.json]
{
"format_version": "1.17.41",
"minecraft:recipe_shapeless": {
@@ -316,13 +326,14 @@ Shapeless recipes simply bind a collection of inputs to a single output on a cra
}
}
```
:::
#### Ingredients
#### 原料配置
The required `"ingredients"` array property lists the items required as inputs for the crafting recipe.
必填的`"ingredients"`数组列出了合成所需的原料物品。
<CodeHeader>#/minecraft:recipe_shapeless/</CodeHeader>
```json
::: code-group
```json [#/minecraft:recipe_shapeless/]
"ingredients": [
"wiki:brass",
{
@@ -331,29 +342,31 @@ The required `"ingredients"` array property lists the items required as inputs f
}
]
```
:::
Each entry is an [item descriptor](#item-descriptors). If an ingredient provides a count, that count must be expressed across multiple crafting grid slots. Using stacked items in a single grid slot to yield a product is unsupported. If the items required for crafting are available but the count of ingredients is greater than the crafting interface being used supports, the recipe will automatically be made unavailable in the recipe book.
每项均为[物品描述符](#物品描述符)。若原料设置了数量,该数量必须通过多个合成网格槽位实现(单个槽位堆叠物品无法用于合成)。当所需物品存在但原料数量超过当前合成界面容量时,配方书会自动将该配方标记为不可用。
#### Shapeless Results
#### 无序配方输出
Shapeless recipe outputs are expressed using the required `"result"` property and may be expressed as either an [item descriptor](#item-descriptors) or an array of a single item descriptor.
通过必填的`"result"`属性声明输出,可以是[物品描述符](#物品描述符)或单物品描述符的数组。
<CodeHeader>#/minecraft:recipe_shapeless/</CodeHeader>
```json
::: code-group
```json [#/minecraft:recipe_shapeless/]
"result": {
"item": "wiki:door_knob",
"data": 3
}
```
:::
### Shaped Recipes
### 有序配方
Shaped recipes enforce that the ingredients used during crafting conform to a strict shape.
有序配方要求原料必须按特定图案排列。
![](/assets/images/loot/recipes/shaped_recipe.png)
<CodeHeader>BP/recipes/covered_arch.json</CodeHeader>
```json
::: code-group
```json [BP/recipes/covered_arch.json]
{
"format_version": "1.17.41",
"minecraft:recipe_shaped": {
@@ -385,7 +398,6 @@ Shaped recipes enforce that the ingredients used during crafting conform to a st
"result": [
{
"item": "wiki:covered_arch",
"count": 3
},
"wiki:crafting_scrap"
@@ -393,70 +405,75 @@ Shaped recipes enforce that the ingredients used during crafting conform to a st
}
}
```
:::
#### Patterns
#### 图案定义
The required `"pattern"` array property establishes the shape used for the recipe.
必填的`"pattern"`数组属性用于建立配方图案。
<CodeHeader>#/minecraft:recipe_shaped/</CodeHeader>
```json
::: code-group
```json [#/minecraft:recipe_shaped/]
"pattern": [
"SSS",
"I I",
"I I"
]
```
Each entry in the array is a string representing a row in the crafting grid. Each character in each string represents a slot within that row. Spaces by default represent slots that should be empty.
Characters act as a shorthand to visually describe an item. Each distinct character is matched with a [key](#keys) that dictates what item should be present in that slot.
::: tip
If the pattern is only comprised of spaces, empty crafting interfaces able to fit that pattern's size will constantly match the recipe. A player may retrieve an infinite amount of the crafting output, including immediately filling their inventory to the limit upon shift-retrieving the result.
:::
##### Row Normalization
数组每项代表合成网格的一行,字符串每个字符代表该行的槽位。默认空格表示该槽位需留空。
The pattern grid must be at most 3 × 3 but may be smaller. If string lengths are mismatched, Minecraft will automatically extend shorter strings, implying spaces in filled slots. The following two are equivalent:
字符作为物品的视觉简写,每个独特字符需与[键定义](#键定义)匹配以指定对应槽位的物品。
<CodeHeader>#/minecraft:recipe_shaped/</CodeHeader>
```json
::: tip
若图案全由空格组成任何能容纳该图案尺寸的空合成界面都会持续匹配该配方。玩家可无限获取输出物品包括通过Shift键一次性填满背包。
:::
##### 行标准化
图案网格最大为3×3可更小。若字符串长度不一致Minecraft会自动补全较短字符串用空格填充空缺槽位。以下两组定义等效
::: code-group
```json [#/minecraft:recipe_shaped/]
"pattern": [
"MA",
"IFI",
"M"
]
```
:::
<CodeHeader>#/minecraft:recipe_shaped/</CodeHeader>
```json
::: code-group
```json [#/minecraft:recipe_shaped/]
"pattern": [
"MA ",
"IFI",
"M "
]
```
::: tip NOTE
Currently, no crafting grids, including those configurable from custom blocks, may be larger than 3 × 3. If the expressed pattern is unusable within the current crafting interface, the recipe will automatically be unavailable in the recipe book.
:::
##### Grid Freedom
::: tip 注意
当前所有合成网格包括自定义方块配置的最大不超过3×3。若图案超出当前合成界面容量配方书会自动将其标记为不可用。
:::
Spaces are not automatically implied to fill in any remaining slots in the 3 × 3 space. If a provided pattern is smaller than the crafting grid being used, the pattern can be used anywhere so long as the structure and contents are maintained. As an example, consider the following pattern on a crafting table:
##### 网格自由度
<CodeHeader>#/minecraft:recipe_shaped/</CodeHeader>
```json
空格不会自动填充3×3网格的剩余槽位。若提供的图案小于当前合成网格只要保持结构和内容图案可在网格任意位置使用。例如以下图案在工作台上的表现
::: code-group
```json [#/minecraft:recipe_shaped/]
"pattern": [
"O"
"OO"
]
```
:::
The "L" shape isn't restricted to the upper-left corner of the crafting grid. Using a 3 × 3 grid as an example, the pattern would be usable with any of these configurations:
"L"形图案不限左上角位置在3×3网格中可能配置如下
<Spoiler title="Possible Configurations">
*Underscores represent empty slots.*
<Spoiler title="可能的配置">
*下划线代表空槽位*
```txt
O__
OO_
@@ -479,87 +496,91 @@ _OO
```
</Spoiler>
To restrict placements to a particular location, use explicit spaces, which enforce empty slots in certain locations. The following is only usable in the upper-left corner of a grid:
要限制位置需显式使用空格强制某些槽位留空。以下图案仅能在网格左上角使用:
<CodeHeader>#/minecraft:recipe_shaped/</CodeHeader>
```json
::: code-group
```json [#/minecraft:recipe_shaped/]
"pattern": [
"O "
"OO "
" "
]
```
:::
##### Symmetry
##### 对称性
All shaped recipes are innately horizontally symmetric:
所有有序配方默认具有水平对称性:
<CodeHeader>#/minecraft:recipe_shaped/</CodeHeader>
```json
::: code-group
```json [#/minecraft:recipe_shaped/]
"pattern": [
"Z "
" Z "
" Z"
]
```
:::
The preceding recipe may also be used by a player as though it were set to:
该配方也可被玩家视为以下形式使用:
<CodeHeader>#/minecraft:recipe_shaped/</CodeHeader>
```json
::: code-group
```json [#/minecraft:recipe_shaped/]
"pattern": [
" Z"
" Z "
"Z "
]
```
:::
#### Keys
#### 键定义
Keys provide meaning to characters in a [pattern](#patterns), done via the required `"key"` object property, which maps key names to [item descriptors](#item-descriptors).
通过必填的`"key"`对象属性将图案字符映射到[物品描述符](#物品描述符)。
<CodeHeader>#/minecraft:recipe_shaped/</CodeHeader>
```json
::: code-group
```json [#/minecraft:recipe_shaped/]
"key": {
"S": "wiki:cloth",
"I": "wiki:support"
}
```
:::
Every key present in the pattern should be accounted for here. Keys names are case-sensitive. If an item supports multiple data values and no data value is provided, any item of that identifier will be usable for that key. Any `"count"` property present in an item descriptor is ignored and regarded as `1`; stacked items in a crafting grid slot are only consumable one at a time.
图案中每个字符都需在此定义。键名区分大小写。若物品支持多数据值且未指定数据值,该标识符下任意数据值的物品都可用于该键。物品描述符中的`"count"`属性会被忽略并视为`1`;合成网格槽位中的堆叠物品每次仅消耗一个。
::: tip NOTE
Any unicode character from `U+0020` to `U+07FF` may be used as a key name. If a key name has more than one character, only the first character is considered. Since spaces are by default used to signify empty slots on a grid and there's no way to re-designate a key for a blank slot, it's not recommended to use them as a key.
::: tip 注意
可使用`U+0020`到`U+07FF`间的任意Unicode字符作为键名。若键名超过一个字符仅首字符有效。由于空格默认表示网格空槽且无法重新定义不建议将其作为键。
:::
::: warning
If a character in the pattern is not present in the key map, it will be treated as though it were a space, a designated empty tile.
若图案字符未在键映射中定义,将被视为空格(空槽位)。
:::
### Recipe Unlocking
Minecraft 1.20.30 added recipe unlocking to the game. In order to have your recipes use this function, you `manifest.json` must have a `min_engine_version` of 1.20.11 (1.20.30 is recommender). You also need to add the `unlock` array with its objects to your recipe.
### 配方解锁
Minecraft 1.20.30新增配方解锁功能。要使用此功能,需确保`manifest.json`中的`min_engine_version`至少为1.20.11(推荐1.20.30),并在配方中添加`unlock`数组:
```json
"unlock": [
{
"item": "wiki:cold_steel" //item to unlock recipe
"item": "wiki:cold_steel" //解锁配方所需物品
},
{
"item": "minecraft:wool", //item to unlock recipe
"item": "minecraft:wool", //解锁配方所需物品
"data": 3
},
{
"context": "PlayerInWater" //event to unlock recipe
"context": "PlayerInWater" //解锁配方所需事件
}
]
```
Each object in this array contains `"item"` and this tells the recipe what item the player needs in their inventory in order for this recipe to be unlocked. `"context"` is used to determine what event unlocks this recipe. `"PlayerInWater"` will unlock this recipe when the player enters water. This is also the only known context for recipes.
数组中每个对象的`"item"`字段表示玩家背包中需要存在的物品。`"context"`字段表示触发解锁的事件,目前仅知`"PlayerInWater"`会在玩家入水时解锁配方。
#### Shaped Results
#### 有序配方输出
Shaped crafting recipe outputs behave very similarly to their [shapeless counterparts](#shapeless-results). Unlike array results for shapeless recipes, however, shaped recipe result arrays may contain more than one [item descriptor](#item-descriptors).
有序配方输出行为与[无序配方](#无序配方输出)相似。不同于无序配方的是,有序配方的输出数组可包含多个[物品描述符](#物品描述符)。
<CodeHeader>#/minecraft:recipe_shaped/</CodeHeader>
```json
::: code-group
```json [#/minecraft:recipe_shaped/]
"result": [
{
"item": "wiki:covered_arch",
@@ -568,56 +589,59 @@ Shaped crafting recipe outputs behave very similarly to their [shapeless counter
"wiki:crafting_scrap"
]
```
The first entry in the array will be used as the visible output of the crafting block. All other values are automatically placed in the player's inventory upon removing the visible result from the output slot. There does not seem to be a limit on the number of items that may be returned from a crafting action.
::: tip NOTE
Any items not able to fit in the player's inventory are instead placed in the input slots of the crafting table left-to-right and then top-to-bottom. Anything not able to fit there is then thrown from the player as though they had used the "Drop Item" action.
:::
### Recipe Book
数组首项将作为合成方块的可见输出,其余项会在玩家取走可见输出后自动放入背包。目前似乎没有对单次合成返回物品数量的限制。
The recipe book automatically indexes and displays available recipes to the player, intelligently accounting for [ingredient counts](#ingredients) in shapeless recipes or [pattern constraints](#patterns) in shaped recipes. When multiple recipes point to the same output, the recipe book uses its own unique prioritization system.
::: tip 注意
无法放入背包的物品会按从左到右、从上到下的顺序放回合成输入槽。若仍无法容纳,则会像玩家执行"丢弃物品"操作一样抛出。
:::
When both recipes being compared are shapeless recipes, the following rules determine prioritization in order:
### 配方书
- Lower ingredient count of the _first_ listed ingredient
- More negative [priority](#priority)
- Lower-valued identifier string
配方书自动索引并显示可用配方,智能考虑无序配方的[原料数量](#原料配置)或有序配方的[图案限制](#图案定义)。当多个配方指向相同输出时,配方书使用独特优先级系统。
For shaped recipes, recipes with "lesser" identifiers, when compared as strings, are always prioritized.
比较两个无序配方时,按以下顺序确定优先级:
1. 第一个列出原料的较低数量
2. 更小的[优先级值](#优先级)
3. 字典序较小的标识符字符串
When comparing a shaped recipe to a shapeless recipe, the rules for comparing shapeless recipes are used; however, the interpreted count of ingredients for the shaped recipe is different from its actual ingredient count. Exactly how the ingredient count for a shaped recipe is determined is unknown.
对于有序配方,字典序较小的标识符始终优先。
### Grouping
比较有序与无序配方时,使用无序配方规则,但有序配方的原料数量计算方式不同(具体机制未知)。
This section is included informatively. Groups are present in crafting recipes in vanilla definitions, given with the optional `"group"` string property.
### 分组系统
<CodeHeader>#/minecraft:recipe_shaped/</CodeHeader>
```json
本节为信息性说明。原版定义中的合成配方包含可选的`"group"`字符串属性。
::: code-group
```json [#/minecraft:recipe_shaped/]
"group": "slingshots"
```
:::
It is currently unknown what, if anything, this property achieves. Presumably, it would be used with the [recipe book](#recipe-book). Neither using new custom groups nor reusing groups from vanilla definitions appear to achieve anything.
目前未知该属性的具体作用(推测与[配方书](#配方书)相关)。使用自定义分组或复用原版分组均未观察到实际效果。
### Priority
### 优先级
Crafting recipes support an additional property for handling input collisions, `"priority"`, which primarily acts as a [tiebreaker](#prioritization) when multiple recipes could possibly apply to the given situation. Priorities are provided directly within the crafting recipe type object.
合成配方支持额外的`"priority"`属性处理输入冲突,主要在[优先级排序](#优先级排序)时作为决胜条件。
<CodeHeader>#/minecraft:recipe_shaped/</CodeHeader>
```json
::: code-group
```json [#/minecraft:recipe_shaped/]
"priority": 2
```
:::
Crafting recipes with lower priority values take precedence. So, if all else is equal, a recipe with a priority of `0` would be used over a recipe with priority `1`. Priorities may be negative if necessary. If `"priority"` is not provided, a priority of `0` is implied.
数值较小的配方优先级更高(如优先级`0`优于`1`)。支持负值,未提供时默认为`0`。
## Heating
## 加热系统
Furnace recipes are used to transform an item using a heat source over a period of time. A slight misnomer, furnace recipes are used with any interface that involves a heat source, including campfires.
熔炉配方通过热源随时间转换物品。虽然名称局限,实际适用于所有热源界面(包括营火)。
![](/assets/images/loot/recipes/furnace_recipe.png)
<CodeHeader>BP/recipes/magic/magic_ash.json</CodeHeader>
```json
::: code-group
```json [BP/recipes/magic/magic_ash.json]
{
"format_version": "1.17.41",
"minecraft:recipe_furnace": {
@@ -633,71 +657,76 @@ Furnace recipes are used to transform an item using a heat source over a period
}
}
```
:::
All vanilla heating blocks are supported via tags.
支持所有原版加热方块的标签:
<CodeHeader>#/minecraft:recipe_furnace/</CodeHeader>
```json
::: code-group
```json [#/minecraft:recipe_furnace/]
"tags": ["furnace", "blast_furnace", "smoker", "campfire", "soul_campfire"]
```
:::
### Heating Transactions
### 加热转换
Furnace recipes bind exactly one input [item descriptor](#item-descriptors) to exactly one output item descriptor.
熔炉配方将单个输入[物品描述符](#物品描述符)绑定到单个输出物品描述符。
<CodeHeader>#/minecraft:recipe_furnace/</CodeHeader>
```json
::: code-group
```json [#/minecraft:recipe_furnace/]
"input": "wiki:bone_fragments"
"output": {
"item": "wiki:magic_ash",
"count": 4
}
```
:::
Any count given in the input is ignored. XP returns and fuel sources for a cooking and smelting recipe cannot be altered. The time required to heat an item is set by the used block and is unchangeable.
输入中的数量值会被忽略。无法修改经验返还和燃料设定,加热时间由使用的方块决定且不可更改。
## Brewing
## 酿造系统
Brewing recipes are used to transform an item using another item as a catalyst. Two brewing recipe types are available: [brewing mixes](#brewing-mixes), which do not transition data from input to output, and [brewing containers](#brewing-containers), which do.
酿造配方通过催化剂物品转换另一物品。支持两种类型:[酿造混合](#酿造混合)(不传递输入输出数据)和[酿造容器](#酿造容器)(传递数据)。
Only one interface supports brewing recipes:
仅一种界面支持酿造配方:
<CodeHeader>#/minecraft:recipe_brewing_container/</CodeHeader>
```json
::: code-group
```json [#/minecraft:recipe_brewing_container/]
"tags": ["brewing_stand"]
```
:::
### Brewing Transactions
### 酿造转换
Brewing transactions are similar to [heating transactions](#heating-transactions), requiring an input and output, each pointing to a single [item descriptor](#item-descriptors). Brewing recipes, however, also require the `"reagent"` property as a catalyst, which also can only point to a single item descriptor.
酿造转换类似[加热转换](#加热转换),需要输入和输出各一个[物品描述符](#物品描述符)。此外还需`"reagent"`属性作为催化剂(也仅接受单个物品描述符)。
<CodeHeader>#/minecraft:recipe_brewing_mix/</CodeHeader>
```json
::: code-group
```json [#/minecraft:recipe_brewing_mix/]
"input": "wiki:flask",
"reagent": "wiki:jade",
"output": "wiki:insanity_resistance"
```
Provided count values are ignored in these brewing properties. Items are meant to transform one at a time in a brew.
::: warning
If the input item for a brewing recipe has the ability to stack, the _entire_ stack will be consumed in the transformation. There are currently no workarounds to avoid this.
:::
After the brewing time has passed, the catalyst is consumed, and output items directly replace input items.
这些属性中的数量值会被忽略,物品每次转换一个。
::: warning
Currently, the stackability of the produced output is bugged, regardless of whether a data value was specified. In particular, the output is incompatible and will not stack with items of the same identifier and data value.
若酿造配方的输入物品可堆叠,将消耗整个堆叠。目前无法避免此行为。
:::
### Brewing Mixes
酿造完成后催化剂被消耗,输出物品直接替换输入物品。
Brewing mixes are simple brewing recipes theoretically designed to isolate the data value of the input from the data value of the output.
::: warning
当前无论是否指定数据值产出物品的堆叠都存在bug无法与相同标识符和数据值的物品堆叠。
:::
### 酿造混合
酿造混合是简单的酿造配方,理论上设计用于隔离输入输出的数据值。
![](/assets/images/loot/recipes/brewing_mix_recipe.png)
<CodeHeader>BP/recipes/brewing/negative/paralysis.json</CodeHeader>
```json
::: code-group
```json [BP/recipes/brewing/negative/paralysis.json]
{
"format_version": "1.17.41",
"minecraft:recipe_brewing_mix": {
@@ -711,28 +740,28 @@ Brewing mixes are simple brewing recipes theoretically designed to isolate the d
}
}
```
::: warning
Unfortunately, assigned data values are broken for brewing mix recipes.
In general, a brewing recipe will never work if a data value is supplied to the input. The only exceptions are if the input is one of the following:
- `minecraft:potion`
- `minecraft:splash_potion`
- `minecraft:lingering_potion`
- [Potion identifier additions](#identifier-additions)
If a data value is specified for a reagent using the `"data"` property format, a brew occurs when any item with the given identifier is placed as a reagent for that recipe, regardless of data value. However, the brew only succeeds if the correct data value is matched. If its not, the brew will appear to succeed, but the input will not be transformed into the output; despite the brew failing, the reagent and a percentage of the blaze powder fuel are consumed anyway.
:::
### Brewing Containers
::: warning
不幸的是,酿造混合配方的数据值设定存在缺陷。
Brewing containers are designed to pass the data value of an input to the transformed output.
通常,若对输入指定数据值,酿造配方将完全失效。例外情况是输入为以下之一:
- `minecraft:potion`
- `minecraft:splash_potion`
- `minecraft:lingering_potion`
- [药水特殊标识符](#特殊标识符)
若通过`"data"`属性为催化剂指定数据值,当酿造台放入该标识符物品时会触发酿造(无论数据值是否匹配)。但只有数据值正确时才会成功转换,否则看似成功实则不转换输入(但仍会消耗催化剂和部分烈焰粉燃料)。
:::
### 酿造容器
酿造容器设计用于将输入数据值传递到输出。
![](/assets/images/loot/recipes/brewing_container_recipe.png)
<CodeHeader>BP/recipes/illumination_potion.json</CodeHeader>
```json
::: code-group
```json [BP/recipes/illumination_potion.json]
{
"format_version": "1.17.41",
"minecraft:recipe_brewing_container": {
@@ -746,33 +775,32 @@ Brewing containers are designed to pass the data value of an input to the transf
}
}
```
Brewing containers are stricter than [brewing mixes](#brewing-mixes) about their inputs. Only the following item types are allowed in a brewing container recipe:
- `minecraft:potion`
- `minecraft:splash_potion`
- `minecraft:lingering_potion`
- [Potion identifier additions](#identifier-additions)
Because the data value is carried downstream from input to output in a brewing container recipe, assigned data values in `"input"` and `"output"` are ignored.
## Overrides
As with all domains in add-ons, the pack order in the behavior pack list affects how Minecraft chooses files to use during gameplay. Higher-listed behavior pack entries take priority over lower-listed ones, including the base vanilla pack.
To override a recipe in a lower-listed pack, the recipe type and identifiers must both match. The override file can be named and located in any way — only the contents matter. Partial overrides are not accepted in recipes; the entire recipe must be redefined.
::: warning
Overrides only work if the recipe type is an _exact_ match. In most cases, a mismatch results in a new recipe created alongside the existing one.
If attempting to construct an override that converts between the two crafting recipe types, an error will be thrown. To circumvent this, first copy the vanilla definition into the pack. Next, set the `"tags"` for that file to `[""]`; this effectively disables the recipe. Finally, set up a new file as the other crafting recipe type, choosing a different identifier to avoid the error.
:::
## Prioritization
比[酿造混合](#酿造混合)更严格,仅允许以下输入类型:
- `minecraft:potion`
- `minecraft:splash_potion`
- `minecraft:lingering_potion`
- [药水特殊标识符](#特殊标识符)
After considering [overrides](#overrides), if multiple recipes would apply based on the inputs, the outputs are selected using the following tiebreakers, considered in order:
由于数据值从输入传递到输出,`"input"`和`"output"`中指定的数据值会被忽略。
- Recipes declared in higher-ordered packs in the world behavior packs list
- If for crafting recipes, _lower_-valued [priority properties](#priority)
- If for crafting recipes, [shaped recipes](#shaped-recipes) over [shapeless ones](#shapeless-recipes)
- "Lesser" identifiers, as interpreted by string comparison
## 覆盖机制
与所有附加组件领域相同,行为包加载顺序影响游戏中选择的文件。列表中靠前的行为包会覆盖靠后的(包括原版基础包)。
要覆盖低优先级包的配方,需完全匹配配方类型和标识符。覆盖文件可任意命名存放——仅内容重要。配方不支持部分覆盖,必须完全重新定义。
::: warning
仅当配方类型完全匹配时覆盖才生效。多数情况下不匹配会导致新建配方而非覆盖。
若尝试在两种合成配方类型间转换覆盖,将抛出错误。解决方案:先复制原版定义到包中,将其`"tags"`设为`[""]`(禁用配方),再新建另一种类型的配方文件(使用不同标识符避免冲突)。
:::
## 优先级排序
考虑[覆盖机制](#覆盖机制)后,若多个配方匹配输入,按以下顺序决胜:
1. 行为包列表中更高优先级的包
2. 合成配方中更小的[优先级值](#优先级)
3. 合成配方中[有序配方](#有序配方)优于[无序配方](#无序配方)
4. 字典序较小的标识符字符串