use of com.minecolonies.api.colony.colonyEvents.IColonyRaidEvent in project minecolonies by Minecolonies.
the class RaiderWalkAI method walk.
/**
* Walk raider towards the colony or campfires
*
* @return
*/
private boolean walk() {
if (raider.getColony() != null) {
final IColonyEvent event = raider.getColony().getEventManager().getEventByID(raider.getEventID());
if (event == null) {
return false;
}
if (event.getStatus() == EventStatus.PREPARING && event instanceof HordeRaidEvent) {
walkToCampFire();
return false;
}
if (targetBlock == null || raider.blockPosition().distSqr(targetBlock) < 25 || raider.level.getGameTime() > walkTimer) {
targetBlock = raider.getColony().getRaiderManager().getRandomBuilding();
walkTimer = raider.level.getGameTime() + TICKS_SECOND * 240;
final BlockPos moveToPos = ShipBasedRaiderUtils.chooseWaypointFor(((IColonyRaidEvent) event).getWayPoints(), raider.blockPosition(), targetBlock);
raider.getNavigation().moveToXYZ(moveToPos.getX(), moveToPos.getY(), moveToPos.getZ(), 1.1);
} else if (raider.getNavigation().isDone() || raider.getNavigation().getDesiredPos() == null) {
final BlockPos moveToPos = ShipBasedRaiderUtils.chooseWaypointFor(((IColonyRaidEvent) event).getWayPoints(), raider.blockPosition(), targetBlock);
raider.getNavigation().moveToXYZ(moveToPos.getX(), moveToPos.getY(), moveToPos.getZ(), 1.1);
}
}
return false;
}
Aggregations