Package net.minecraft.item
Record Class FoodComponent
java.lang.Object
java.lang.Record
net.minecraft.item.FoodComponent
- Record Components:
hunger-saturationModifier-alwaysEdible-eatSeconds-statusEffects-
public record FoodComponent(int hunger, float saturationModifier, boolean alwaysEdible, float eatSeconds, List<FoodComponent.class_9423> statusEffects)
extends Record
Represents the components that make up the properties of a food item.
- Mappings:
Namespace Name official coaintermediary net/minecraft/class_4174named net/minecraft/item/FoodComponentofficial cintermediary comp_2491named hungerofficial dintermediary comp_2492named saturationModifierofficial eintermediary comp_2493named alwaysEdibleofficial fintermediary comp_2494named eatSecondsofficial gintermediary comp_2495named statusEffects
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanThe field for thealwaysEdiblerecord component.private final floatThe field for theeatSecondsrecord component.static final com.mojang.serialization.Codec<FoodComponent> static final PacketCodec<RegistryByteBuf, FoodComponent> private static final floatprivate final intThe field for thehungerrecord component.private final floatThe field for thesaturationModifierrecord component.private final List<FoodComponent.class_9423> The field for thestatusEffectsrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionFoodComponent(int hunger, float saturationModifier, boolean meat, float float2, List<FoodComponent.class_9423> list) -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if a food item can be eaten when the current hunger bar is full.floatReturns the value of theeatSecondsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.inthunger()Gets the amount of hunger a food item will fill.intfloatGets the saturation modifier of a food item.Gets a list of all status effect instances that may be applied when a food item is consumed.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
hunger
private final int hungerThe field for thehungerrecord component. -
saturationModifier
private final float saturationModifierThe field for thesaturationModifierrecord component. -
alwaysEdible
private final boolean alwaysEdibleThe field for thealwaysEdiblerecord component. -
eatSeconds
private final float eatSecondsThe field for theeatSecondsrecord component. -
statusEffects
The field for thestatusEffectsrecord component. -
field_49994
private static final float field_49994- See Also:
- Mappings:
Namespace Name Mixin selector official hLcoa;h:Fintermediary field_49994Lnet/minecraft/class_4174;field_49994:Fnamed field_49994Lnet/minecraft/item/FoodComponent;field_49994:F
-
field_49992
- Mappings:
Namespace Name Mixin selector official aLcoa;a:Lcom/mojang/serialization/Codec;intermediary field_49992Lnet/minecraft/class_4174;field_49992:Lcom/mojang/serialization/Codec;named field_49992Lnet/minecraft/item/FoodComponent;field_49992:Lcom/mojang/serialization/Codec;
-
field_49993
- Mappings:
Namespace Name Mixin selector official bLcoa;b:Lys;intermediary field_49993Lnet/minecraft/class_4174;field_49993:Lnet/minecraft/class_9139;named field_49993Lnet/minecraft/item/FoodComponent;field_49993:Lnet/minecraft/network/codec/PacketCodec;
-
-
Constructor Details
-
FoodComponent
public FoodComponent(int hunger, float saturationModifier, boolean meat, float float2, List<FoodComponent.class_9423> list) - Mappings:
Namespace Name Mixin selector official <init>Lcoa;<init>(IFZFLjava/util/List;)Vintermediary <init>Lnet/minecraft/class_4174;<init>(IFZFLjava/util/List;)Vnamed <init>Lnet/minecraft/item/FoodComponent;<init>(IFZFLjava/util/List;)V
-
-
Method Details
-
method_58399
public int method_58399()- Mappings:
Namespace Name Mixin selector official aLcoa;a()Iintermediary method_58399Lnet/minecraft/class_4174;method_58399()Inamed method_58399Lnet/minecraft/item/FoodComponent;method_58399()I
-
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 '=='. -
hunger
public int hunger()Gets the amount of hunger a food item will fill.One hunger is equivalent to half of a hunger bar icon.
- Mappings:
Namespace Name Mixin selector official bLcoa;b()Iintermediary comp_2491Lnet/minecraft/class_4174;comp_2491()Inamed hungerLnet/minecraft/item/FoodComponent;hunger()I
-
saturationModifier
public float saturationModifier()Gets the saturation modifier of a food item.This value is typically used to determine how long a player can sustain the current hunger value before the hunger is used.
- Mappings:
Namespace Name Mixin selector official cLcoa;c()Fintermediary comp_2492Lnet/minecraft/class_4174;comp_2492()Fnamed saturationModifierLnet/minecraft/item/FoodComponent;saturationModifier()F
-
alwaysEdible
public boolean alwaysEdible()Checks if a food item can be eaten when the current hunger bar is full.- Mappings:
Namespace Name Mixin selector official dLcoa;d()Zintermediary comp_2493Lnet/minecraft/class_4174;comp_2493()Znamed alwaysEdibleLnet/minecraft/item/FoodComponent;alwaysEdible()Z
-
eatSeconds
public float eatSeconds()Returns the value of theeatSecondsrecord component.- Returns:
- the value of the
eatSecondsrecord component
-
statusEffects
Gets a list of all status effect instances that may be applied when a food item is consumed.The first value in the pair is the status effect instance to be applied.
The second value is the chance the status effect gets applied, on a scale between
0.0Fand1.0F.- Mappings:
Namespace Name Mixin selector official fLcoa;f()Ljava/util/List;intermediary comp_2495Lnet/minecraft/class_4174;comp_2495()Ljava/util/List;named statusEffectsLnet/minecraft/item/FoodComponent;statusEffects()Ljava/util/List;
-