diff options
| author | mat <git@matdoes.dev> | 2025-06-11 16:55:33 +1100 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-06-11 16:55:33 +1100 |
| commit | 9b0bd29db4faa9d94df0cec472346b814e7efcb9 (patch) | |
| tree | 4f681b5143eb5ebe69a0b5b53125ea7509f8026a /azalea-physics/src/collision | |
| parent | 2a6ac0764fe9975f9b16d495ce773e4ae1f097e0 (diff) | |
| download | azalea-drasl-9b0bd29db4faa9d94df0cec472346b814e7efcb9.tar.xz | |
take BlockPos instead of &BlockPos in all function arguments
Diffstat (limited to 'azalea-physics/src/collision')
| -rw-r--r-- | azalea-physics/src/collision/mod.rs | 8 | ||||
| -rw-r--r-- | azalea-physics/src/collision/shape.rs | 6 |
2 files changed, 5 insertions, 9 deletions
diff --git a/azalea-physics/src/collision/mod.rs b/azalea-physics/src/collision/mod.rs index 2e46970d..ef994deb 100644 --- a/azalea-physics/src/collision/mod.rs +++ b/azalea-physics/src/collision/mod.rs @@ -322,13 +322,9 @@ fn collide_with_shapes( /// /// The instance and position are required so it can check if the block above is /// also the same fluid type. -pub fn fluid_shape( - fluid: &FluidState, - world: &ChunkStorage, - pos: &BlockPos, -) -> &'static VoxelShape { +pub fn fluid_shape(fluid: &FluidState, world: &ChunkStorage, pos: BlockPos) -> &'static VoxelShape { if fluid.amount == 9 { - let fluid_state_above = world.get_fluid_state(&pos.up(1)).unwrap_or_default(); + let fluid_state_above = world.get_fluid_state(pos.up(1)).unwrap_or_default(); if fluid_state_above.kind == fluid.kind { return &BLOCK_SHAPE; } diff --git a/azalea-physics/src/collision/shape.rs b/azalea-physics/src/collision/shape.rs index 59671622..4d430ee7 100644 --- a/azalea-physics/src/collision/shape.rs +++ b/azalea-physics/src/collision/shape.rs @@ -408,7 +408,7 @@ impl VoxelShape { } } - pub fn clip(&self, from: &Vec3, to: &Vec3, block_pos: &BlockPos) -> Option<BlockHitResult> { + pub fn clip(&self, from: &Vec3, to: &Vec3, block_pos: BlockPos) -> Option<BlockHitResult> { if self.is_empty() { return None; } @@ -424,7 +424,7 @@ impl VoxelShape { self.find_index(Axis::Z, right_after_start.z - block_pos.z as f64), ) { Some(BlockHitResult { - block_pos: *block_pos, + block_pos, direction: Direction::nearest(vector).opposite(), location: right_after_start, inside: true, @@ -755,7 +755,7 @@ mod tests { .clip( &Vec3::new(-0.3, 0.5, 0.), &Vec3::new(5.3, 0.5, 0.), - &BlockPos::new(0, 0, 0), + BlockPos::new(0, 0, 0), ) .unwrap(); |
