Class CitizenFoodHandler

java.lang.Object
com.minecolonies.core.entity.citizen.citizenhandlers.CitizenFoodHandler
All Implemented Interfaces:
ICitizenFoodHandler

public class CitizenFoodHandler extends Object implements ICitizenFoodHandler
The food handler for the citizen.
  • Constructor Details

    • CitizenFoodHandler

      public CitizenFoodHandler(ICitizenData citizenData)
      Create the food handler.
      Parameters:
      citizenData - of it.
  • Method Details

    • addLastEaten

      public void addLastEaten(net.minecraft.world.item.Item item)
      Description copied from interface: ICitizenFoodHandler
      Add last eaten food item.
      Specified by:
      addLastEaten in interface ICitizenFoodHandler
      Parameters:
      item - the last eaten food item.
    • getLastEaten

      public net.minecraft.world.item.Item getLastEaten()
      Description copied from interface: ICitizenFoodHandler
      Get the last eaten food item.
      Specified by:
      getLastEaten in interface ICitizenFoodHandler
      Returns:
      the last eaten item.
    • checkLastEaten

      public int checkLastEaten(net.minecraft.world.item.Item item)
      Description copied from interface: ICitizenFoodHandler
      Check when we last ate a given food item. -1 if not eaten recently.
      Specified by:
      checkLastEaten in interface ICitizenFoodHandler
      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

      public ICitizenFoodHandler.CitizenFoodStats getFoodHappinessStats()
      Description copied from interface: ICitizenFoodHandler
      Get the food happiness stats
      Specified by:
      getFoodHappinessStats in interface ICitizenFoodHandler
    • hasFullFoodHistory

      public boolean hasFullFoodHistory()
      Description copied from interface: ICitizenFoodHandler
      If the citizen has a full food history to allow a good analysis.
      Specified by:
      hasFullFoodHistory in interface ICitizenFoodHandler
      Returns:
      true if so.
    • read

      public void read(net.minecraft.nbt.CompoundTag compound)
      Description copied from interface: ICitizenFoodHandler
      Read from nbt.
      Specified by:
      read in interface ICitizenFoodHandler
      Parameters:
      compound - to read it from.
    • write

      public void write(net.minecraft.nbt.CompoundTag compound)
      Description copied from interface: ICitizenFoodHandler
      Write to nbt.
      Specified by:
      write in interface ICitizenFoodHandler
      Parameters:
      compound - to write it to.
    • getDiseaseModifier

      public double getDiseaseModifier(double baseModifier)
      Description copied from interface: ICitizenFoodHandler
      Disease modifier based on the food values.
      Specified by:
      getDiseaseModifier in interface ICitizenFoodHandler
      Parameters:
      baseModifier - the modifier to the original disease chance.
      Returns:
      the modifier.
    • getLastEatenFoods

      public com.google.common.collect.ImmutableList<net.minecraft.world.item.Item> getLastEatenFoods()
      Description copied from interface: ICitizenFoodHandler
      Get the list of last eaten food items.
      Specified by:
      getLastEatenFoods in interface ICitizenFoodHandler
      Returns:
      the last eaten food items.