Package net.minecraft.world.food
Record Class FoodProperties
java.lang.Object
java.lang.Record
net.minecraft.world.food.FoodProperties
public record FoodProperties(int nutrition, float saturation, boolean canAlwaysEat, float eatSeconds, List<FoodProperties.PossibleEffect> effects)
extends Record
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanThe field for thecanAlwaysEatrecord component.private static final floatstatic final com.mojang.serialization.Codec<FoodProperties> static final StreamCodec<RegistryFriendlyByteBuf, FoodProperties> private final floatThe field for theeatSecondsrecord component.private final List<FoodProperties.PossibleEffect> The field for theeffectsrecord component.private final intThe field for thenutritionrecord component.private final floatThe field for thesaturationrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionFoodProperties(int nutrition, float saturation, boolean canAlwaysEat, float eatSeconds, List<FoodProperties.PossibleEffect> effects) Creates an instance of aFoodPropertiesrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of thecanAlwaysEatrecord component.intfloatReturns the value of theeatSecondsrecord component.effects()Returns the value of theeffectsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of thenutritionrecord component.floatReturns the value of thesaturationrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
nutrition
private final int nutritionThe field for thenutritionrecord component. -
saturation
private final float saturationThe field for thesaturationrecord component. -
canAlwaysEat
private final boolean canAlwaysEatThe field for thecanAlwaysEatrecord component. -
eatSeconds
private final float eatSecondsThe field for theeatSecondsrecord component. -
effects
The field for theeffectsrecord component. -
DEFAULT_EAT_SECONDS
private static final float DEFAULT_EAT_SECONDS- See Also:
-
DIRECT_CODEC
-
DIRECT_STREAM_CODEC
-
-
Constructor Details
-
FoodProperties
public FoodProperties(int nutrition, float saturation, boolean canAlwaysEat, float eatSeconds, List<FoodProperties.PossibleEffect> effects) Creates an instance of aFoodPropertiesrecord class.- Parameters:
nutrition- the value for thenutritionrecord componentsaturation- the value for thesaturationrecord componentcanAlwaysEat- the value for thecanAlwaysEatrecord componenteatSeconds- the value for theeatSecondsrecord componenteffects- the value for theeffectsrecord component
-
-
Method Details
-
eatDurationTicks
public int eatDurationTicks() -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
nutrition
public int nutrition()Returns the value of thenutritionrecord component.- Returns:
- the value of the
nutritionrecord component
-
saturation
public float saturation()Returns the value of thesaturationrecord component.- Returns:
- the value of the
saturationrecord component
-
canAlwaysEat
public boolean canAlwaysEat()Returns the value of thecanAlwaysEatrecord component.- Returns:
- the value of the
canAlwaysEatrecord component
-
eatSeconds
public float eatSeconds()Returns the value of theeatSecondsrecord component.- Returns:
- the value of the
eatSecondsrecord component
-
effects
Returns the value of theeffectsrecord component.- Returns:
- the value of the
effectsrecord component
-