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: boolImplementations§
Source§impl<'a> WorldCollisionProvider<'a>
impl<'a> WorldCollisionProvider<'a>
Sourcepub const fn new(world: &'a Arc<World>) -> Self
pub const fn new(world: &'a Arc<World>) -> Self
Creates a new collision provider for the given world.
Sourcepub const fn for_entity(world: &'a Arc<World>, source: &'a dyn Entity) -> Self
pub const fn for_entity(world: &'a Arc<World>, source: &'a dyn Entity) -> Self
Creates a collision provider for movement authored by source.
Creates a collision provider matching vanilla PathNavigationRegion.
fn prefetched_block_collision_candidates( &self, bounds: BlockCollisionSearchBounds, ) -> Option<SmallVec<[(BlockPos, BlockStateId, CollisionCursorType); 64]>>
fn visit_block_collision_candidates<R>( &self, bounds: BlockCollisionSearchBounds, visit: impl FnMut(BlockPos, BlockStateId, CollisionCursorType) -> ControlFlow<R>, ) -> ControlFlow<R>
fn get_collision_shape( &self, block_state: BlockStateId, block_pos: BlockPos, context: BlockCollisionContext, ) -> CollisionShape
fn entity_collision_context( &self, entity_bottom: f64, descending: bool, placement: bool, ) -> BlockCollisionContext
Sourcepub fn has_entity_context_collision(
&self,
aabb: WorldAabb,
entity_bottom: f64,
descending: bool,
) -> bool
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.
Sourcepub fn find_supporting_block(
&self,
entity_position: DVec3,
aabb: &WorldAabb,
descending: bool,
) -> Option<BlockPos>
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.
Trait Implementations§
Source§impl CollisionWorld for WorldCollisionProvider<'_>
impl CollisionWorld for WorldCollisionProvider<'_>
Source§fn get_block_state(&self, pos: BlockPos) -> BlockStateId
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> ⓘ
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> ⓘ
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
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> ⓘ
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> ⓘ
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
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> ⓘ
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
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
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> ⓘ
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
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§
impl<'a> !RefUnwindSafe for WorldCollisionProvider<'a>
impl<'a> !UnwindSafe for WorldCollisionProvider<'a>
impl<'a> Freeze for WorldCollisionProvider<'a>
impl<'a> Send for WorldCollisionProvider<'a>
impl<'a> Sync for WorldCollisionProvider<'a>
impl<'a> Unpin for WorldCollisionProvider<'a>
impl<'a> UnsafeUnpin for WorldCollisionProvider<'a>
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreWraps this value in an
Arc<SyncMutex<>>