PathfinderClientExt

Trait PathfinderClientExt 

Source
pub trait PathfinderClientExt {
    // Required methods
    fn goto(&self, goal: impl Goal + 'static) -> impl Future<Output = ()>;
    fn goto_with_opts(
        &self,
        goal: impl Goal + 'static,
        opts: PathfinderOpts,
    ) -> impl Future<Output = ()>;
    fn start_goto(&self, goal: impl Goal + 'static);
    fn start_goto_with_opts(
        &self,
        goal: impl Goal + 'static,
        opts: PathfinderOpts,
    );
    fn stop_pathfinding(&self);
    fn force_stop_pathfinding(&self);
    fn wait_until_goto_target_reached(&self) -> impl Future<Output = ()>;
    fn is_goto_target_reached(&self) -> bool;
}

Required Methods§

Source

fn goto(&self, goal: impl Goal + 'static) -> impl Future<Output = ()>

Pathfind to the given goal and wait until either the target is reached or the pathfinding is canceled.

You can use Self::start_goto instead if you don’t want to wait.

bot.goto(BlockPosGoal(BlockPos::new(0, 70, 0))).await;
Source

fn goto_with_opts( &self, goal: impl Goal + 'static, opts: PathfinderOpts, ) -> impl Future<Output = ()>

Same as Self::goto, but allows you to set custom options for pathfinding, including disabling mining and setting custom moves.

bot.goto_with_opts(
    BlockPosGoal(BlockPos::new(0, 70, 0)),
    PathfinderOpts::new().allow_mining(false),
)
.await;
Source

fn start_goto(&self, goal: impl Goal + 'static)

Start pathfinding to a given goal.

bot.start_goto(BlockPosGoal(BlockPos::new(0, 70, 0)));
Source

fn start_goto_with_opts(&self, goal: impl Goal + 'static, opts: PathfinderOpts)

Same as Self::start_goto, but allows you to set custom options for pathfinding, including disabling mining and setting custom moves.

Also see Self::goto_with_opts.

Source

fn stop_pathfinding(&self)

Stop calculating a path, and stop moving once the current movement is finished.

This behavior exists to prevent the bot from taking damage if stop_pathfinding was called while executing a parkour jump, but if it’s undesirable then you may want to consider using Self::force_stop_pathfinding instead.

Source

fn force_stop_pathfinding(&self)

Stop calculating a path and stop executing the current movement immediately.

Source

fn wait_until_goto_target_reached(&self) -> impl Future<Output = ()>

Waits forever until the bot no longer has a pathfinder goal.

Source

fn is_goto_target_reached(&self) -> bool

Returns true if the pathfinder has no active goal and isn’t calculating a path.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§