Search in sources :

Example 1 with MinecoloniesAdvancedPathNavigate

use of com.minecolonies.coremod.entity.pathfinding.MinecoloniesAdvancedPathNavigate in project minecolonies by Minecolonies.

the class DruidCombatAI method moveInAttackPosition.

@Override
protected PathResult moveInAttackPosition(final LivingEntity target) {
    if (BlockPosUtil.getDistanceSquared(target.blockPosition(), user.blockPosition()) <= 4.0) {
        final PathJobMoveAwayFromLocation job = new PathJobMoveAwayFromLocation(user.level, AbstractPathJob.prepareStart(target), target.blockPosition(), 12, (int) user.getAttribute(Attributes.FOLLOW_RANGE).getValue(), user);
        final PathResult pathResult = ((MinecoloniesAdvancedPathNavigate) user.getNavigation()).setPathJob(job, null, getCombatMovementSpeed(), true);
        job.setPathingOptions(combatPathingOptions);
        return pathResult;
    } else if (BlockPosUtil.getDistance2D(target.blockPosition(), user.blockPosition()) >= 20) {
        final PathJobMoveToLocation job = new PathJobMoveToLocation(user.level, AbstractPathJob.prepareStart(user), target.blockPosition(), 200, user);
        final PathResult pathResult = ((MinecoloniesAdvancedPathNavigate) user.getNavigation()).setPathJob(job, null, getCombatMovementSpeed(), true);
        job.setPathingOptions(combatPathingOptions);
        return pathResult;
    }
    final PathJobCanSee job = new PathJobCanSee(user, target, user.level, ((AbstractBuildingGuards) user.getCitizenData().getWorkBuilding()).getGuardPos(), 40);
    final PathResult pathResult = ((MinecoloniesAdvancedPathNavigate) user.getNavigation()).setPathJob(job, null, getCombatMovementSpeed(), true);
    job.setPathingOptions(combatPathingOptions);
    return pathResult;
}
Also used : MinecoloniesAdvancedPathNavigate(com.minecolonies.coremod.entity.pathfinding.MinecoloniesAdvancedPathNavigate) PathJobMoveAwayFromLocation(com.minecolonies.coremod.entity.pathfinding.pathjobs.PathJobMoveAwayFromLocation) PathResult(com.minecolonies.api.entity.pathfinding.PathResult) PathJobMoveToLocation(com.minecolonies.coremod.entity.pathfinding.pathjobs.PathJobMoveToLocation) PathJobCanSee(com.minecolonies.coremod.entity.pathfinding.pathjobs.PathJobCanSee)

Example 2 with MinecoloniesAdvancedPathNavigate

use of com.minecolonies.coremod.entity.pathfinding.MinecoloniesAdvancedPathNavigate in project minecolonies by ldtteam.

the class RangerCombatAI method moveInAttackPosition.

@Override
protected PathResult moveInAttackPosition(final LivingEntity target) {
    if (BlockPosUtil.getDistanceSquared(target.blockPosition(), user.blockPosition()) <= 4.0) {
        final PathJobMoveAwayFromLocation job = new PathJobMoveAwayFromLocation(user.level, AbstractPathJob.prepareStart(target), target.blockPosition(), (int) 7.0, (int) user.getAttribute(Attributes.FOLLOW_RANGE).getValue(), user);
        final PathResult pathResult = ((MinecoloniesAdvancedPathNavigate) user.getNavigation()).setPathJob(job, null, getCombatMovementSpeed(), true);
        job.setPathingOptions(combatPathingOptions);
        return pathResult;
    } else if (BlockPosUtil.getDistance2D(target.blockPosition(), user.blockPosition()) >= 20) {
        final PathJobMoveToLocation job = new PathJobMoveToLocation(user.level, AbstractPathJob.prepareStart(user), target.blockPosition(), 200, user);
        final PathResult pathResult = ((MinecoloniesAdvancedPathNavigate) user.getNavigation()).setPathJob(job, null, getCombatMovementSpeed(), true);
        job.setPathingOptions(combatPathingOptions);
        return pathResult;
    }
    final PathJobCanSee job = new PathJobCanSee(user, target, user.level, ((AbstractBuildingGuards) user.getCitizenData().getWorkBuilding()).getGuardPos(), 40);
    final PathResult pathResult = ((MinecoloniesAdvancedPathNavigate) user.getNavigation()).setPathJob(job, null, getCombatMovementSpeed(), true);
    job.setPathingOptions(combatPathingOptions);
    return pathResult;
}
Also used : MinecoloniesAdvancedPathNavigate(com.minecolonies.coremod.entity.pathfinding.MinecoloniesAdvancedPathNavigate) PathJobMoveAwayFromLocation(com.minecolonies.coremod.entity.pathfinding.pathjobs.PathJobMoveAwayFromLocation) PathResult(com.minecolonies.api.entity.pathfinding.PathResult) PathJobMoveToLocation(com.minecolonies.coremod.entity.pathfinding.pathjobs.PathJobMoveToLocation) PathJobCanSee(com.minecolonies.coremod.entity.pathfinding.pathjobs.PathJobCanSee)

Example 3 with MinecoloniesAdvancedPathNavigate

use of com.minecolonies.coremod.entity.pathfinding.MinecoloniesAdvancedPathNavigate in project minecolonies by ldtteam.

the class EntityMercenary method getNavigation.

@NotNull
@Override
public AbstractAdvancedPathNavigate getNavigation() {
    if (this.newNavigator == null) {
        this.newNavigator = new MinecoloniesAdvancedPathNavigate(this, level);
        this.navigation = newNavigator;
        this.newNavigator.setCanFloat(true);
        this.newNavigator.getNodeEvaluator().setCanOpenDoors(true);
    }
    return newNavigator;
}
Also used : MinecoloniesAdvancedPathNavigate(com.minecolonies.coremod.entity.pathfinding.MinecoloniesAdvancedPathNavigate) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with MinecoloniesAdvancedPathNavigate

use of com.minecolonies.coremod.entity.pathfinding.MinecoloniesAdvancedPathNavigate in project minecolonies by Minecolonies.

the class EntityMercenary method getNavigation.

@NotNull
@Override
public AbstractAdvancedPathNavigate getNavigation() {
    if (this.newNavigator == null) {
        this.newNavigator = new MinecoloniesAdvancedPathNavigate(this, level);
        this.navigation = newNavigator;
        this.newNavigator.setCanFloat(true);
        this.newNavigator.getNodeEvaluator().setCanOpenDoors(true);
    }
    return newNavigator;
}
Also used : MinecoloniesAdvancedPathNavigate(com.minecolonies.coremod.entity.pathfinding.MinecoloniesAdvancedPathNavigate) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with MinecoloniesAdvancedPathNavigate

use of com.minecolonies.coremod.entity.pathfinding.MinecoloniesAdvancedPathNavigate in project minecolonies by Minecolonies.

the class RangerCombatAI method moveInAttackPosition.

@Override
protected PathResult moveInAttackPosition(final LivingEntity target) {
    if (BlockPosUtil.getDistanceSquared(target.blockPosition(), user.blockPosition()) <= 4.0) {
        final PathJobMoveAwayFromLocation job = new PathJobMoveAwayFromLocation(user.level, AbstractPathJob.prepareStart(target), target.blockPosition(), (int) 7.0, (int) user.getAttribute(Attributes.FOLLOW_RANGE).getValue(), user);
        final PathResult pathResult = ((MinecoloniesAdvancedPathNavigate) user.getNavigation()).setPathJob(job, null, getCombatMovementSpeed(), true);
        job.setPathingOptions(combatPathingOptions);
        return pathResult;
    } else if (BlockPosUtil.getDistance2D(target.blockPosition(), user.blockPosition()) >= 20) {
        final PathJobMoveToLocation job = new PathJobMoveToLocation(user.level, AbstractPathJob.prepareStart(user), target.blockPosition(), 200, user);
        final PathResult pathResult = ((MinecoloniesAdvancedPathNavigate) user.getNavigation()).setPathJob(job, null, getCombatMovementSpeed(), true);
        job.setPathingOptions(combatPathingOptions);
        return pathResult;
    }
    final PathJobCanSee job = new PathJobCanSee(user, target, user.level, ((AbstractBuildingGuards) user.getCitizenData().getWorkBuilding()).getGuardPos(), 40);
    final PathResult pathResult = ((MinecoloniesAdvancedPathNavigate) user.getNavigation()).setPathJob(job, null, getCombatMovementSpeed(), true);
    job.setPathingOptions(combatPathingOptions);
    return pathResult;
}
Also used : MinecoloniesAdvancedPathNavigate(com.minecolonies.coremod.entity.pathfinding.MinecoloniesAdvancedPathNavigate) PathJobMoveAwayFromLocation(com.minecolonies.coremod.entity.pathfinding.pathjobs.PathJobMoveAwayFromLocation) PathResult(com.minecolonies.api.entity.pathfinding.PathResult) PathJobMoveToLocation(com.minecolonies.coremod.entity.pathfinding.pathjobs.PathJobMoveToLocation) PathJobCanSee(com.minecolonies.coremod.entity.pathfinding.pathjobs.PathJobCanSee)

Aggregations

MinecoloniesAdvancedPathNavigate (com.minecolonies.coremod.entity.pathfinding.MinecoloniesAdvancedPathNavigate)6 PathResult (com.minecolonies.api.entity.pathfinding.PathResult)4 PathJobCanSee (com.minecolonies.coremod.entity.pathfinding.pathjobs.PathJobCanSee)4 PathJobMoveAwayFromLocation (com.minecolonies.coremod.entity.pathfinding.pathjobs.PathJobMoveAwayFromLocation)4 PathJobMoveToLocation (com.minecolonies.coremod.entity.pathfinding.pathjobs.PathJobMoveToLocation)4 NotNull (org.jetbrains.annotations.NotNull)2