From 9b0bd29db4faa9d94df0cec472346b814e7efcb9 Mon Sep 17 00:00:00 2001 From: mat Date: Wed, 11 Jun 2025 16:55:33 +1100 Subject: take BlockPos instead of &BlockPos in all function arguments --- azalea-core/src/aabb.rs | 6 +++--- azalea-core/src/position.rs | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'azalea-core/src') diff --git a/azalea-core/src/aabb.rs b/azalea-core/src/aabb.rs index 42ae797d..03a754f0 100644 --- a/azalea-core/src/aabb.rs +++ b/azalea-core/src/aabb.rs @@ -211,7 +211,7 @@ impl AABB { boxes: &Vec, from: &Vec3, to: &Vec3, - pos: &BlockPos, + pos: BlockPos, ) -> Option { let mut t = 1.0; let mut dir = None; @@ -230,7 +230,7 @@ impl AABB { Some(BlockHitResult { location: from + &(delta * t), direction: dir, - block_pos: *pos, + block_pos: pos, inside: false, miss: false, world_border: false, @@ -500,7 +500,7 @@ mod tests { }], &Vec3::new(-1., -1., -1.), &Vec3::new(1., 1., 1.), - &BlockPos::new(0, 0, 0), + BlockPos::new(0, 0, 0), ), None ); diff --git a/azalea-core/src/position.rs b/azalea-core/src/position.rs index 7cb8b143..b1560577 100644 --- a/azalea-core/src/position.rs +++ b/azalea-core/src/position.rs @@ -589,6 +589,12 @@ impl From<&ChunkBiomePos> for ChunkSectionBiomePos { } } } +impl From for ChunkSectionBiomePos { + #[inline] + fn from(pos: ChunkBiomePos) -> Self { + Self::from(&pos) + } +} vec3_impl!(ChunkSectionBiomePos, u8); /// The coordinates of a biome inside a chunk. Biomes are 4x4 blocks. @@ -604,6 +610,12 @@ impl From<&BlockPos> for ChunkBiomePos { ChunkBiomePos::from(&ChunkBlockPos::from(pos)) } } +impl From for ChunkBiomePos { + #[inline] + fn from(pos: BlockPos) -> Self { + ChunkBiomePos::from(&ChunkBlockPos::from(pos)) + } +} impl From<&ChunkBlockPos> for ChunkBiomePos { #[inline] fn from(pos: &ChunkBlockPos) -> Self { -- cgit v1.2.3