Interface ICitizenFoodHandler

All Known Implementing Classes:
CitizenFoodHandler

public interface ICitizenFoodHandler
Citizen food handler interface.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
    Food happiness stats.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addLastEaten(net.minecraft.world.item.Item item)
    Add last eaten food item.
    int
    checkLastEaten(net.minecraft.world.item.Item item)
    Check when we last ate a given food item.
    double
    getDiseaseModifier(double baseModifier)
    Disease modifier based on the food values.
    Get the food happiness stats
    net.minecraft.world.item.Item
    Get the last eaten food item.
    com.google.common.collect.ImmutableList<net.minecraft.world.item.Item>
    Get the list of last eaten food items.
    boolean
    If the citizen has a full food history to allow a good analysis.
    void
    read(net.minecraft.nbt.CompoundTag compound)
    Read from nbt.
    void
    write(net.minecraft.nbt.CompoundTag compound)
    Write to nbt.
  • Method Details

    • addLastEaten

      void addLastEaten(net.minecraft.world.item.Item item)
      Add last eaten food item.
      Parameters:
      item - the last eaten food item.
    • getLastEaten

      net.minecraft.world.item.Item getLastEaten()
      Get the last eaten food item.
      Returns:
      the last eaten item.
    • checkLastEaten

      int checkLastEaten(net.minecraft.world.item.Item item)
      Check when we last ate a given food item. -1 if not eaten recently.
      Parameters:
      item - the food item we last ate.
      Returns:
      the index in the list or -1 for not recently or oldest food in queue
    • getFoodHappinessStats

      ICitizenFoodHandler.CitizenFoodStats getFoodHappinessStats()
      Get the food happiness stats
    • read

      void read(net.minecraft.nbt.CompoundTag compound)
      Read from nbt.
      Parameters:
      compound - to read it from.
    • write

      void write(net.minecraft.nbt.CompoundTag compound)
      Write to nbt.
      Parameters:
      compound - to write it to.
    • getDiseaseModifier

      double getDiseaseModifier(double baseModifier)
      Disease modifier based on the food values.
      Parameters:
      baseModifier - the modifier to the original disease chance.
      Returns:
      the modifier.
    • hasFullFoodHistory

      boolean hasFullFoodHistory()
      If the citizen has a full food history to allow a good analysis.
      Returns:
      true if so.
    • getLastEatenFoods

      com.google.common.collect.ImmutableList<net.minecraft.world.item.Item> getLastEatenFoods()
      Get the list of last eaten food items.
      Returns:
      the last eaten food items.