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 coa
intermediary net/minecraft/class_4174
named net/minecraft/item/FoodComponent
official c
intermediary comp_2491
named hunger
official d
intermediary comp_2492
named saturationModifier
official e
intermediary comp_2493
named alwaysEdible
official f
intermediary comp_2494
named eatSeconds
official g
intermediary comp_2495
named statusEffects
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static final record
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final boolean
The field for thealwaysEdible
record component.private final float
The field for theeatSeconds
record component.static final com.mojang.serialization.Codec
<FoodComponent> static final PacketCodec
<RegistryByteBuf, FoodComponent> private static final float
private final int
The field for thehunger
record component.private final float
The field for thesaturationModifier
record component.private final List
<FoodComponent.class_9423> The field for thestatusEffects
record component. -
Constructor Summary
ConstructorsConstructorDescriptionFoodComponent
(int hunger, float saturationModifier, boolean meat, float float2, List<FoodComponent.class_9423> list) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks if a food item can be eaten when the current hunger bar is full.float
Returns the value of theeatSeconds
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
hunger()
Gets the amount of hunger a food item will fill.int
float
Gets 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 String
toString()
Returns a string representation of this record class.
-
Field Details
-
hunger
private final int hungerThe field for thehunger
record component. -
saturationModifier
private final float saturationModifierThe field for thesaturationModifier
record component. -
alwaysEdible
private final boolean alwaysEdibleThe field for thealwaysEdible
record component. -
eatSeconds
private final float eatSecondsThe field for theeatSeconds
record component. -
statusEffects
The field for thestatusEffects
record component. -
field_49994
private static final float field_49994- See Also:
- Mappings:
Namespace Name Mixin selector official h
Lcoa;h:F
intermediary field_49994
Lnet/minecraft/class_4174;field_49994:F
named field_49994
Lnet/minecraft/item/FoodComponent;field_49994:F
-
field_49992
- Mappings:
Namespace Name Mixin selector official a
Lcoa;a:Lcom/mojang/serialization/Codec;
intermediary field_49992
Lnet/minecraft/class_4174;field_49992:Lcom/mojang/serialization/Codec;
named field_49992
Lnet/minecraft/item/FoodComponent;field_49992:Lcom/mojang/serialization/Codec;
-
field_49993
- Mappings:
Namespace Name Mixin selector official b
Lcoa;b:Lys;
intermediary field_49993
Lnet/minecraft/class_4174;field_49993:Lnet/minecraft/class_9139;
named field_49993
Lnet/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;)V
intermediary <init>
Lnet/minecraft/class_4174;<init>(IFZFLjava/util/List;)V
named <init>
Lnet/minecraft/item/FoodComponent;<init>(IFZFLjava/util/List;)V
-
-
Method Details
-
method_58399
public int method_58399()- Mappings:
Namespace Name Mixin selector official a
Lcoa;a()I
intermediary method_58399
Lnet/minecraft/class_4174;method_58399()I
named method_58399
Lnet/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 b
Lcoa;b()I
intermediary comp_2491
Lnet/minecraft/class_4174;comp_2491()I
named hunger
Lnet/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 c
Lcoa;c()F
intermediary comp_2492
Lnet/minecraft/class_4174;comp_2492()F
named saturationModifier
Lnet/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 d
Lcoa;d()Z
intermediary comp_2493
Lnet/minecraft/class_4174;comp_2493()Z
named alwaysEdible
Lnet/minecraft/item/FoodComponent;alwaysEdible()Z
-
eatSeconds
public float eatSeconds()Returns the value of theeatSeconds
record component.- Returns:
- the value of the
eatSeconds
record 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.0F
and1.0F
.- Mappings:
Namespace Name Mixin selector official f
Lcoa;f()Ljava/util/List;
intermediary comp_2495
Lnet/minecraft/class_4174;comp_2495()Ljava/util/List;
named statusEffects
Lnet/minecraft/item/FoodComponent;statusEffects()Ljava/util/List;
-