Interface FoodComponent
- All Superinterfaces:
ConfigurationSerializable
Represents a component which can turn any item into food.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
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.Methods inherited from interface org.bukkit.configuration.serialization.ConfigurationSerializable
serialize
-
Method Details
-
getNutrition
int getNutrition()Gets the food restored by this item when eaten.- Returns:
- nutrition value
-
setNutrition
void setNutrition(int nutrition) Sets the food restored by this item when eaten.- Parameters:
nutrition
- new nutrition value, must be non-negative
-
getSaturation
float getSaturation()Gets the saturation restored by this item when eaten.- Returns:
- saturation value
-
setSaturation
void setSaturation(float saturation) Sets the saturation restored by this item when eaten.- Parameters:
saturation
- new saturation value
-
canAlwaysEat
boolean canAlwaysEat()Gets if this item can be eaten even when not hungry.- Returns:
- true if always edible
-
setCanAlwaysEat
void setCanAlwaysEat(boolean canAlwaysEat) Sets if this item can be eaten even when not hungry.- Parameters:
canAlwaysEat
- whether always edible
-