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
  • Field Details

    • hunger

      private final int hunger
      The field for the hunger record component.
    • saturationModifier

      private final float saturationModifier
      The field for the saturationModifier record component.
    • alwaysEdible

      private final boolean alwaysEdible
      The field for the alwaysEdible record component.
    • eatSeconds

      private final float eatSeconds
      The field for the eatSeconds record component.
    • statusEffects

      private final List<FoodComponent.class_9423> statusEffects
      The field for the statusEffects 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

      public static final com.mojang.serialization.Codec<FoodComponent> 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

      public static final PacketCodec<RegistryByteBuf,FoodComponent> 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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object object)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      object - the object with which to compare
      Returns:
      true if this object is the same as the object argument; false otherwise.
    • 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 the eatSeconds record component.
      Returns:
      the value of the eatSeconds record component
    • statusEffects

      public List<FoodComponent.class_9423> 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 and 1.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;