use of com.minecolonies.coremod.colony.buildings.workerbuildings.BuildingCook in project minecolonies by Minecolonies.
the class EntityAIEatTask method getFoodYourself.
/**
* Try to gather some food from the restaurant block.
*
* @return the next state to go to.
*/
private EatingState getFoodYourself() {
if (restaurantPos == null) {
return SEARCH_RESTAURANT;
}
final IColony colony = citizen.getCitizenColonyHandler().getColony();
final IBuilding cookBuilding = colony.getBuildingManager().getBuilding(restaurantPos);
if (cookBuilding instanceof BuildingCook) {
if (!citizen.isWorkerAtSiteWithMove(cookBuilding.getPosition(), MIN_DISTANCE_TO_RESTAURANT)) {
return GET_FOOD_YOURSELF;
}
InventoryUtils.transferFoodUpToSaturation(cookBuilding, citizen.getInventoryCitizen(), GET_YOURSELF_SATURATION, stack -> CAN_EAT.test(stack) && canEat(citizen.getCitizenData(), stack) && !((BuildingCook) cookBuilding).getModuleMatching(ItemListModule.class, m -> m.getId().equals(BuildingCook.FOOD_EXCLUSION_LIST)).isItemInList(new ItemStorage(stack)));
}
return WAIT_FOR_FOOD;
}
use of com.minecolonies.coremod.colony.buildings.workerbuildings.BuildingCook in project minecolonies by ldtteam.
the class EntityAIEatTask method getFoodYourself.
/**
* Try to gather some food from the restaurant block.
*
* @return the next state to go to.
*/
private EatingState getFoodYourself() {
if (restaurantPos == null) {
return SEARCH_RESTAURANT;
}
final IColony colony = citizen.getCitizenColonyHandler().getColony();
final IBuilding cookBuilding = colony.getBuildingManager().getBuilding(restaurantPos);
if (cookBuilding instanceof BuildingCook) {
InventoryUtils.transferFoodUpToSaturation(cookBuilding, citizen.getInventoryCitizen(), GET_YOURSELF_SATURATION, stack -> CAN_EAT.test(stack) && canEat(citizen.getCitizenData(), stack) && !((BuildingCook) cookBuilding).getModuleMatching(ItemListModule.class, m -> m.getId().equals(BuildingCook.FOOD_EXCLUSION_LIST)).isItemInList(new ItemStorage(stack)));
}
return WAIT_FOR_FOOD;
}
Aggregations