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 float
static 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 aFood
record class. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns the value of thecanAlwaysEat
record component.int
float
Returns the value of theeatSeconds
record component.@NotNull List
<Food.EffectChance> effects()
Returns the value of theeffects
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.int
Returns the value of thenutrition
record component.float
Returns the value of thesaturationModifier
record component.final String
toString()
Returns a string representation of this record class.@NotNull ItemStack
Returns the value of theusingConvertsTo
record 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 aFood
record class.- Parameters:
nutrition
- the value for thenutrition
record componentsaturationModifier
- the value for thesaturationModifier
record componentcanAlwaysEat
- the value for thecanAlwaysEat
record componenteatSeconds
- the value for theeatSeconds
record componentusingConvertsTo
- the value for theusingConvertsTo
record componenteffects
- the value for theeffects
record 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 thenutrition
record component.- Returns:
- the value of the
nutrition
record component
-
saturationModifier
public float saturationModifier()Returns the value of thesaturationModifier
record component.- Returns:
- the value of the
saturationModifier
record component
-
canAlwaysEat
public boolean canAlwaysEat()Returns the value of thecanAlwaysEat
record component.- Returns:
- the value of the
canAlwaysEat
record component
-
eatSeconds
public float eatSeconds()Returns the value of theeatSeconds
record component.- Returns:
- the value of the
eatSeconds
record component
-
usingConvertsTo
Returns the value of theusingConvertsTo
record component.- Returns:
- the value of the
usingConvertsTo
record component
-
effects
Returns the value of theeffects
record component.- Returns:
- the value of the
effects
record component
-