FoodValues - coolsquid/HungerTweaker GitHub Wiki

FoodValues

mods.hungertweaker.FoodValues

Can be retrieved from an IIngredient through the "foodValues" getter. Can be used to modify the properties of food items that match the specified ingredient.

If multiple ingredients are attached to FoodValues and match a given item, the item will be affected by the FoodValues instance that was retrieved last (as of 1.1.0).

Properties

  • hunger
    • Has a setter.
      • Accepts a number or an expression.
      • Sets the hunger added by all item stacks that match the IIngredient.
      • Equivalent to setHunger(IData).
    • Has a getter.
      • Returns a number.
      • Only works if the ingredient is an IItemStack that represents a single item.
  • saturationModifier
    • Has a setter.
      • Accepts a number or an expression.
      • Sets the saturation added by all item stacks that match the IIngredient.
        • The saturation to be added is equal to the food's hunger value * the food's saturation modifier.
        • The player's total saturation value cannot exceed the player's total hunger value.
      • Equivalent to setSaturationModifier(IData).
    • Has a getter.
      • Returns a number.
      • Only works if the ingredient is an IItemStack that represents a single item.
  • unmodifiedHunger
    • Does not have a setter.
    • Has a getter.
      • Returns a number, which represents the amount of hunger that would be added by the food item if neither HungerTweaker nor any other mods were modifying it.
      • Only works if the ingredient is an IItemStack that represents a single item.
  • unmodifiedSaturationModifier
    • Does not have a setter.
    • Has a getter.
      • Returns a number, which represents the amount of saturation that would be added by the food item if neither HungerTweaker nor any other mods were modifying it.
      • Only works if the ingredient is an IItemStack that represents a single item.

Methods

  • setHunger(IData)
    • Accepts a number or an expression.
    • Sets the hunger added by all item stacks that match the IIngredient.
  • setSaturationModifier(IData)
    • Accepts a number or an expression.
    • Sets the saturation added by all item stacks that match the IIngredient.

Examples

<ore:fruit>.foodValues.hunger = "x*10"; // Fruit is healthy. I have no idea if this ore dict entry actually exists, though.

<minecraft:apple>.foodValues.hunger = 10

⚠️ **GitHub.com Fallback** ⚠️