Skip to main content

WorldCollisionProvider

Struct WorldCollisionProvider 

Source
pub struct WorldCollisionProvider<'a> {
    world: &'a Arc<World>,
    source: Option<&'a dyn Entity>,
    include_entity_collisions: bool,
}
Expand description

Implements CollisionWorld for the Steel World struct.

Fields§

§world: &'a Arc<World>§source: Option<&'a dyn Entity>§include_entity_collisions: bool

Implementations§

Source§

impl<'a> WorldCollisionProvider<'a>

Source

pub const fn new(world: &'a Arc<World>) -> Self

Creates a new collision provider for the given world.

Source

pub const fn for_entity(world: &'a Arc<World>, source: &'a dyn Entity) -> Self

Creates a collision provider for movement authored by source.

Source

pub const fn for_path_navigation( world: &'a Arc<World>, source: &'a dyn Entity, ) -> Self

Creates a collision provider matching vanilla PathNavigationRegion.

Source

fn prefetched_block_collision_candidates( &self, bounds: BlockCollisionSearchBounds, ) -> Option<SmallVec<[(BlockPos, BlockStateId, CollisionCursorType); 64]>>

Source

fn visit_block_collision_candidates<R>( &self, bounds: BlockCollisionSearchBounds, visit: impl FnMut(BlockPos, BlockStateId, CollisionCursorType) -> ControlFlow<R>, ) -> ControlFlow<R>

Source

fn get_collision_shape( &self, block_state: BlockStateId, block_pos: BlockPos, context: BlockCollisionContext, ) -> CollisionShape

Source

fn entity_collision_context( &self, entity_bottom: f64, descending: bool, placement: bool, ) -> BlockCollisionContext

Source

pub fn has_entity_context_collision( &self, aabb: WorldAabb, entity_bottom: f64, descending: bool, ) -> bool

Returns whether an entity-context collision query intersects anything.

Mirrors vanilla Level.noCollision(entity, box) callers by using the source entity’s normal collision context rather than a source-less check.

Source

pub fn find_supporting_block( &self, entity_position: DVec3, aabb: &WorldAabb, descending: bool, ) -> Option<BlockPos>

Finds the block supporting an entity within aabb.

Mirrors vanilla CollisionGetter.findSupportingBlock: among colliding blocks, choose the closest block center to the entity position, then use vanilla BlockPos ordering as a tie-breaker.

Source

pub fn find_free_position( &self, allowed_centers: &[WorldAabb], preferred_center: DVec3, size_x: f64, size_y: f64, size_z: f64, ) -> Option<DVec3>

Returns vanilla CollisionGetter.findFreePosition for AABB-backed center shapes.

Trait Implementations§

Source§

impl CollisionWorld for WorldCollisionProvider<'_>

Source§

fn get_block_state(&self, pos: BlockPos) -> BlockStateId

Gets the block state at the given position.
Source§

fn get_block_collisions(&self, aabb: &WorldAabb) -> Vec<WorldAabb>

Queries all block collision shapes that intersect with the given AABB. Read more
Source§

fn get_block_collisions_with_context( &self, aabb: &WorldAabb, context: BlockCollisionContext, ) -> Vec<WorldAabb>

Queries all block collision shapes with a vanilla collision context.
Source§

fn has_block_collision_with_context( &self, aabb: &WorldAabb, context: BlockCollisionContext, ) -> bool

Returns whether any block collision shape intersects with the given AABB and context.
Source§

fn get_pre_move_collisions( &self, aabb: &WorldAabb, old_bottom_center: DVec3, descending: bool, ) -> Vec<WorldAabb>

Gets collision shapes for vanilla pre-move checks. Read more
Source§

fn get_entity_collisions(&self, aabb: &WorldAabb) -> Vec<WorldAabb>

Queries all entity collision shapes intersecting the given AABB. Read more
Source§

fn has_entity_collision(&self, aabb: &WorldAabb) -> bool

Returns whether any entity collision shape intersects with the given AABB.
Source§

fn get_world_border_collisions(&self, aabb: &WorldAabb) -> Vec<WorldAabb>

Queries world-border collision shapes intersecting the given AABB.
Source§

fn has_world_border_collision(&self, aabb: &WorldAabb) -> bool

Returns whether any world-border collision shape intersects with the given AABB.
Source§

fn has_block_collision(&self, aabb: &WorldAabb) -> bool

Returns whether any block collision shape intersects with the given AABB.
Source§

fn get_collisions_with_context( &self, aabb: &WorldAabb, context: BlockCollisionContext, ) -> Vec<WorldAabb>

Queries entity, world-border, then block collisions with a vanilla context.
Source§

fn has_collision_with_context( &self, aabb: &WorldAabb, context: BlockCollisionContext, ) -> bool

Returns whether any entity, world-border, or block collision shape intersects the AABB.

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