diff options
| author | mat <git@matdoes.dev> | 2025-09-27 18:41:36 -1030 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-09-27 20:26:41 -0845 |
| commit | 74dcb7b37d953ec4d45dd6aac4c8e598c87def7d (patch) | |
| tree | 22e6ab1849ee01d40f3d484ea0c8db52aa6649b5 /azalea-physics/src/collision/world_collisions.rs | |
| parent | 63bef6486dc1f3c9ef4b4f0d71e139d7035b6432 (diff) | |
| download | azalea-drasl-74dcb7b37d953ec4d45dd6aac4c8e598c87def7d.tar.xz | |
allow picking other bots in hit results
Diffstat (limited to 'azalea-physics/src/collision/world_collisions.rs')
| -rw-r--r-- | azalea-physics/src/collision/world_collisions.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/azalea-physics/src/collision/world_collisions.rs b/azalea-physics/src/collision/world_collisions.rs index 11e8946f..cd883649 100644 --- a/azalea-physics/src/collision/world_collisions.rs +++ b/azalea-physics/src/collision/world_collisions.rs @@ -12,9 +12,9 @@ use bevy_ecs::entity::Entity; use parking_lot::RwLock; use super::{BLOCK_SHAPE, Shapes}; -use crate::collision::{AABB, BlockWithShape, VoxelShape}; +use crate::collision::{Aabb, BlockWithShape, VoxelShape}; -pub fn get_block_collisions(world: &Instance, aabb: &AABB) -> Vec<VoxelShape> { +pub fn get_block_collisions(world: &Instance, aabb: &Aabb) -> Vec<VoxelShape> { let mut state = BlockCollisionsState::new(world, aabb, EntityCollisionContext::of(None)); let mut block_collisions = Vec::new(); @@ -34,7 +34,7 @@ pub fn get_block_collisions(world: &Instance, aabb: &AABB) -> Vec<VoxelShape> { block_collisions } -pub fn get_block_and_liquid_collisions(world: &Instance, aabb: &AABB) -> Vec<VoxelShape> { +pub fn get_block_and_liquid_collisions(world: &Instance, aabb: &Aabb) -> Vec<VoxelShape> { let mut state = BlockCollisionsState::new( world, aabb, @@ -60,7 +60,7 @@ pub fn get_block_and_liquid_collisions(world: &Instance, aabb: &AABB) -> Vec<Vox pub struct BlockCollisionsState<'a> { pub world: &'a Instance, - pub aabb: &'a AABB, + pub aabb: &'a Aabb, pub entity_shape: VoxelShape, pub cursor: Cursor3d, @@ -104,7 +104,7 @@ impl<'a> BlockCollisionsState<'a> { // if it's a full block do a faster collision check if block_state.is_collision_shape_full() { - if !self.aabb.intersects_aabb(&AABB { + if !self.aabb.intersects_aabb(&Aabb { min: item.pos.to_vec3_floored(), max: (item.pos + 1).to_vec3_floored(), }) { @@ -126,7 +126,7 @@ impl<'a> BlockCollisionsState<'a> { block_collisions.push(block_shape); } - pub fn new(world: &'a Instance, aabb: &'a AABB, context: EntityCollisionContext) -> Self { + pub fn new(world: &'a Instance, aabb: &'a Aabb, context: EntityCollisionContext) -> Self { let origin = BlockPos { x: (aabb.min.x - EPSILON).floor() as i32 - 1, y: (aabb.min.y - EPSILON).floor() as i32 - 1, @@ -284,7 +284,7 @@ impl CanStandOnFluidPredicate { /// then maybe you should try having it do that instead. pub fn for_entities_in_chunks_colliding_with( world: &Instance, - aabb: &AABB, + aabb: &Aabb, mut consumer: impl FnMut(ChunkPos, &HashSet<Entity>), ) { let min_section = ChunkSectionPos::from(aabb.min - Vec3::new(2., 4., 2.)); |
