Class CitizenFoodHandler
java.lang.Object
com.minecolonies.core.entity.citizen.citizenhandlers.CitizenFoodHandler
- All Implemented Interfaces:
ICitizenFoodHandler
The food handler for the citizen.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.minecolonies.api.entity.citizen.citizenhandlers.ICitizenFoodHandler
ICitizenFoodHandler.CitizenFoodStats -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLastEaten(net.minecraft.world.item.Item item) Add last eaten food item.intcheckLastEaten(net.minecraft.world.item.Item item) Check when we last ate a given food item.doublegetDiseaseModifier(double baseModifier) Disease modifier based on the food values.Get the food happiness statsnet.minecraft.world.item.ItemGet the last eaten food item.com.google.common.collect.ImmutableList<net.minecraft.world.item.Item>Get the list of last eaten food items.booleanIf the citizen has a full food history to allow a good analysis.voidread(net.minecraft.nbt.CompoundTag compound) Read from nbt.voidwrite(net.minecraft.nbt.CompoundTag compound) Write to nbt.
-
Constructor Details
-
CitizenFoodHandler
Create the food handler.- Parameters:
citizenData- of it.
-
-
Method Details
-
addLastEaten
public void addLastEaten(net.minecraft.world.item.Item item) Description copied from interface:ICitizenFoodHandlerAdd last eaten food item.- Specified by:
addLastEatenin interfaceICitizenFoodHandler- Parameters:
item- the last eaten food item.
-
getLastEaten
public net.minecraft.world.item.Item getLastEaten()Description copied from interface:ICitizenFoodHandlerGet the last eaten food item.- Specified by:
getLastEatenin interfaceICitizenFoodHandler- Returns:
- the last eaten item.
-
checkLastEaten
public int checkLastEaten(net.minecraft.world.item.Item item) Description copied from interface:ICitizenFoodHandlerCheck when we last ate a given food item. -1 if not eaten recently.- Specified by:
checkLastEatenin interfaceICitizenFoodHandler- 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
Description copied from interface:ICitizenFoodHandlerGet the food happiness stats- Specified by:
getFoodHappinessStatsin interfaceICitizenFoodHandler
-
hasFullFoodHistory
public boolean hasFullFoodHistory()Description copied from interface:ICitizenFoodHandlerIf the citizen has a full food history to allow a good analysis.- Specified by:
hasFullFoodHistoryin interfaceICitizenFoodHandler- Returns:
- true if so.
-
read
public void read(net.minecraft.nbt.CompoundTag compound) Description copied from interface:ICitizenFoodHandlerRead from nbt.- Specified by:
readin interfaceICitizenFoodHandler- Parameters:
compound- to read it from.
-
write
public void write(net.minecraft.nbt.CompoundTag compound) Description copied from interface:ICitizenFoodHandlerWrite to nbt.- Specified by:
writein interfaceICitizenFoodHandler- Parameters:
compound- to write it to.
-
getDiseaseModifier
public double getDiseaseModifier(double baseModifier) Description copied from interface:ICitizenFoodHandlerDisease modifier based on the food values.- Specified by:
getDiseaseModifierin interfaceICitizenFoodHandler- 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:ICitizenFoodHandlerGet the list of last eaten food items.- Specified by:
getLastEatenFoodsin interfaceICitizenFoodHandler- Returns:
- the last eaten food items.
-