Package net.minecraft.component.type
Record Class FoodComponent
java.lang.Object
java.lang.Record
net.minecraft.component.type.FoodComponent
- Record Components:
nutrition-saturationModifier-canAlwaysEat-eatSeconds-eatSound-effects-
public record FoodComponent(int nutrition, float saturationModifier, boolean canAlwaysEat, float eatSeconds, RegistryEntry<SoundEvent> eatSound, List<FoodComponent.StatusEffectEntry> effects)
extends Record
Represents the components that make up the properties of a food item.
- Mappings:
Namespace Name official covintermediary net/minecraft/class_4174named net/minecraft/component/type/FoodComponentofficial cintermediary comp_2491named nutritionofficial dintermediary comp_2492named saturationModifierofficial eintermediary comp_2493named canAlwaysEatofficial fintermediary comp_2494named eatSecondsofficial gintermediary comp_2570named eatSoundofficial hintermediary comp_2495named effects
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanThe field for thecanAlwaysEatrecord component.static final com.mojang.serialization.Codec<FoodComponent> private static final floatprivate final floatThe field for theeatSecondsrecord component.private final RegistryEntry<SoundEvent> The field for theeatSoundrecord component.private final List<FoodComponent.StatusEffectEntry> The field for theeffectsrecord component.private final intThe field for thenutritionrecord component.static final PacketCodec<RegistryByteBuf, FoodComponent> private final floatThe field for thesaturationModifierrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionFoodComponent(int hunger, float saturationModifier, boolean meat, float float2, RegistryEntry<SoundEvent> registryEntry, List<FoodComponent.StatusEffectEntry> list) -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of thecanAlwaysEatrecord component.floatReturns the value of theeatSecondsrecord component.eatSound()Returns the value of theeatSoundrecord component.effects()Returns the value of theeffectsrecord component.final booleanIndicates whether some other object is "equal to" this one.intfinal inthashCode()Returns a hash code value for this object.intReturns the value of thenutritionrecord component.floatReturns the value of thesaturationModifierrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
nutrition
private final int nutritionThe field for thenutritionrecord component. -
saturationModifier
private final float saturationModifierThe field for thesaturationModifierrecord component. -
canAlwaysEat
private final boolean canAlwaysEatThe field for thecanAlwaysEatrecord component. -
eatSeconds
private final float eatSecondsThe field for theeatSecondsrecord component. -
eatSound
The field for theeatSoundrecord component. -
effects
The field for theeffectsrecord component. -
DEFAULT_EAT_SECONDS
private static final float DEFAULT_EAT_SECONDS- See Also:
- Mappings:
Namespace Name Mixin selector official iLcov;i:Fintermediary field_49994Lnet/minecraft/class_4174;field_49994:Fnamed DEFAULT_EAT_SECONDSLnet/minecraft/component/type/FoodComponent;DEFAULT_EAT_SECONDS:F
-
CODEC
- Mappings:
Namespace Name Mixin selector official aLcov;a:Lcom/mojang/serialization/Codec;intermediary field_49992Lnet/minecraft/class_4174;field_49992:Lcom/mojang/serialization/Codec;named CODECLnet/minecraft/component/type/FoodComponent;CODEC:Lcom/mojang/serialization/Codec;
-
PACKET_CODEC
- Mappings:
Namespace Name Mixin selector official bLcov;b:Lzc;intermediary field_49993Lnet/minecraft/class_4174;field_49993:Lnet/minecraft/class_9139;named PACKET_CODECLnet/minecraft/component/type/FoodComponent;PACKET_CODEC:Lnet/minecraft/network/codec/PacketCodec;
-
-
Constructor Details
-
FoodComponent
public FoodComponent(int hunger, float saturationModifier, boolean meat, float float2, RegistryEntry<SoundEvent> registryEntry, List<FoodComponent.StatusEffectEntry> list) - Mappings:
Namespace Name Mixin selector official <init>Lcov;<init>(IFZFLja;Ljava/util/List;)Vintermediary <init>Lnet/minecraft/class_4174;<init>(IFZFLnet/minecraft/class_6880;Ljava/util/List;)Vnamed <init>Lnet/minecraft/component/type/FoodComponent;<init>(IFZFLnet/minecraft/registry/entry/RegistryEntry;Ljava/util/List;)V
-
-
Method Details
-
getEatTicks
public int getEatTicks()- Mappings:
Namespace Name Mixin selector official aLcov;a()Iintermediary method_58399Lnet/minecraft/class_4174;method_58399()Inamed getEatTicksLnet/minecraft/component/type/FoodComponent;getEatTicks()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 '=='. -
nutrition
public int nutrition()Returns the value of thenutritionrecord component.- Returns:
- the value of the
nutritionrecord component
-
saturationModifier
public float saturationModifier()Returns the value of thesaturationModifierrecord component.- Returns:
- the value of the
saturationModifierrecord component
-
canAlwaysEat
public boolean canAlwaysEat()Returns the value of thecanAlwaysEatrecord component.- Returns:
- the value of the
canAlwaysEatrecord component
-
eatSeconds
public float eatSeconds()Returns the value of theeatSecondsrecord component.- Returns:
- the value of the
eatSecondsrecord component
-
eatSound
Returns the value of theeatSoundrecord component.- Returns:
- the value of the
eatSoundrecord component
-
effects
Returns the value of theeffectsrecord component.- Returns:
- the value of the
effectsrecord component
-