Package net.minecraft.item
Class FoodComponent
java.lang.Object
net.minecraft.item.FoodComponent
Represents the components that make up the properties of a food item.
- Mappings:
Namespace Name official cba
intermediary net/minecraft/class_4174
named net/minecraft/item/FoodComponent
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprivate final boolean
private final int
private final boolean
private final float
private final boolean
private final List<com.mojang.datafixers.util.Pair<StatusEffectInstance,
Float>> -
Constructor Summary
ConstructorDescriptionFoodComponent
(int hunger, float saturationModifier, boolean meat, boolean alwaysEdible, boolean snack, List<com.mojang.datafixers.util.Pair<StatusEffectInstance, Float>> statusEffects) -
Method Summary
Modifier and TypeMethodDescriptionint
Gets the amount of hunger a food item will fill.float
Gets the saturation modifier of a food item.List<com.mojang.datafixers.util.Pair<StatusEffectInstance,
Float>> Gets a list of all status effect instances that may be applied when a food item is consumed.boolean
Checks if a food item can be eaten when the current hunger bar is full.boolean
isMeat()
Checks if a food item can be fed to dogs.boolean
isSnack()
Checks if a food item is snack-like and is eaten quickly.
-
Field Details
-
hunger
private final int hunger- Mappings:
Namespace Name Mixin selector official a
Lcba;a:I
intermediary field_18614
Lnet/minecraft/class_4174;field_18614:I
named hunger
Lnet/minecraft/item/FoodComponent;hunger:I
-
saturationModifier
private final float saturationModifier- Mappings:
Namespace Name Mixin selector official b
Lcba;b:F
intermediary field_18615
Lnet/minecraft/class_4174;field_18615:F
named saturationModifier
Lnet/minecraft/item/FoodComponent;saturationModifier:F
-
meat
private final boolean meat- Mappings:
Namespace Name Mixin selector official c
Lcba;c:Z
intermediary field_18616
Lnet/minecraft/class_4174;field_18616:Z
named meat
Lnet/minecraft/item/FoodComponent;meat:Z
-
alwaysEdible
private final boolean alwaysEdible- Mappings:
Namespace Name Mixin selector official d
Lcba;d:Z
intermediary field_18617
Lnet/minecraft/class_4174;field_18617:Z
named alwaysEdible
Lnet/minecraft/item/FoodComponent;alwaysEdible:Z
-
snack
private final boolean snack- Mappings:
Namespace Name Mixin selector official e
Lcba;e:Z
intermediary field_18618
Lnet/minecraft/class_4174;field_18618:Z
named snack
Lnet/minecraft/item/FoodComponent;snack:Z
-
statusEffects
- Mappings:
Namespace Name Mixin selector official f
Lcba;f:Ljava/util/List;
intermediary field_18619
Lnet/minecraft/class_4174;field_18619:Ljava/util/List;
named statusEffects
Lnet/minecraft/item/FoodComponent;statusEffects:Ljava/util/List;
-
-
Constructor Details
-
FoodComponent
FoodComponent(int hunger, float saturationModifier, boolean meat, boolean alwaysEdible, boolean snack, List<com.mojang.datafixers.util.Pair<StatusEffectInstance, Float>> statusEffects) - Mappings:
Namespace Name Mixin selector official <init>
Lcba;<init>(IFZZZLjava/util/List;)V
intermediary <init>
Lnet/minecraft/class_4174;<init>(IFZZZLjava/util/List;)V
named <init>
Lnet/minecraft/item/FoodComponent;<init>(IFZZZLjava/util/List;)V
-
-
Method Details
-
getHunger
public int getHunger()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 a
Lcba;a()I
intermediary method_19230
Lnet/minecraft/class_4174;method_19230()I
named getHunger
Lnet/minecraft/item/FoodComponent;getHunger()I
-
getSaturationModifier
public float getSaturationModifier()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 b
Lcba;b()F
intermediary method_19231
Lnet/minecraft/class_4174;method_19231()F
named getSaturationModifier
Lnet/minecraft/item/FoodComponent;getSaturationModifier()F
-
isMeat
public boolean isMeat()Checks if a food item can be fed to dogs.- Mappings:
Namespace Name Mixin selector official c
Lcba;c()Z
intermediary method_19232
Lnet/minecraft/class_4174;method_19232()Z
named isMeat
Lnet/minecraft/item/FoodComponent;isMeat()Z
-
isAlwaysEdible
public boolean isAlwaysEdible()Checks if a food item can be eaten when the current hunger bar is full.- Mappings:
Namespace Name Mixin selector official d
Lcba;d()Z
intermediary method_19233
Lnet/minecraft/class_4174;method_19233()Z
named isAlwaysEdible
Lnet/minecraft/item/FoodComponent;isAlwaysEdible()Z
-
isSnack
public boolean isSnack()Checks if a food item is snack-like and is eaten quickly.- Mappings:
Namespace Name Mixin selector official e
Lcba;e()Z
intermediary method_19234
Lnet/minecraft/class_4174;method_19234()Z
named isSnack
Lnet/minecraft/item/FoodComponent;isSnack()Z
-
getStatusEffects
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
Lcba;f()Ljava/util/List;
intermediary method_19235
Lnet/minecraft/class_4174;method_19235()Ljava/util/List;
named getStatusEffects
Lnet/minecraft/item/FoodComponent;getStatusEffects()Ljava/util/List;
-