use of com.minecolonies.coremod.colony.VisitorData in project minecolonies by ldtteam.
the class EntityAIVisitor method decide.
/**
* Decides on the next activity
*
* @return next state
*/
private VisitorState decide() {
if (shouldFight()) {
return VisitorState.COMBAT;
}
final int random = citizen.getRandom().nextInt(5);
if (tavern != null && (random == 0 || random == 1 && !citizen.getCitizenColonyHandler().getColony().isDay()) && tavern.hasModule(TavernBuildingModule.class)) {
final BlockPos pos = tavern.getFirstModuleOccurance(TavernBuildingModule.class).getFreeSitPosition();
if (pos != null) {
((VisitorData) citizen.getCitizenData()).setSittingPosition(pos);
citizen.isWorkerAtSiteWithMove(pos, 1);
actionTimeoutCounter = citizen.getRandom().nextInt(2500) + 3000;
return VisitorState.SITTING;
}
} else if (random == 2) {
citizen.getNavigation().moveToRandomPos(10, 0.6D);
actionTimeoutCounter = citizen.getCitizenColonyHandler().getColony().isDay() ? citizen.getRandom().nextInt(1000) + 1000 : 300;
return VisitorState.WANDERING;
}
return VisitorState.IDLE;
}
Aggregations