Search in sources :

Example 6 with Movement

use of baritone.pathing.movement.Movement in project Spark-Client by Spark-Client-Development.

the class PathExecutor method closestPathPos.

private Tuple<Double, BlockPos> closestPathPos(IPath path) {
    double best = -1;
    BlockPos bestPos = null;
    for (IMovement movement : path.movements()) {
        for (BlockPos pos : ((Movement) movement).getValidPositions()) {
            double dist = VecUtils.entityDistanceToCenter(ctx.player(), pos);
            if (dist < best || best == -1) {
                best = dist;
                bestPos = pos;
            }
        }
    }
    return new Tuple<>(best, bestPos);
}
Also used : IMovement(baritone.api.pathing.movement.IMovement) Movement(baritone.pathing.movement.Movement) IMovement(baritone.api.pathing.movement.IMovement) BlockPos(net.minecraft.util.math.BlockPos) Tuple(net.minecraft.util.Tuple)

Example 7 with Movement

use of baritone.pathing.movement.Movement in project Spark-Client by Spark-Client-Development.

the class Path method assembleMovements.

private boolean assembleMovements() {
    if (path.isEmpty() || !movements.isEmpty()) {
        throw new IllegalStateException();
    }
    for (int i = 0; i < path.size() - 1; i++) {
        double cost = nodes.get(i + 1).cost - nodes.get(i).cost;
        Movement move = runBackwards(path.get(i), path.get(i + 1), cost);
        if (move == null) {
            return true;
        } else {
            movements.add(move);
        }
    }
    return false;
}
Also used : IMovement(baritone.api.pathing.movement.IMovement) Movement(baritone.pathing.movement.Movement)

Example 8 with Movement

use of baritone.pathing.movement.Movement in project baritone by cabaletta.

the class Path method assembleMovements.

private boolean assembleMovements() {
    if (path.isEmpty() || !movements.isEmpty()) {
        throw new IllegalStateException();
    }
    for (int i = 0; i < path.size() - 1; i++) {
        double cost = nodes.get(i + 1).cost - nodes.get(i).cost;
        Movement move = runBackwards(path.get(i), path.get(i + 1), cost);
        if (move == null) {
            return true;
        } else {
            movements.add(move);
        }
    }
    return false;
}
Also used : IMovement(baritone.api.pathing.movement.IMovement) Movement(baritone.pathing.movement.Movement)

Aggregations

Movement (baritone.pathing.movement.Movement)8 IMovement (baritone.api.pathing.movement.IMovement)6 BlockPos (net.minecraft.util.math.BlockPos)4 MovementStatus (baritone.api.pathing.movement.MovementStatus)2 PathExecutor (baritone.pathing.path.PathExecutor)2 BlockStateInterface (baritone.utils.BlockStateInterface)2 Tuple (net.minecraft.util.Tuple)2