if (farmLogics.length <= entry.getKey().ordinal() - 2 || farmLogics[entry.getKey().ordinal() - 2] == null)
continue;
boolean didWork = false;
IFarmLogic logic = farmLogics[entry.getKey().ordinal() - 2];
// Allow listeners to cancel this cycle.
for (IFarmListener listener : eventHandlers)
if (listener.cancelTask(logic, entry.getKey()))
continue cycle;
// Always try to collect windfall first.
if (doCollection(logic))
didWork = true;
else
for (int i = 0; i < entry.getValue().length; i++) {
FarmTarget target = entry.getValue()[i];
if (target.getExtent() <= 0)
continue;
else
hasFarmland = true;
if (!stage) {
// Check fertilizer and water
if (!hasFertilizer(logic.getFertilizerConsumption()))
continue;
else
hasFertilizer = true;
FluidStack liquid = LiquidHelper.getLiquid(Defaults.LIQUID_WATER, logic.getWaterConsumption(getHydrationModifier()));
if (liquid.amount > 0 && !hasLiquid(liquid))
continue;
else
hasLiquid = true;
if (doCultivationPhase(logic, target, entry.getKey())) {
// Remove fertilizer and water
removeFertilizer(logic.getFertilizerConsumption());
removeLiquid(liquid);
didWork = true;
}