搬运一批Bedrock wiki内容,完善翻译
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: Creating Boats
|
||||
category: Tutorials
|
||||
title: 创建船只
|
||||
category: 教程
|
||||
tags:
|
||||
- recipe
|
||||
- intermediate
|
||||
- 配方
|
||||
- 进阶
|
||||
mentions:
|
||||
- SirLich
|
||||
- Joelant05
|
||||
@@ -11,25 +11,29 @@ mentions:
|
||||
- StealthyExpertX
|
||||
- TheItsNameless
|
||||
---
|
||||
:::warning Requires Format Version 1.16.100 or Lower
|
||||
|
||||
The behavior format version now requires 1.16.100 or lower for the `minecraft:behavior.rise_to_liquid_level` and `minecraft:buoyant` methods to work.
|
||||
If you find a new method that works in the newer format versions, you should consider helping to contribute by updating the wiki.
|
||||
# 创建船只
|
||||
|
||||
<!--@include: @/wiki/bedrock-wiki-mirror.md-->
|
||||
|
||||
:::warning 需要格式版本1.16.100或更低
|
||||
|
||||
当前行为格式版本要求1.16.100或更低版本才能使`minecraft:behavior.rise_to_liquid_level`和`minecraft:buoyant`功能生效。
|
||||
如果您发现新格式版本中的替代实现方法,欢迎协助更新本Wiki内容。
|
||||
:::
|
||||
|
||||
## Using Runtime Identifiers
|
||||
## 使用运行时标识符
|
||||
|
||||
You can read more about runtime identifiers [here](/entities/runtime-identifier). Using runtime identifiers, you can implement most of the boat's hard-coded behaviors. However, your boat won't rotate with you, and it will always face North.
|
||||
详细内容请参阅[运行时标识符指南](/entities/runtime-identifier)。使用运行时标识符可以实现船只的大部分硬编码行为,但会导致船只无法随玩家转向且始终面向北方。
|
||||
|
||||
## Using Components
|
||||
## 利用组件系统实现
|
||||
|
||||
Currently, the best way to create a boat entity is by using components. 1.16 introduced new components that we can use to our advantage: `minecraft:behavior.rise_to_liquid_level` and `minecraft:buoyant`. Striders use the first one in vanilla to make them float on lava, but we can repurpose it for water as well.
|
||||
目前最佳的船只创建方案是通过组件系统实现。1.16版本新增的两个组件可资利用:`minecraft:behavior.rise_to_liquid_level`与`minecraft:buoyant`。官方设计中前者用于岩浆怪的岩浆漂浮特性,我们可以将其移植到水面上使用。
|
||||
|
||||
## 1st method: minecraft:behavior.rise_to_liquid_level
|
||||
## 第一种方法:minecraft:behavior.rise_to_liquid_level
|
||||
|
||||
<CodeHeader>BP/entities/bar</CodeHeader>
|
||||
|
||||
```json
|
||||
::: code-group
|
||||
```json [BP/entities/bar]
|
||||
{
|
||||
"minecraft:entity": {
|
||||
"format_version": "1.14.0",
|
||||
@@ -40,23 +44,23 @@ Currently, the best way to create a boat entity is by using components. 1.16 int
|
||||
"is_experimental": false
|
||||
},
|
||||
"components": {
|
||||
//This is the component that does the magic
|
||||
// 这是实现效果的核心组件
|
||||
"minecraft:behavior.rise_to_liquid_level": {
|
||||
"priority": 0,
|
||||
//This property can adjust how high your boat is above the water
|
||||
// 控制船体相对于水面的基准高度
|
||||
"liquid_y_offset": 0.5,
|
||||
//Positive vertical displacement, in other words, how much the boat will move up
|
||||
// 正垂直位移量,决定船体抬升幅度
|
||||
"rise_delta": 0.05,
|
||||
//Negative vertical displacement, in other words, how much the boat will move down
|
||||
// 负垂直位移量,决定船体下沉幅度
|
||||
"sink_delta": 0.05
|
||||
//Use rise_delta and sink_delta to simulate waves/bouncing effect
|
||||
// 通过升降参数可模拟波浪浮动效果
|
||||
},
|
||||
|
||||
//Sets the boat speed in water
|
||||
// 设置水上移动速率
|
||||
"minecraft:underwater_movement": {
|
||||
"value": 5
|
||||
},
|
||||
//This component is important, without it the boat will sink
|
||||
// 关键组件,移除会导致船体沉没
|
||||
"minecraft:navigation.walk": {
|
||||
"can_sink": false
|
||||
},
|
||||
@@ -68,17 +72,17 @@ Currently, the best way to create a boat entity is by using components. 1.16 int
|
||||
"position": [0, 0, 0]
|
||||
}
|
||||
},
|
||||
//Add this component if you want your boat to be controlled with WASD
|
||||
// 添加此组件实现WASD方向控制
|
||||
"minecraft:input_ground_controlled": {},
|
||||
"minecraft:health": {
|
||||
"value": 10,
|
||||
"max": 10
|
||||
},
|
||||
//Sets the boat speed on the ground (set this to zero if you don't want your boats to move on the ground)
|
||||
// 设置地面移动速度(设置为0可禁用地表移动)
|
||||
"minecraft:movement": {
|
||||
"value": 3
|
||||
},
|
||||
//This is to prevent the boat from not stopping whenever a player exits, said the boat
|
||||
// 防止玩家下船后无法停止移动
|
||||
"minecraft:movement.basic": {},
|
||||
"minecraft:collision_box": {
|
||||
"width": 1,
|
||||
@@ -89,12 +93,12 @@ Currently, the best way to create a boat entity is by using components. 1.16 int
|
||||
}
|
||||
}
|
||||
```
|
||||
:::
|
||||
|
||||
## 2nd method: minecraft:buoyant
|
||||
## 第二种方法:minecraft:buoyant
|
||||
|
||||
<CodeHeader></CodeHeader>
|
||||
|
||||
```json
|
||||
::: code-group
|
||||
```json []
|
||||
{
|
||||
"minecraft:entity": {
|
||||
"format_version": "1.14.0",
|
||||
@@ -106,27 +110,27 @@ Currently, the best way to create a boat entity is by using components. 1.16 int
|
||||
},
|
||||
"components": {
|
||||
"minecraft:buoyant": {
|
||||
//Determines whether gravity should be taken into account (useful with waterfalls)
|
||||
// 是否受重力影响(处理瀑布场景很有用)
|
||||
"apply_gravity": true,
|
||||
//Range: 0-1. This controls how high the boat is above the water
|
||||
// 范围0-1,控制船体默认高度
|
||||
"base_buoyancy": 1.0,
|
||||
//A "wave" makes the entity bounce up and down. A big wave simply amplifies this effect. Note: setting simulate_waves to false won't make the effect go away completely.
|
||||
// 「浪涌」模拟船体上下波动效果(false也不会完全消除效果)
|
||||
"simulate_waves": true,
|
||||
//How likely a "big" wave will hit this boat
|
||||
// 产生「大浪」的概率
|
||||
"big_wave_probability": 0.03,
|
||||
//How strong the "big" wave will be
|
||||
// 「大浪」强度系数
|
||||
"big_wave_speed": 10.0,
|
||||
//How strong will the boat be dragged down in case this component is removed
|
||||
// 移除浮力后的下沉阻力
|
||||
"drag_down_on_buoyancy_removed": 0,
|
||||
//Blocks this entity can be buoyant in. Only actual liquids are allowed: lava and water
|
||||
// 支持浮力的液态方块(仅限水和岩浆)
|
||||
"liquid_blocks": ["water"]
|
||||
},
|
||||
|
||||
//Sets the boat speed in water
|
||||
// 设置水上移动速率
|
||||
"minecraft:underwater_movement": {
|
||||
"value": 5
|
||||
},
|
||||
//This component is important, without it the boat will sink
|
||||
// 关键组件,移除会导致船体沉没
|
||||
"minecraft:navigation.walk": {
|
||||
"can_sink": false
|
||||
},
|
||||
@@ -138,17 +142,17 @@ Currently, the best way to create a boat entity is by using components. 1.16 int
|
||||
"position": [0, 0, 0]
|
||||
}
|
||||
},
|
||||
//Add this component if you want your boat to be controlled with WASD
|
||||
// 添加此组件实现WASD方向控制
|
||||
"minecraft:input_ground_controlled": {},
|
||||
"minecraft:health": {
|
||||
"value": 10,
|
||||
"max": 10
|
||||
},
|
||||
//Sets the boat speed on the ground (set this to zero if you don't want your boats to move on the ground)
|
||||
// 设置地面移动速度(设置为0可禁用地表移动)
|
||||
"minecraft:movement": {
|
||||
"value": 3
|
||||
},
|
||||
//This is to prevent the boat from not stopping whenever a player exits the boat
|
||||
// 防止玩家下船后无法停止移动
|
||||
"minecraft:movement.basic": {},
|
||||
"minecraft:collision_box": {
|
||||
"width": 1,
|
||||
@@ -159,7 +163,8 @@ Currently, the best way to create a boat entity is by using components. 1.16 int
|
||||
}
|
||||
}
|
||||
```
|
||||
:::
|
||||
|
||||
## What method to use?
|
||||
## 方法选择建议
|
||||
|
||||
Both methods are suitable but have their pros and cons. If you want to disable the bouncing effect, use the first method. If you want more control over it, use the second method. I use the second method for static objects, such as buoys, and the first method for movable entities, such as boats, emulating the vanilla behavior.
|
||||
两种方式各有优劣。若需禁用波动效果建议采用第一种方式;若需要进行精细调控可选择第二种方法。开发实践中,第二种常用于浮标等静态物体,第一种则更适合船只等运动实体,能更好地还原原版特性。
|
||||
Reference in New Issue
Block a user