Interface FoodComponent
- All Superinterfaces:
ConfigurationSerializable
Represents a component which can turn any item into food.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanGets if this item can be eaten even when not hungry.intGets the food restored by this item when eaten.floatGets the saturation restored by this item when eaten.voidsetCanAlwaysEat(boolean canAlwaysEat) Sets if this item can be eaten even when not hungry.voidsetNutrition(int nutrition) Sets the food restored by this item when eaten.voidsetSaturation(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
-