From a2606569bb79867d07a075bcf7b05730e4264d72 Mon Sep 17 00:00:00 2001 From: mat Date: Wed, 11 Jun 2025 22:58:41 -0630 Subject: use owned instead of borrowed Vec3 more --- azalea-physics/src/collision/shape.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'azalea-physics/src/collision/shape.rs') diff --git a/azalea-physics/src/collision/shape.rs b/azalea-physics/src/collision/shape.rs index 4d430ee7..9caae590 100644 --- a/azalea-physics/src/collision/shape.rs +++ b/azalea-physics/src/collision/shape.rs @@ -98,9 +98,9 @@ impl Shapes { } pub fn collide( - axis: &Axis, + axis: Axis, entity_box: &AABB, - collision_boxes: &Vec, + collision_boxes: &[VoxelShape], mut movement: f64, ) -> f64 { for shape in collision_boxes { @@ -408,7 +408,7 @@ impl VoxelShape { } } - pub fn clip(&self, from: &Vec3, to: &Vec3, block_pos: BlockPos) -> Option { + pub fn clip(&self, from: Vec3, to: Vec3, block_pos: BlockPos) -> Option { if self.is_empty() { return None; } @@ -416,7 +416,7 @@ impl VoxelShape { if vector.length_squared() < EPSILON { return None; } - let right_after_start = from + &(vector * 0.001); + let right_after_start = from + (vector * 0.001); if self.shape().is_full_wide( self.find_index(Axis::X, right_after_start.x - block_pos.x as f64), @@ -436,8 +436,8 @@ impl VoxelShape { } } - pub fn collide(&self, axis: &Axis, entity_box: &AABB, movement: f64) -> f64 { - self.collide_x(AxisCycle::between(*axis, Axis::X), entity_box, movement) + pub fn collide(&self, axis: Axis, entity_box: &AABB, movement: f64) -> f64 { + self.collide_x(AxisCycle::between(axis, Axis::X), entity_box, movement) } pub fn collide_x(&self, axis_cycle: AxisCycle, entity_box: &AABB, mut movement: f64) -> f64 { if self.shape().is_empty() { @@ -753,8 +753,8 @@ mod tests { let block_shape = &*BLOCK_SHAPE; let block_hit_result = block_shape .clip( - &Vec3::new(-0.3, 0.5, 0.), - &Vec3::new(5.3, 0.5, 0.), + Vec3::new(-0.3, 0.5, 0.), + Vec3::new(5.3, 0.5, 0.), BlockPos::new(0, 0, 0), ) .unwrap(); -- cgit v1.2.3