Search in sources :

Example 1 with AStarPathFinder

use of baritone.pathing.calc.AStarPathFinder in project Spark-Client by Spark-Client-Development.

the class PathingBehavior method createPathfinder.

private static AbstractNodeCostSearch createPathfinder(BlockPos start, Goal goal, IPath previous, CalculationContext context) {
    Goal transformed = goal;
    if (Baritone.settings().simplifyUnloadedYCoord.getValue() && goal instanceof IGoalRenderPos) {
        BlockPos pos = ((IGoalRenderPos) goal).getGoalPos();
        if (!context.bsi.worldContainsLoadedChunk(pos.getX(), pos.getZ())) {
            transformed = new GoalXZ(pos.getX(), pos.getZ());
        }
    }
    Favoring favoring = new Favoring(context.getBaritone().getPlayerContext(), previous, context);
    return new AStarPathFinder(start.getX(), start.getY(), start.getZ(), transformed, favoring, context);
}
Also used : Goal(baritone.api.pathing.goals.Goal) GoalXZ(baritone.api.pathing.goals.GoalXZ) Favoring(baritone.utils.pathing.Favoring) IGoalRenderPos(baritone.api.utils.interfaces.IGoalRenderPos) BlockPos(net.minecraft.util.math.BlockPos) BetterBlockPos(baritone.api.utils.BetterBlockPos) AStarPathFinder(baritone.pathing.calc.AStarPathFinder)

Example 2 with AStarPathFinder

use of baritone.pathing.calc.AStarPathFinder in project baritone by cabaletta.

the class PathingBehavior method createPathfinder.

private static AbstractNodeCostSearch createPathfinder(BlockPos start, Goal goal, IPath previous, CalculationContext context) {
    Goal transformed = goal;
    if (Baritone.settings().simplifyUnloadedYCoord.value && goal instanceof IGoalRenderPos) {
        BlockPos pos = ((IGoalRenderPos) goal).getGoalPos();
        if (!context.bsi.worldContainsLoadedChunk(pos.getX(), pos.getZ())) {
            transformed = new GoalXZ(pos.getX(), pos.getZ());
        }
    }
    Favoring favoring = new Favoring(context.getBaritone().getPlayerContext(), previous, context);
    return new AStarPathFinder(start.getX(), start.getY(), start.getZ(), transformed, favoring, context);
}
Also used : Goal(baritone.api.pathing.goals.Goal) GoalXZ(baritone.api.pathing.goals.GoalXZ) Favoring(baritone.utils.pathing.Favoring) IGoalRenderPos(baritone.api.utils.interfaces.IGoalRenderPos) BlockPos(net.minecraft.util.math.BlockPos) BetterBlockPos(baritone.api.utils.BetterBlockPos) AStarPathFinder(baritone.pathing.calc.AStarPathFinder)

Aggregations

Goal (baritone.api.pathing.goals.Goal)2 GoalXZ (baritone.api.pathing.goals.GoalXZ)2 BetterBlockPos (baritone.api.utils.BetterBlockPos)2 IGoalRenderPos (baritone.api.utils.interfaces.IGoalRenderPos)2 AStarPathFinder (baritone.pathing.calc.AStarPathFinder)2 Favoring (baritone.utils.pathing.Favoring)2 BlockPos (net.minecraft.util.math.BlockPos)2