Class AbstractFood

Direct Known Subclasses:
Foods.Apple, Foods.Candy, Foods.Carrot, Foods.ChickenLeg, Foods.CloudCookie, Foods.CloudCupcake, Foods.CottonCloud, Foods.FriedFish, Foods.Meat, Foods.Milk, Foods.Shrimp, Foods.Sushi

public class AbstractFood extends ConsumableItem
The AbstractFood class manages the amount of hunger points (provided from food items) is added to the hunger bar This classes applies the effect of the nutrition points towards the animal hunger bar
  • Constructor Details

    • AbstractFood

      protected AbstractFood(String name, int itemCode, int limit, int quantity, int feedingAmount)
      Constructs a AbstractFood with the specified uses
      Parameters:
      name - the name of the item
      itemCode - the item code
      limit - the stack limit of the item
      quantity - the initial quantity for this item
  • Method Details

    • useItem

      public void useItem(ItemUsageContext context)
      Uses the food by applying its effects and decreasing the number of uses If no uses are left the potion will not apply the effect and will throw an error
      Overrides:
      useItem in class ConsumableItem
      Parameters:
      context - the context in which the item is used (contains a Player to use on)