Record Class Food
java.lang.Object
java.lang.Record
net.minestom.server.item.component.Food
public record Food(int nutrition, float saturationModifier, boolean canAlwaysEat, float eatSeconds, @NotNull ItemStack usingConvertsTo, @NotNull List<Food.EffectChance> effects)
extends Record
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatstatic final BinaryTagSerializer<Food> static final NetworkBuffer.Type<Food> -
Constructor Summary
ConstructorsConstructorDescriptionFood(int nutrition, float saturationModifier, boolean canAlwaysEat, float eatSeconds, @NotNull ItemStack usingConvertsTo, @NotNull List<Food.EffectChance> effects) Creates an instance of aFoodrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of thecanAlwaysEatrecord component.intfloatReturns the value of theeatSecondsrecord component.@NotNull List<Food.EffectChance> 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 thesaturationModifierrecord component.final StringtoString()Returns a string representation of this record class.@NotNull ItemStackReturns the value of theusingConvertsTorecord component.
-
Field Details
-
DEFAULT_EAT_SECONDS
public static final float DEFAULT_EAT_SECONDS- See Also:
-
NETWORK_TYPE
-
NBT_TYPE
-
-
Constructor Details
-
Food
public Food(int nutrition, float saturationModifier, boolean canAlwaysEat, float eatSeconds, @NotNull @NotNull ItemStack usingConvertsTo, @NotNull @NotNull List<Food.EffectChance> effects) Creates an instance of aFoodrecord class.- Parameters:
nutrition- the value for thenutritionrecord componentsaturationModifier- the value for thesaturationModifierrecord componentcanAlwaysEat- the value for thecanAlwaysEatrecord componenteatSeconds- the value for theeatSecondsrecord componentusingConvertsTo- the value for theusingConvertsTorecord 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
-
saturationModifier
public float saturationModifier()Returns the value of thesaturationModifierrecord component.- Returns:
- the value of the
saturationModifierrecord 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
-
usingConvertsTo
Returns the value of theusingConvertsTorecord component.- Returns:
- the value of the
usingConvertsTorecord component
-
effects
Returns the value of theeffectsrecord component.- Returns:
- the value of the
effectsrecord component
-