Package net.minecraft.component.type
Record Class FoodComponent
java.lang.Object
java.lang.Record
net.minecraft.component.type.FoodComponent
- Record Components:
nutrition-saturation-canAlwaysEat-eatSeconds-usingConvertsTo-effects-
public record FoodComponent(int nutrition, float saturation, boolean canAlwaysEat, float eatSeconds, Optional<ItemStack> usingConvertsTo, List<FoodComponent.StatusEffectEntry> effects)
extends Record
Represents the components that make up the properties of a food item.
- Mappings:
Namespace Name named net/minecraft/component/type/FoodComponentintermediary net/minecraft/class_4174official cprnamed nutritionintermediary comp_2491official cnamed saturationintermediary comp_2492official dnamed canAlwaysEatintermediary comp_2493official enamed eatSecondsintermediary comp_2494official fnamed usingConvertsTointermediary comp_2794official gnamed effectsintermediary comp_2495official h
-
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 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 thesaturationrecord component.The field for theusingConvertsTorecord component. -
Constructor Summary
ConstructorsConstructorDescriptionFoodComponent(int hunger, float saturationModifier, boolean meat, float float2, Optional<ItemStack> optional, List<FoodComponent.StatusEffectEntry> list) -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of thecanAlwaysEatrecord component.floatReturns the value of theeatSecondsrecord 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 thesaturationrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of theusingConvertsTorecord component.
-
Field Details
-
nutrition
private final int nutritionThe field for thenutritionrecord component. -
saturation
private final float saturationThe field for thesaturationrecord component. -
canAlwaysEat
private final boolean canAlwaysEatThe field for thecanAlwaysEatrecord component. -
eatSeconds
private final float eatSecondsThe field for theeatSecondsrecord component. -
usingConvertsTo
The field for theusingConvertsTorecord component. -
effects
The field for theeffectsrecord component. -
DEFAULT_EAT_SECONDS
private static final float DEFAULT_EAT_SECONDS- See Also:
- Mappings:
Namespace Name Mixin selector named DEFAULT_EAT_SECONDSLnet/minecraft/component/type/FoodComponent;DEFAULT_EAT_SECONDS:Fintermediary field_49994Lnet/minecraft/class_4174;field_49994:Fofficial iLcpr;i:F
-
CODEC
- Mappings:
Namespace Name Mixin selector named CODECLnet/minecraft/component/type/FoodComponent;CODEC:Lcom/mojang/serialization/Codec;intermediary field_49992Lnet/minecraft/class_4174;field_49992:Lcom/mojang/serialization/Codec;official aLcpr;a:Lcom/mojang/serialization/Codec;
-
PACKET_CODEC
- Mappings:
Namespace Name Mixin selector named PACKET_CODECLnet/minecraft/component/type/FoodComponent;PACKET_CODEC:Lnet/minecraft/network/codec/PacketCodec;intermediary field_49993Lnet/minecraft/class_4174;field_49993:Lnet/minecraft/class_9139;official bLcpr;b:Lyx;
-
-
Constructor Details
-
FoodComponent
public FoodComponent(int hunger, float saturationModifier, boolean meat, float float2, Optional<ItemStack> optional, List<FoodComponent.StatusEffectEntry> list) - Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/component/type/FoodComponent;<init>(IFZFLjava/util/Optional;Ljava/util/List;)Vintermediary <init>Lnet/minecraft/class_4174;<init>(IFZFLjava/util/Optional;Ljava/util/List;)Vofficial <init>Lcpr;<init>(IFZFLjava/util/Optional;Ljava/util/List;)V
-
-
Method Details
-
getEatTicks
public int getEatTicks()- Mappings:
Namespace Name Mixin selector named getEatTicksLnet/minecraft/component/type/FoodComponent;getEatTicks()Iintermediary method_58399Lnet/minecraft/class_4174;method_58399()Iofficial aLcpr;a()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
-
saturation
public float saturation()Returns the value of thesaturationrecord component.- Returns:
- the value of the
saturationrecord 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
-
usingConvertsTo
Returns the value of theusingConvertsTorecord component.- Returns:
- the value of the
usingConvertsTorecord component
-
effects
Returns the value of theeffectsrecord component.- Returns:
- the value of the
effectsrecord component
-