public static class FoodComponent.Builder extends Object
Modifier and Type | Field and Description |
---|---|
private boolean |
alwaysEdible |
private int |
hunger |
private boolean |
meat |
private float |
saturationModifier |
private boolean |
snack |
private List<com.mojang.datafixers.util.Pair<StatusEffectInstance,Float>> |
statusEffects |
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
FoodComponent.Builder |
alwaysEdible()
Specifies that a food item can be eaten when the current hunger bar is full.
|
FoodComponent |
build() |
FoodComponent.Builder |
hunger(int hunger)
Specifies the amount of hunger a food item will fill.
|
FoodComponent.Builder |
meat()
Specifies that a food item can be fed to dogs.
|
FoodComponent.Builder |
saturationModifier(float saturationModifier)
Specifies the saturation modifier of a food item.
|
FoodComponent.Builder |
snack()
Specifies that a food item is snack-like and is eaten quickly.
|
FoodComponent.Builder |
statusEffect(StatusEffectInstance effect,
float chance)
Specifies a status effect to apply to an entity when a food item is consumed.
|
private int hunger
private float saturationModifier
private boolean meat
private boolean alwaysEdible
private boolean snack
private final List<com.mojang.datafixers.util.Pair<StatusEffectInstance,Float>> statusEffects
public FoodComponent.Builder hunger(int hunger)
One hunger is equivalent to half of a hunger bar icon.
hunger
- the amount of hungerpublic FoodComponent.Builder saturationModifier(float saturationModifier)
This value is typically used to determine how long a player can sustain the current hunger value before the hunger is used.
saturationModifier
- the saturation modifierpublic FoodComponent.Builder meat()
public FoodComponent.Builder alwaysEdible()
public FoodComponent.Builder snack()
public FoodComponent.Builder statusEffect(StatusEffectInstance effect, float chance)
effect
- the effect instance to applychance
- the chance the status effect is applied, on a scale of 0.0F
to 1.0F
public FoodComponent build()