Skip to main content

Config

Struct Config 

Source
#[non_exhaustive]
pub struct Config { pub sprint: bool, pub parkour: bool, pub max_fall: f64, pub max_water_fall: f64, pub swim: bool, pub climb: bool, pub dig: Option<DigCost>, pub place: Option<f64>, pub max_nodes: usize, pub heuristic_weight: f64, /* private fields */ }
Expand description

Planner options. Build with Config::default and the with_* methods.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§sprint: bool

Sprint on straight runs (costs assume sprinting; needs food > 6). Default on.

§parkour: bool

Jump over gaps: up to 3 blocks on the level, onto a block one higher or up to two lower, each only where the vanilla-exact physics lands the jump (some need sprinting). Default on.

§max_fall: f64

Highest drop onto a floor, in blocks (3 = no fall damage). Default 3.

§max_water_fall: f64

Highest drop into water at least 2 blocks deep. Default 16.

§swim: bool

Swim. Default on.

§climb: bool

Climb ladders and vines. Default on.

§dig: Option<DigCost>

Dig through blocks in the way (default off): tunnels, jump-ups into dug space, straight down (MoveKind::DigDown) and staircases down (a MoveKind::Descend with digs). The follower digs with the held item.

§place: Option<f64>

Place blocks, at this cost in ticks per block (default off): fill a one-deep hole, bridge over a gap (sneaking to the edge, placing against the side of the floor block), tower straight up (jump, place under the feet). The follower places the held item: the caller keeps blocks in hand.

§max_nodes: usize

Node budget per plan; when exhausted the best partial path is returned. Default 250 000: enough to search all the terrain a client loads at view distance 10 on a flat world (a maze whose way is far longer than the straight line needs that); at most some 30–40 MB while it runs and half a second of one desktop core.

§heuristic_weight: f64

Heuristic weight (1 = optimal; larger plans faster, slightly longer paths).

Implementations§

Source§

impl Config

Source

pub fn with_sprint(self, on: bool) -> Self

Sprinting on or off.

Source

pub fn with_parkour(self, on: bool) -> Self

Gap jumps on or off.

Source

pub fn with_max_fall(self, blocks: f64) -> Self

Highest drop onto a floor.

Source

pub fn with_swim(self, on: bool) -> Self

Swimming on or off.

Source

pub fn with_climb(self, on: bool) -> Self

Climbing on or off.

Source

pub fn with_dig(self, dig: Option<DigCost>) -> Self

Digging (None = off).

Source

pub fn with_place(self, cost: Option<f64>) -> Self

Placing blocks: filling holes, bridging, towering up (cost in ticks per block; None = off).

Source

pub fn with_max_nodes(self, n: usize) -> Self

Node budget.

Source

pub fn with_heuristic_weight(self, w: f64) -> Self

Heuristic weight (>= 1).

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Config

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Config

Auto Trait Implementations§

§

impl Forget for Config

§

impl Freeze for Config

§

impl Move for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnsafeUnpin for Config

§

impl UnwindSafe for Config

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V