搬运一批Bedrock wiki内容,完善翻译

This commit is contained in:
boybook
2025-03-20 00:13:44 +08:00
parent ead7392a76
commit 4896c1a4f2
163 changed files with 33930 additions and 1464 deletions

View File

@@ -1,8 +1,8 @@
---
title: Entity Holds Item
category: Tutorials
title: 实体手持物品
category: 教程
tags:
- intermediate
- 中等难度
mentions:
- pieterdefour
- SirLich
@@ -15,46 +15,49 @@ mentions:
- 7dev7urandom
---
# 实体手持物品
<!--@include: @/wiki/bedrock-wiki-mirror.md-->
::: tip
This tutorial assumes you have a basic understanding of entities, loot tables, and Blockbench.
本教程假设您已对实体、战利品表和Blockbench有基本了解。
:::
In this tutorial, you will learn to have an entity spawn with an item in its hand. I'll be using a custom `mandalorian_armorer` entity and a custom `hammer` item for the examples.
在本教程中,您将学习如何让实体生成时手持物品。示例中将使用自定义实体 `mandalorian_armorer` 和自定义物品 `hammer`
## Model
## 模型
First of all, you'll need to have a model in Blockbench that has a map called `rightArm`. Within this map, there needs to be a submap called 'rightItem'.
Now set the position of the pivot point of this submap, so it sits in the place you want the entity to hold the item at.
首先需要在Blockbench中创建包含名为 `rightArm` 骨架的模型。该骨架内必须包含名为 `rightItem` 的子骨架。
将该子骨架的枢轴点定位至您期望实体手持物品的位置。
![](/assets/images/tutorials/entity-holds-item/blockbench.png)
## Behavior Pack-side
## 行为包配置
Now you'll need to add a `minecraft:equipment` component in the component list for your entity and add a loot table with the desired item.
接下来需在实体的组件列表中添加 `minecraft:equipment` 组件,并配置包含目标物品的战利品表。
In our example it will look like this:
示例配置如下:
<CodeHeader>BP/entity/mandolorian.json#components</CodeHeader>
```json
::: code-group
```json [BP/entity/mandolorian.json#components]
"minecraft:equipment": {
"table": "loot_tables/entities/gear/mandolorian.json"
}
```
## Loot Table
Finally, add the loot table for your entity. It needs to be in `loot_tables/entities/<your_loot_table_name>.json` in the behavior pack. In our case, it's called `mandolorian.json`.
:::warning
This isn't the same loot table as what it drops on death. So make sure it has a different name.
:::
To have the entity always spawn with the same item, add the following loot table:
## 战利品表配置
<CodeHeader>BP/loot_tables/entities/gear/mandolorian.json</CodeHeader>
最后在行为包的 `loot_tables/entities/<你的战利品表名称>.json` 路径下添加对应战利品表。本示例中文件名为 `mandolorian.json`。
```json
:::warning
此战利品表与生物死亡掉落表不同,请确保使用不同命名。
:::
要让实体始终持握特定物品,按照以下格式配置战利品表:
::: code-group
```json [BP/loot_tables/entities/gear/mandolorian.json]
{
"pools": [
{
@@ -70,7 +73,8 @@ To have the entity always spawn with the same item, add the following loot table
]
}
```
:::
If everything went well, you'd have something looking like this:
成功配置后,效果应如下图所示:
![](/assets/images/tutorials/entity-holds-item/finished_result.png)
![](/assets/images/tutorials/entity-holds-item/finished_result.png)