#[non_exhaustive]pub struct PathfinderOpts { /* private fields */ }
Expand description
Configuration options that the pathfinder will use when calculating and executing a path.
This can be passed into Client::goto_with_opts
or
Client::start_goto_with_opts
.
// example config to disallow mining blocks and to not do parkour
let opts = PathfinderOpts::new()
.allow_mining(false)
.successors_fn(moves::basic::basic_move);
Implementations§
Source§impl PathfinderOpts
impl PathfinderOpts
pub const fn new() -> Self
Sourcepub fn successors_fn(self, successors_fn: SuccessorsFn) -> Self
pub fn successors_fn(self, successors_fn: SuccessorsFn) -> Self
Set the function that’s used for checking what moves are possible.
Defaults to moves::default_move
.
Sourcepub fn allow_mining(self, allow_mining: bool) -> Self
pub fn allow_mining(self, allow_mining: bool) -> Self
Set whether the bot is allowed to break blocks while pathfinding.
Defaults to true
.
Sourcepub fn retry_on_no_path(self, retry_on_no_path: bool) -> Self
pub fn retry_on_no_path(self, retry_on_no_path: bool) -> Self
Whether we should recalculate the path when the pathfinder timed out and there’s no partial path to try.
Defaults to true
.
Sourcepub fn min_timeout(self, min_timeout: PathfinderTimeout) -> Self
pub fn min_timeout(self, min_timeout: PathfinderTimeout) -> Self
The minimum amount of time that should pass before the A* pathfinder
function can return a timeout if it finds a path that seems good enough.
It may take up to Self::max_timeout
if it can’t immediately find
a usable path.
Defaults to PathfinderTimeout::Time(Duration::from_secs(1))
.
Also see PathfinderTimeout::Nodes
Sourcepub fn max_timeout(self, max_timeout: PathfinderTimeout) -> Self
pub fn max_timeout(self, max_timeout: PathfinderTimeout) -> Self
The absolute maximum amount of time that the pathfinder function can take to find a path. If it takes this long, it means no usable path was found (so it might be impossible).
Defaults to PathfinderTimeout::Time(Duration::from_secs(5))
.
Trait Implementations§
Source§impl Clone for PathfinderOpts
impl Clone for PathfinderOpts
Source§fn clone(&self) -> PathfinderOpts
fn clone(&self) -> PathfinderOpts
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PathfinderOpts
impl Debug for PathfinderOpts
Auto Trait Implementations§
impl Freeze for PathfinderOpts
impl RefUnwindSafe for PathfinderOpts
impl Send for PathfinderOpts
impl Sync for PathfinderOpts
impl Unpin for PathfinderOpts
impl UnwindSafe for PathfinderOpts
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self
using default()
.