Interface JavaFoodProperties


public interface JavaFoodProperties
The food properties component can be used to define properties for consumable items. This includes setting the nutrition and saturation values, and whether the item can always be eaten.
Since:
2.9.3
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Builder for the food properties component.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a builder for the food properties component.
    boolean
    Whether this item can always be eaten, even when not hungry.
    @org.checkerframework.checker.index.qual.NonNegative int
    The nutrition of the item.
    of(int nutrition, float saturation, boolean canAlwaysEat)
    Creates a food properties component.
    @org.checkerframework.checker.index.qual.NonNegative float
    The saturation of the item.
  • Method Details

    • nutrition

      @org.checkerframework.checker.index.qual.NonNegative int nutrition()
      The nutrition of the item. Defaults to 0.
      Returns:
      the nutrition
      Since:
      2.9.3
    • saturation

      @org.checkerframework.checker.index.qual.NonNegative float saturation()
      The saturation of the item. Defaults to 0.0.
      Returns:
      the saturation
      Since:
      2.9.3
    • canAlwaysEat

      boolean canAlwaysEat()
      Whether this item can always be eaten, even when not hungry. In vanilla, this would include items such as golden apples. Defaults to false.
      Returns:
      whether the item can always be eaten
      Since:
      2.9.3
    • builder

      static JavaFoodProperties.Builder builder()
      Creates a builder for the food properties component.
      Returns:
      a new builder
      Since:
      2.9.3
    • of

      static JavaFoodProperties of(int nutrition, float saturation, boolean canAlwaysEat)
      Creates a food properties component.
      Parameters:
      nutrition - the nutrition of the item
      saturation - the saturation of the item
      canAlwaysEat - whether the item can always be eaten
      Returns:
      the food properties component
      Since:
      2.9.3