File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
translated/zh_cn/develop/items Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -25,18 +25,18 @@ new Item.Settings().food(new FoodComponent.Builder().build())
25
25
26
26
现在,只要让物品可食用,没有别的。
27
27
28
- ` FoodComponent ` 类有很多方法 ,允许你修改玩家吃你的物品时发生的事情:
28
+ ` FoodComponent ` 类有某些方法 ,允许你修改玩家吃你的物品时发生的事情:
29
29
30
- | 方法 | 描述 |
31
- | -------------------- | -------------------------------------------------------- |
32
- | ` nutrition ` | 设置你的物品会补充的饥饿值的数量。 |
33
- | ` saturationModifier ` | 设置你的物品会增加的饱和度的数量。 |
34
- | ` alwaysEdible ` | 允许无论饥饿值均能吃你的物品。 |
35
- | ` snack ` | 将你的物品描述为零食。 |
36
- | ` statusEffect ` | 吃你的物品时添加状态效果。 通常传递到此方法的是一个状态效果实例和概率,其中概率是小数(` 1f = 100% ` ) |
30
+ | 方法 | 描述 |
31
+ | -------------------- | ----------------- |
32
+ | ` nutrition ` | 设置你的物品会补充的饥饿值的数量。 |
33
+ | ` saturationModifier ` | 设置你的物品会增加的饱和度的数量。 |
34
+ | ` alwaysEdible ` | 允许无论饥饿值均能吃你的物品。 |
37
35
38
36
按照你的喜好修改了 builder 后,可以调用 ` build() ` 方法以获取 ` FoodComponent ` 。
39
37
38
+ 如果您想在玩家吃食物时添加状态效果,则需要将 ` ConsumableComponent ` 与 ` FoodComponent ` 类一起使用,如以下示例所示:
39
+
40
40
@[ code transcludeWith=:::5] ( @/reference/latest/src/main/java/com/example/docs/item/ModItems.java )
41
41
42
42
与 [ 创建你的第一个物品] ( ./first-item ) 类似,该示例将使用上述的组件:
@@ -46,7 +46,6 @@ new Item.Settings().food(new FoodComponent.Builder().build())
46
46
这会让物品:
47
47
48
48
- 总是可食用,无论饥饿值均可以吃。
49
- - 是“零食”。
50
49
- 吃完会总会给予 6 秒中毒 II。
51
50
52
- <VideoPlayer src =" /assets/develop/items/food_0.webm " title =" Eating the Suspicious Substance " />
51
+ <VideoPlayer src =" /assets/develop/items/food_0.webm " title =" Eating the Poisonous Apple " />
You can’t perform that action at this time.
0 commit comments