完整版BedrockWiki镜像!

This commit is contained in:
boybook
2025-03-20 11:52:46 +08:00
parent 1994c41f01
commit bf9aa4b056
214 changed files with 9042 additions and 8867 deletions

View File

@@ -1,10 +1,10 @@
---
title: Loot, Recipes, and Trading
title: 战利品、配方、交易
categories:
- title: General
- title: 基础
color: blue
- title: Documentation
- title: 文档
color: red
- title: Tutorials
- title: 巧思案例
color: green
---

View File

@@ -12,7 +12,7 @@ mentions:
toc_max_level: 1
---
Item functions modify the nature of an item in [loot tables](/loot/loot-tables) and [trade tables](/loot/trade-tables).
Item functions modify the nature of an item in [loot tables](/wiki/loot/loot-tables) and [trade tables](/wiki/loot/trade-tables).
TODO
can enchantments be prefixed with minecraft:/whatever?
@@ -50,7 +50,7 @@ A handful of functions are available for basic item properties. These functions
| Trade table | ❌ |
::: tip NOTE
Trade tables use the [`"quantity"` property](/loot/trade-tables#quantity) to set their count.
Trade tables use the [`"quantity"` property](/wiki/loot/trade-tables#quantity) to set their count.
:::
The `set_count` function sets the count for that item entry.

View File

@@ -1,34 +1,38 @@
---
title: Loot Tables
category: Documentation
title: 战利品表
category: 文档
nav_order: 1
tags:
- Stable
- Last updated for Version 1.18.10
- 稳定
- 最后更新于版本1.18.10
mentions:
- Ciosciaa
- Etanarvazac
- SmokeyStack
---
# 战利品表
<!--@include: @/wiki/bedrock-wiki-mirror.md-->
::: warning
This document is a work in progress.
本文档仍在完善中。
:::
Loot tables are used to select a set of items from a declared collection. Loot tables can be used from:
战利品表用于从预定义集合中选择一组物品。战利品表可通过以下方式调用:
- The `/loot` command
- Container contents
- Block drops
- Fishing
- Mob drops
- Equipment on spawned mobs
- Other various mob actions
- `/loot` 命令
- 容器内容物
- 方块掉落
- 钓鱼
- 生物掉落
- 生成生物的装备
- 其他各类生物行为
A different collection of items may be chosen each instance the same loot table would be used, based on [external conditions](#), and [innate randomness](#). Such variation is crucial for playability and adventuring, especially in more RPG-driven systems.
每次调用同一战利品表时,基于[外部条件](#)和[内在随机性](#)可能会选择不同的物品组合。这种变化性对于游戏可玩性和冒险体验至关重要特别是在RPG元素更重的系统中。
## Integration
Loot tables are not registered add-on entries and are instead referenced by path from the above sources. Loot tables may be placed anywhere within a behavior pack, but it's recommended to place them under the top-level `loot_tables` directory, following vanilla convention.
## 集成方式
战利品表并非注册的附加包条目,而是通过路径引用。虽然可以放置在行为包任意位置,但建议遵循原版规范将其置于顶级`loot_tables`目录下。
<FolderView
:paths="[
@@ -38,12 +42,11 @@ Loot tables are not registered add-on entries and are instead referenced by path
]"
/>
## Structure
Loot tables are represented as JSON objects with a single required `"pools"` array property.
## 结构
战利品表由包含必需属性`"pools"`数组的JSON对象表示。
<CodeHeader>#</CodeHeader>
```json
::: code-group
```json [根结构]
{
"pools": [
@@ -51,14 +54,13 @@ Loot tables are represented as JSON objects with a single required `"pools"` arr
}
```
The loot returned from a loot table invocation will be the *collective sum* of the yields of all pools provided here.
战利品表的调用结果将是所有池pool产出的总和。
### Pools
Pools act as isolated constructs for selecting items; the results of pools cannot be influenced by other pools.
### 池(Pools
池是独立的物品选择单元,不同池之间的结果互不影响。
<CodeHeader>#</CodeHeader>
```json
::: code-group
```json [基础池示例]
{
"rolls": 1,
@@ -71,14 +73,13 @@ Pools act as isolated constructs for selecting items; the results of pools canno
}
```
Two types of pools are available: general-purpose [weighted random pools](#weighted-random-pools) and [tiered pools](#tiered-pools), the latter of which is traditionally used for selecting mob equipment.
存在两种池类型:通用型[加权随机池](#加权随机池)和[分层池](#分层池),后者传统上用于生物装备选择。
#### Weighted Random Pools
A traditional weighted random pool selects items based on relative weight, choosing a number of yields based on a configured roll count.
#### 加权随机池
传统加权随机池根据相对权重选择物品通过配置的roll次数决定产出数量。
<CodeHeader>artifacts.json/pools/0</CodeHeader>
```json
::: code-group
```json [artifacts.json/pools/0]
{
"rolls": {
"min": 2,
@@ -105,38 +106,36 @@ A traditional weighted random pool selects items based on relative weight, choos
}
```
##### Rolls
##### 抽取次数(Rolls
###### Bonus Rolls
The roll count for a weighted random pool may be altered based on the player's luck using the optional `"bonus_rolls"` property.
###### 附加抽取Bonus Rolls
可通过可选属性`"bonus_rolls"`基于玩家幸运值调整抽取次数。
```json
// 示例待补充
```
##### Entry Weighting
The weight is the chance of this entry being chosen. The higher the weight in comparison to other entries in this "entries" array, the higher the chance of the entry being chosen.
##### 条目权重
权重值决定条目被选中的概率。权重相对于其他条目越高,选中几率越大。
```json
"weight": 3
```
###### Quality
The weight of an entry can be changed based on the player's luck using the quality property.
###### 质量Quality
通过quality属性可根据玩家幸运值调整条目权重。
```json
"quality": 2
```
Currently, luck is only expressed when fishing with a fishing rod enchanted with Luck of the Sea.
当前仅在使用附有"海之眷顾"附魔的钓鱼竿时生效。
#### Tiered Pools
Tiered pools are used to select exactly one entry from a collection.
#### 分层池
分层池用于从集合中精确选择一个条目。
```json
::: code-group
```json [分层池示例]
{
"tiers": {
"initial_range": 2,
@@ -170,7 +169,7 @@ Tiered pools are used to select exactly one entry from a collection.
}
```
A pool becomes tiered with the inclusion of the `"tiers"` object property:
当包含`"tiers"`对象属性时即构成分层池:
```json
"tiers": {
@@ -181,55 +180,60 @@ A pool becomes tiered with the inclusion of the `"tiers"` object property:
}
```
Entries in a tiered pool are *ordered*. The selected entry for a tiered pool is based on its index. To determine this index, a starting index is randomly rolled and then a batch of success rolls attempt to increment this starting index.
分层池中的条目具有顺序性。选择过程分为两个阶段:
The starting index is decided by rolling a random integer between 1 and the integer property `"initial_range"`. If no initial range is provided, it defaults to `1`, forcing a starting index of 1.
1. 初始索引在1到`"initial_range"`间随机选取整数
2. 附加尝试:进行`"bonus_rolls"`次成功率`"bonus_chance"`的检定,每次成功索引+1
Next, attempts are made to advanced the index using additional rolls. The count of these roll attempts is given as an integer to `"bonus_rolls"`. The chance that any such roll succeeds is given via `"bonus_chance"`. Chances for `"bonus_chance"` are out of 1, meaning `0.5` would be a 50% chance for any bonus roll to succeed. Each successful roll increases the index by 1. Both of these properties default to `0`, meaning both must be provided to use this additional rolls mechanic.
The final determined index is used to select the corresponding entry as that pool's yield. Indices in tiered pools are one-indexed, meaning the first entry has an index of 1, the second has an index of 2, and so forth. If the determined index is larger than the entry count for that pool, no yield will be provided.
最终索引对应条目将被选中索引从1开始。若索引超出条目总数则不产出。
::: warning
All [conditions](#) on entries in a tiered pool are ignored. Conditions on the pool itself are still allowed.
分层池中条目的[条件](#)将被忽略,但池级别的条件仍然有效。
:::
### Entries
Entries are the selectable units of a pool. Three different types of entries are available.
### 条目(Entries
条目是池中的可选项,包含三种类型。
```json
// 示例待补充
```
#### Item Entries
Item entries are the fundamental entry type for selecting loot. Item entries refer to
#### 物品条目
基础条目类型,用于选择具体物品。
```json
// 示例待补充
```
#### Loot Table Entries
Loot hierarchies can be formed using loot table entries.
#### 战利品表条目
支持嵌套调用其他战利品表。
```json
// 示例待补充
```
#### Empty Entries
When selected, empty entries won't yield any loot for that roll.
#### 空条目
选中时不产生任何物品。
```json
"type": "empty",
"weight": 4
```
Empty entries can generally be mimicked using [a roll count](#) whose range includes 0, [random chance conditions](#), or [count functions](#) that could randomly select 0. Their primary advantage is readability when using [weighted random pools](#): denoting by weight when a roll won't yield an entry may be easier to understand.
空条目的作用可通过[0次抽取](#)、[随机条件](#)或[数量函数](#)实现,主要优势在于提升[加权随机池](#)的可读性。
### Functions
Functions are what makes loot tables so powerful. They can do a wide range of tasks for each entry in your loot table. For example, they can change the amount of an item is dropped, what enchantments are present (even on items that normally cannot be enchanted), the item name, it's lore, and it can even write books! View [item functions](/loot/item-functions) for a full list of functions and how they're used.
### 函数(Functions
函数赋予战利品表强大功能,可实现:
<CodeHeader>artifacts.json/pools/entries</CodeHeader>
- 调整物品数量
- 添加附魔(包括不可附魔物品)
- 修改物品名称和描述
- 编写书籍内容
```json
详见[物品函数文档](/wiki/loot/item-functions)。
::: code-group
```json [artifacts.json/pools/entries]
{
"type": "item",
"name": "minecraft:dirt",
@@ -250,12 +254,14 @@ Functions are what makes loot tables so powerful. They can do a wide range of ta
}
```
### Conditions
Conditions check to see if a certain criteria is met. Examples: "Was Zombie killed by Player", "Did the sword have the Looting enchantment on it? If so, what level?"
### 条件(Conditions
条件用于检测特定标准是否满足,例如:
<CodeHeader>artifacts.json/pools/entries</CodeHeader>
- 僵尸是否被玩家击杀
- 武器是否附有抢夺附魔及其等级
```json
::: code-group
```json [artifacts.json/pools/entries]
{
"conditions": [
{
@@ -288,5 +294,4 @@ Conditions check to see if a certain criteria is met. Examples: "Was Zombie kill
}
```
## Overrides
## 覆盖规则

View File

@@ -1,6 +1,6 @@
---
title: Randomized Structure Loot
category: Tutorials
title: 随机化结构战利品
category: 巧思案例
mentions:
- MedicalJewel105
- SirLich
@@ -8,21 +8,24 @@ mentions:
- Ciosciaa
- rebrainertv
tags:
- easy
- 简单
---
Adding loot tables to containers in structure is easy, you need to have a PC and your choice of either [NBT Studio](https://github.com/tryashtar/nbt-studio/releases/download/v1.14.1/NbtStudio.exe) (executable) or [Loot Tabler](https://mcbe-essentials.github.io/structure-editor/loot-tabler) (browser application).
# 随机化结构战利品
## Setup
### Creating the Loot Table
<!--@include: @/wiki/bedrock-wiki-mirror.md-->
To start, create the directory `BP/loot_tables/chests` and create your loot table file here.
为结构中的容器添加战利品表非常简单,您需要准备一台电脑,并选择使用[NBT Studio](https://github.com/tryashtar/nbt-studio/releases/download/v1.14.1/NbtStudio.exe)(可执行程序)或[Loot Tabler](https://mcbe-essentials.github.io/structure-editor/loot-tabler)(浏览器应用)。
You can learn how to make loot tables in [Beginners Guide](/guide/loot-table)
## 准备工作
### 创建战利品表
<CodeHeader>BP/loot_tables/chests/my_structure_loot.json</CodeHeader>
首先创建目录`BP/loot_tables/chests`,并在此处创建战利品表文件。
```json
您可以通过[新手指南](/wiki/guide/loot-table)学习如何制作战利品表。
::: code-group
```json [BP/loot_tables/chests/my_structure_loot.json]
{
"pools": [
{
@@ -64,62 +67,63 @@ You can learn how to make loot tables in [Beginners Guide](/guide/loot-table)
]
}
```
:::
### Exporting Structure
### 导出结构
Once you have created your loot table, export your structure into `BP/structures`. Then follow the steps for either NBT Studio or Loot Tabler
创建好战利品表后,将结构导出到`BP/structures`目录。然后根据您选择的工具(NBT StudioLoot Tabler)继续操作。
![](/assets/images/tutorials/randomised-structure-loot/export_structure.png)
## NBT Studio (Executable)
### Software Preparation
## NBT Studio(可执行程序)
### 软件准备
Download and launch [NBT Studio](https://github.com/tryashtar/nbt-studio/releases/download/v1.14.1/NbtStudio.exe)
下载并启动[NBT Studio](https://github.com/tryashtar/nbt-studio/releases/download/v1.14.1/NbtStudio.exe)
### Adding the Loot Table
### 添加战利品表
Launch NBT Studio and open file `(Ctrl + O)`
打开NBT Studio并通过快捷键`Ctrl + O`打开文件
![](/assets/images/tutorials/randomised-structure-loot/open_file.png)
Find your container (Ctrl + F)
使用`Ctrl + F`搜索容器
![](/assets/images/tutorials/randomised-structure-loot/find_container.png)
Navigate to your container, `block_position_data` > `block_entity_data`. Add a string tag
定位到容器所在位置:`block_position_data` > `block_entity_data`。添加字符串标签
![](/assets/images/tutorials/randomised-structure-loot/add_string_tag1.png)
Add `LootTable` and the file path to your loot table
设置标签名为`LootTable`,并输入战利品表文件路径
![](/assets/images/tutorials/randomised-structure-loot/add_string_tag2.png)
Save changes (Ctrl + S)
按`Ctrl + S`保存修改
## Loot Tabler (Browser Application)
## Loot Tabler(浏览器应用)
:::tip
To export a structure on mobile devices, [Download this pack.](https://mcpedl.com/export-structure-button-android-addon/)
如需在移动设备导出结构,请[下载此资源包](https://mcpedl.com/export-structure-button-android-addon/)
:::
### Adding the Loot Table
### 添加战利品表
Open the website and click "Upload". Choose your structure file.
访问网站并点击"Upload"按钮上传结构文件
![](/assets/images/tutorials/randomised-structure-loot/LootTable-step1.png)
Find your container in the containers list, making use of the information displayed under "Container Options"
在容器列表中通过"Container Options"下方的信息定位目标容器
![](/assets/images/tutorials/randomised-structure-loot/LootTable-step2.png)
Under "Loot Table", enter the path to your loot table. Set "Loot Table Seed" to blank or `0` if you want the loot to generate randomly. If you want the loot table to generate consistently, enter a specific value.
"Loot Table"字段输入战利品表路径。"Loot Table Seed"留空或设为`0`可实现随机生成。如需固定战利品生成,请设置特定数值
![](/assets/images/tutorials/randomised-structure-loot/LootTable-step3.png)
Download your structure file and place it in `BP/structures`.
下载修改后的结构文件并放入`BP/structures`目录
## Testing
## 测试验证
Load your structure and open the container
加载结构并打开容器查看效果
![](/assets/images/tutorials/randomised-structure-loot/test.png)
![](/assets/images/tutorials/randomised-structure-loot/test.png)

View File

@@ -19,7 +19,7 @@ Recipes are the means of handling several item transactions, namely those occurr
![](/assets/images/loot/recipes/recipe.png)
::: tip
Anvil interactions are handled within an [item definition](/items/item-components), not via recipe files. Loom transactions are currently unavailable.
Anvil interactions are handled within an [item definition](/wiki/items/item-components), not via recipe files. Loom transactions are currently unavailable.
:::
No experimental toggles are required to use recipes or any of their features.
@@ -82,7 +82,7 @@ As an example, a "cold steel sword" might be crafted using the following [shaped
### Format Version
The [format version](/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.
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
@@ -150,7 +150,7 @@ Education:
- `material_reducer`
::: tip
Additionally, [custom crafting tables](/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.
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
@@ -225,7 +225,7 @@ If a count greater than `1` is provided for an item that does not stack, an erro
:::
::: warning
Despite having similarities to trade [table item descriptors](/loot/trade-tables#items), recipe item descriptors cannot use functions.
Despite having similarities to trade [table item descriptors](/wiki/loot/trade-tables#items), recipe item descriptors cannot use functions.
:::
#### Identifier Additions
@@ -272,7 +272,7 @@ Crafting recipes support both crafting tables and stonecutters:
"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](/blocks/block-components#crafting-table).
`"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).
### Shapeless Recipes

View File

@@ -676,7 +676,7 @@ In trade tables, if no ID is provided, the trader's entity type will be assigned
## Overrides
Because trade tables do not use in-data identifiers, they are overridden simply by replacing a prior trade table with a new one. You can learn more about [asset overrides here](/concepts/overwriting-assets)
Because trade tables do not use in-data identifiers, they are overridden simply by replacing a prior trade table with a new one. You can learn more about [asset overrides here](/wiki/concepts/overwriting-assets)
Below are the currently used vanilla trade tables for each trader:
|Trader|Path|

View File

@@ -1,32 +1,36 @@
---
title: Trading Behavior
category: General
title: 交易行为
category: 基础
nav_order: 2
mentions:
- Ciosciaa
- MedicalJewel105
---
Making an entity a trader is accomplished via `minecraft:trade_table` or `minecraft:economy_trade_table` components. Both of them will open a trading UI from the given path, but the economy trades component has some more options referring to some Village and Pillage trading mechanics. Other AI goals you'll need are `minecraft:behavior.trade_with_player`, optionally `minecraft.behavior:trade_interest` (allows the mob to hold/offer an item) and, potentially, `"minecraft:trade_resupply": {}`.
# 交易行为
For a simple trading UI, `trade_table` + `trade_with_player` components should do the trick.
<!--@include: @/wiki/bedrock-wiki-mirror.md-->
1. Add `"minecraft:behavior.trade_with_player": {}` to your entity's components.
2. Copy the following code into a component group of your entity. I'll call mine `"wiki:trader"`;
通过 `minecraft:trade_table``minecraft:economy_trade_table` 组件可以将实体设置为交易者。这两个组件都会根据指定路径打开交易界面但经济交易组件包含更多与村庄与掠夺版本交易机制相关的配置选项。其他需要添加的AI目标包括 `minecraft:behavior.trade_with_player`,可选添加 `minecraft.behavior:trade_interest`(允许生物手持/展示交易物品),以及可能需要添加 `"minecraft:trade_resupply": {}`
<CodeHeader>BP/entities/trader.json</CodeHeader>
对于基础交易界面,使用 `trade_table` + `trade_with_player` 组件即可实现。
```json
1. 在实体组件中添加 `"minecraft:behavior.trade_with_player": {}`
2. 将以下代码复制到实体的组件组中(示例组件组命名为 `"wiki:trader"`:
::: code-group
```json [BP/entities/trader.json]
"minecraft:trade_table": {
"display_name": "Trading Entity", // Text to be displayed.
"table": "trading/trading_entity_trades.json", // Path to the trade table file
"new_screen": true //If set to false, the UI will display as the pre-Village&Pillage one.
"display_name": "交易实体", // 显示的名称文本
"table": "trading/trading_entity_trades.json", // 交易表文件路径
"new_screen": true //设置为 false 时,界面会显示为村庄与掠夺版本之前的样式
}
```
:::
3. Now make sure the component group is added to the entity via an event. It's a good idea to add it in `minecraft:entity_spawned` event, since it triggers on spawn.
If you don't feel confident with events and component groups, make sure you're familiar with entity definition rules/concepts. See the [Intro to Entities](/entities/entity-intro-bp).
3. 确保通过事件添加该组件组。建议在 `minecraft:entity_spawned` 生成事件中添加,该事件会在实体生成时触发。
若对事件和组件组的运作机制不够熟悉,建议先学习[实体入门指南](/wiki/entities/entity-intro-bp)中的相关概念。
:::warning
If you add the component in components, it will cause all kinds of problems, including blank trading UIs for all entities in the world. Because of an issue with the trading AI goals, they must be added in component groups.
:::
若直接在主组件中components添加该组件将会导致各种问题包括所有实体交易界面显示空白。由于交易类AI目标的机制问题必须通过组件组形式添加。
:::