接口 FoodComponent
- 所有超级接口:
ConfigurationSerializable
Represents a component which can handle food stats in any item.
Note: Items with food stats has no effect unless the item can be consumed, see
Note: Items with food stats has no effect unless the item can be consumed, see
ConsumableComponent
.-
方法概要
修饰符和类型方法说明boolean
Gets if this item can be eaten even when not hungry.int
Gets the food restored by this item when eaten.float
Gets the saturation restored by this item when eaten.void
setCanAlwaysEat
(boolean canAlwaysEat) Sets if this item can be eaten even when not hungry.void
setNutrition
(int nutrition) Sets the food restored by this item when eaten.void
setSaturation
(float saturation) Sets the saturation restored by this item when eaten.从接口继承的方法 org.bukkit.configuration.serialization.ConfigurationSerializable
serialize
-
方法详细资料
-
getNutrition
int getNutrition()Gets the food restored by this item when eaten.- 返回:
- nutrition value
-
setNutrition
void setNutrition(int nutrition) Sets the food restored by this item when eaten.- 参数:
nutrition
- new nutrition value, must be non-negative
-
getSaturation
float getSaturation()Gets the saturation restored by this item when eaten.- 返回:
- saturation value
-
setSaturation
void setSaturation(float saturation) Sets the saturation restored by this item when eaten.- 参数:
saturation
- new saturation value
-
canAlwaysEat
boolean canAlwaysEat()Gets if this item can be eaten even when not hungry.- 返回:
- true if always edible
-
setCanAlwaysEat
void setCanAlwaysEat(boolean canAlwaysEat) Sets if this item can be eaten even when not hungry.- 参数:
canAlwaysEat
- whether always edible
-