Record Class Food
java.lang.Object
java.lang.Record
net.minestom.server.item.component.Food
-
Field Summary
Modifier and TypeFieldDescriptionstatic final BinaryTagSerializer
<Food> static final NetworkBuffer.Type
<Food> -
Constructor Summary
ConstructorDescriptionFood
(int nutrition, float saturationModifier, boolean canAlwaysEat) Creates an instance of aFood
record class. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns the value of thecanAlwaysEat
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.
-
Field Details
-
NETWORK_TYPE
-
NBT_TYPE
-
-
Constructor Details
-
Food
public Food(int nutrition, float saturationModifier, boolean canAlwaysEat) 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 component
-
-
Method Details
-
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. All components in this record class 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
-