From 9b3eb8fa823845521dcbfae242dda91e00324ed1 Mon Sep 17 00:00:00 2001 From: mat Date: Wed, 29 Jun 2022 02:45:21 -0500 Subject: [PATCH] no compile errors??? insane --- azalea-physics/src/dimension_collisions.rs | 2 +- azalea-physics/src/lib.rs | 2 +- azalea-physics/src/shape.rs | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/azalea-physics/src/dimension_collisions.rs b/azalea-physics/src/dimension_collisions.rs index 37cbfabd..2015ed8c 100644 --- a/azalea-physics/src/dimension_collisions.rs +++ b/azalea-physics/src/dimension_collisions.rs @@ -76,7 +76,7 @@ impl<'a> BlockCollisions<'a> { } impl<'a> Iterator for BlockCollisions<'a> { - type Item = ArrayVoxelShape; + type Item = Box; fn next(&mut self) -> Option { while let Some(item) = self.cursor.next() { diff --git a/azalea-physics/src/lib.rs b/azalea-physics/src/lib.rs index 015fc916..04a8ea5a 100644 --- a/azalea-physics/src/lib.rs +++ b/azalea-physics/src/lib.rs @@ -91,7 +91,7 @@ impl HasPhysics for Entity { let block_collisions = dimension.get_block_collisions(entity, entity_bounding_box.expand_towards(movement)); - collision_boxes.extend(block_collisions.map(Box::new).collect::>()); + collision_boxes.extend(block_collisions); Self::collide_with_shapes(movement, &entity_bounding_box, &collision_boxes) } diff --git a/azalea-physics/src/shape.rs b/azalea-physics/src/shape.rs index e6ff3b40..4616af9a 100644 --- a/azalea-physics/src/shape.rs +++ b/azalea-physics/src/shape.rs @@ -24,6 +24,8 @@ pub trait VoxelShape { fn get_y_coords(&self) -> Vec; fn get_z_coords(&self) -> Vec; + // TODO: optimization: should this be changed to return ArrayVoxelShape? + // i might change the implementation of empty_shape in the future so not 100% sure fn move_relative(&self, x: f64, y: f64, z: f64) -> Box { if self.shape().is_empty() { return empty_shape();