FoodProperties
Importing the class
If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.
import crafttweaker.api.food.FoodProperties;
Description
Represents the properties of a food item.Members
// FoodProperties.canAlwaysEat as boolFoodProperties.create(1, 1.0, true, 1.0).canAlwaysEat
Return Type:
bool
Returns: The new food properties.
// FoodProperties.create(nutrition as int, saturation as float, canAlwaysEat as bool, eatSeconds as float) as FoodProperties;FoodProperties.create(myInt, myFloat, myBool, myFloat);
Parameters:
nutrition: int
Type: int
- The nutrition value. saturation: float
Type: float
- The saturation value. canAlwaysEat: bool
Type: bool
- Whether the food can always be eaten. eatSeconds: float
Type: float
- The number of seconds it takes to eat the food.
Return Type:
FoodProperties
Returns: The new food properties.
// FoodProperties.create(nutrition as int, saturation as float, canAlwaysEat as bool, eatSeconds as float, usingConvertsTo as IItemStack) as FoodProperties;FoodProperties.create(myInt, myFloat, myBool, myFloat, myIItemStack);
Parameters:
nutrition: int
Type: int
- The nutrition value. saturation: float
Type: float
- The saturation value. canAlwaysEat: bool
Type: bool
- Whether the food can always be eaten. eatSeconds: float
Type: float
- The number of seconds it takes to eat the food.
Return Type:
FoodProperties
Returns: The new food properties.
// FoodProperties.create(nutrition as int, saturation as float, canAlwaysEat as bool, eatSeconds as float, usingConvertsTo as IItemStack, effects as List<FoodPropertiesPossibleEffect>) as FoodProperties;FoodProperties.create(myInt, myFloat, myBool, myFloat, myIItemStack, myList);
Parameters:
nutrition: int
Type: int
- The nutrition value. saturation: float
Type: float
- The saturation value. canAlwaysEat: bool
Type: bool
- Whether the food can always be eaten. eatSeconds: float
Type: float
- The number of seconds it takes to eat the food. effects: List<FoodPropertiesPossibleEffect>
Type: List<FoodPropertiesPossibleEffect>
- The effects that the food applies when eaten.
Return Type:
FoodProperties
// FoodProperties.eatSeconds as floatFoodProperties.create(1, 1.0, true, 1.0).eatSeconds
Return Type:
float
FoodProperties.create(1, 1.0, true, 1.0).effects
Return Type:
List<FoodPropertiesPossibleEffect>
// FoodProperties.nutrition as intFoodProperties.create(1, 1.0, true, 1.0).nutrition
Return Type:
int
// FoodProperties.saturationModifier as floatFoodProperties.create(1, 1.0, true, 1.0).saturationModifier
Return Type:
float
// FoodProperties.usingConvertsTo as IItemStackFoodProperties.create(1, 1.0, true, 1.0).usingConvertsTo
Return Type:
IItemStack
Returns: The new food properties.
FoodProperties.create(1, 1.0, true, 1.0).withCanAlwaysEat(myBool);
Parameters:
canAlwaysEat: bool
Type: bool
- The new can always eat value.
Return Type:
FoodProperties
Returns: The new food properties.
FoodProperties.create(1, 1.0, true, 1.0).withEatSeconds(myInt);
Parameters:
eatSeconds: int
Type: int
- The new eat seconds value.
Return Type:
FoodProperties
Returns: The new food properties.
FoodProperties.create(1, 1.0, true, 1.0).withEffect(myMobEffectInstance, myFloat);
Parameters:
probability: float
Type: float
- The probability of the effect.
Return Type:
FoodProperties
Returns: The new food properties.
FoodProperties.create(1, 1.0, true, 1.0).withEffect(myPossibleEffect);
Parameters:
Return Type:
FoodProperties
Returns: The new food properties.
FoodProperties.create(1, 1.0, true, 1.0).withEffects(myList);
Parameters:
effects: List<FoodPropertiesPossibleEffect>
Type: List<FoodPropertiesPossibleEffect>
- The new effects.
Return Type:
FoodProperties
Returns: The new food properties.
FoodProperties.create(1, 1.0, true, 1.0).withNutrition(myInt);
Parameters:
nutrition: int
Type: int
- The new nutrition value.
Return Type:
FoodProperties
Returns: The new food properties.
FoodProperties.create(1, 1.0, true, 1.0).withoutEffect(myMobEffect);
Return Type:
FoodProperties
Returns: The new food properties.
FoodProperties.create(1, 1.0, true, 1.0).withoutEffect(myPossibleEffect);
Parameters:
Return Type:
FoodProperties
Returns: The new food properties.
FoodProperties.create(1, 1.0, true, 1.0).withSaturation(myFloat);
Parameters:
saturation: float
Type: float
- The new saturation modifier.
Return Type:
FoodProperties
Returns: The new food properties.
FoodProperties.create(1, 1.0, true, 1.0).withUsingConvertsTo(myIItemStack);
Parameters:
Return Type:
FoodProperties