Search in sources :

Example 1 with BuildingCook

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;
}
Also used : IBuilding(com.minecolonies.api.colony.buildings.IBuilding) IColony(com.minecolonies.api.colony.IColony) BuildingCook(com.minecolonies.coremod.colony.buildings.workerbuildings.BuildingCook) ItemStorage(com.minecolonies.api.crafting.ItemStorage)

Example 2 with BuildingCook

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;
}
Also used : IBuilding(com.minecolonies.api.colony.buildings.IBuilding) IColony(com.minecolonies.api.colony.IColony) BuildingCook(com.minecolonies.coremod.colony.buildings.workerbuildings.BuildingCook) ItemStorage(com.minecolonies.api.crafting.ItemStorage)

Aggregations

IColony (com.minecolonies.api.colony.IColony)2 IBuilding (com.minecolonies.api.colony.buildings.IBuilding)2 ItemStorage (com.minecolonies.api.crafting.ItemStorage)2 BuildingCook (com.minecolonies.coremod.colony.buildings.workerbuildings.BuildingCook)2