Skip to main content

PathNavigation

Struct PathNavigation 

Source
pub struct PathNavigation {
Show 25 fields path: Option<Path>, path_finder: PathFinder, path_type_cache: PathTypeCache, direct_target: Option<DVec3>, target_pos: Option<BlockPos>, speed_modifier: f64, max_visited_nodes_multiplier: f32, required_path_length: f32, reach_range: i32, tick: i32, last_stuck_check: i32, last_stuck_check_pos: DVec3, timeout_cached_node: BlockPos, timeout_timer: i64, last_timeout_check: i64, timeout_limit: f64, has_delayed_recomputation: bool, time_last_recompute: i64, stuck: bool, done: bool, can_float: bool, can_open_doors: bool, can_walk_over_fences: bool, avoid_sun: bool, can_path_to_targets_below_surface: bool,
}

Fields§

§path: Option<Path>§path_finder: PathFinder§path_type_cache: PathTypeCache§direct_target: Option<DVec3>§target_pos: Option<BlockPos>§speed_modifier: f64§max_visited_nodes_multiplier: f32§required_path_length: f32§reach_range: i32§tick: i32§last_stuck_check: i32§last_stuck_check_pos: DVec3§timeout_cached_node: BlockPos§timeout_timer: i64§last_timeout_check: i64§timeout_limit: f64§has_delayed_recomputation: bool§time_last_recompute: i64§stuck: bool§done: bool§can_float: bool§can_open_doors: bool§can_walk_over_fences: bool§avoid_sun: bool§can_path_to_targets_below_surface: bool

Implementations§

Source§

impl PathNavigation

Source

pub fn new() -> Self

Source

pub const fn path(&self) -> Option<&Path>

Source

pub const fn target_pos(&self) -> Option<BlockPos>

Source

pub const fn speed_modifier(&self) -> f64

Source

pub const fn set_speed_modifier(&mut self, speed_modifier: f64)

Source

pub const fn reach_range(&self) -> i32

Source

pub const fn required_path_length(&self) -> f32

Source

pub const fn max_visited_nodes_multiplier(&self) -> f32

Source

pub fn set_required_path_length( &mut self, required_path_length: f32, follow_range: f64, )

Source

pub const fn reset_max_visited_nodes_multiplier(&mut self)

Source

pub const fn set_max_visited_nodes_multiplier( &mut self, max_visited_nodes_multiplier: f32, )

Source

pub const fn is_done(&self) -> bool

Source

pub const fn tick_count(&self) -> i32

Source

pub const fn is_stuck(&self) -> bool

Source

pub const fn has_delayed_recomputation(&self) -> bool

Source

pub const fn can_float(&self) -> bool

Source

pub const fn set_can_float(&mut self, can_float: bool)

Source

pub const fn can_open_doors(&self) -> bool

Source

pub const fn set_can_open_doors(&mut self, can_open_doors: bool)

Source

pub const fn can_walk_over_fences(&self) -> bool

Source

pub const fn set_can_walk_over_fences(&mut self, can_walk_over_fences: bool)

Source

pub const fn avoid_sun(&self) -> bool

Source

pub const fn set_avoid_sun(&mut self, avoid_sun: bool)

Source

pub const fn can_path_to_targets_below_surface(&self) -> bool

Source

pub const fn set_can_path_to_targets_below_surface( &mut self, can_path_to_targets_below_surface: bool, )

Source

pub const fn tick(&mut self)

Source

pub fn invalidate_path_type(&mut self, pos: BlockPos)

Source

pub fn stop(&mut self)

Source

pub const fn max_path_length(&self, follow_range: f64) -> f32

Source

pub fn update_pathfinder_max_visited_nodes(&mut self, follow_range: f64)

Source

pub fn create_path( &mut self, evaluator: &mut WalkNodeEvaluator, level: &dyn LevelReader, collision: &mut impl WalkNodeCollision, request: NavigationPathRequest<'_>, ) -> Option<Path>

Source

fn reusable_current_path(&self, targets: &[BlockPos]) -> Option<&Path>

Source

fn trim_path_for_avoid_sun( &self, level: &dyn LevelReader, mob_position: DVec3, path: &mut Path, )

Source

fn trim_path( &self, level: &dyn LevelReader, mob_position: DVec3, path: &mut Path, )

Source

fn trim_path_for_cauldrons(level: &dyn LevelReader, path: &mut Path)

Source

pub fn move_to( &mut self, level: &dyn LevelReader, path: Path, speed_modifier: f64, mob_position: DVec3, ) -> bool

Source

pub fn reuse_current_path_to_targets( &mut self, level: &dyn LevelReader, targets: &[BlockPos], speed_modifier: f64, mob_position: DVec3, ) -> bool

Source

pub fn set_direct_target(&mut self, target: DVec3, speed_modifier: f64)

Source

pub fn next_move_target( &mut self, context: NavigationTickContext, ) -> Option<(DVec3, f64)>

Source

pub fn next_move_target_without_path_update( &mut self, context: NavigationTickContext, on_ground: bool, ) -> Option<(DVec3, f64)>

Source

pub fn request_recompute_path( &mut self, game_time: i64, can_update_path: bool, ) -> Option<NavigationRecomputeRequest>

Source

pub fn take_delayed_recompute_request( &mut self, game_time: i64, can_update_path: bool, ) -> Option<NavigationRecomputeRequest>

Source

pub fn complete_recompute_path(&mut self, path: Option<Path>, game_time: i64)

Source

pub fn should_recompute_path(&self, pos: BlockPos, mob_position: DVec3) -> bool

Source

fn next_path_move_target( &mut self, context: NavigationTickContext, ) -> Option<(DVec3, f64)>

Source

fn do_stuck_detection( &mut self, mob_position: DVec3, mob_speed: f32, game_time: i64, )

Source

fn timeout_path(&mut self)

Source

const fn reset_stuck_timeout(&mut self)

Trait Implementations§

Source§

impl Clone for PathNavigation

Source§

fn clone(&self) -> PathNavigation

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 PathNavigation

Source§

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

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

impl Default for PathNavigation

Source§

fn default() -> Self

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

impl PartialEq for PathNavigation

Source§

fn eq(&self, other: &PathNavigation) -> 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 PathNavigation

Auto Trait Implementations§

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<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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoShared for T

Source§

fn into_shared(self) -> Arc<Mutex<RawMutex, Self>>

Wraps this value in an Arc<SyncMutex<>>
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more