use of com.minecolonies.api.entity.ai.statemachine.states.IAIState in project minecolonies by ldtteam.
the class EntityAIWorkFisherman method doFishing.
/**
* Main fishing methods, let's the fisherman gather xp orbs next to him, check if all requirements to fish are given. Actually fish, retrieve his rod if stuck or if a fish
* bites.
*
* @return the next IAIState the fisherman should switch to, after executing this method.
*/
@Nullable
private IAIState doFishing() {
worker.getCitizenStatusHandler().setLatestStatus(new TranslationTextComponent("com.minecolonies.coremod.status.fishing"));
@Nullable final IAIState notReadyState = isReadyToFish();
if (notReadyState != null) {
return notReadyState;
}
if (caughtFish()) {
playCaughtFishSound();
this.incrementActionsDoneAndDecSaturation();
if (worker.getRandom().nextDouble() < CHANCE_NEW_POND) {
job.setWater(null);
return FISHERMAN_SEARCHING_WATER;
}
return FISHERMAN_WALKING_TO_WATER;
}
return throwOrRetrieveHook();
}
use of com.minecolonies.api.entity.ai.statemachine.states.IAIState in project minecolonies by ldtteam.
the class EntityAIWorkCowboy method decideWhatToDo.
@Override
public IAIState decideWhatToDo() {
final IAIState result = super.decideWhatToDo();
final BuildingCowboy building = getOwnBuilding();
final boolean hasBucket = InventoryUtils.hasItemInItemHandler(worker.getInventoryCitizen(), Items.BUCKET);
if (building != null && getOwnBuilding().getSetting(BuildingCowboy.MILKING).getValue() && result.equals(START_WORKING) && hasBucket) {
return COWBOY_MILK;
}
return result;
}
Aggregations