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/src/auto_tool.rs | 2 +- azalea/src/container.rs | 2 +- azalea/src/pathfinder/debug.rs | 4 ++-- azalea/src/pathfinder/mod.rs | 4 ++-- azalea/src/pathfinder/moves/mod.rs | 6 +++--- azalea/src/pathfinder/world.rs | 16 ++++++++-------- 6 files changed, 17 insertions(+), 17 deletions(-) (limited to 'azalea/src') diff --git a/azalea/src/auto_tool.rs b/azalea/src/auto_tool.rs index 63561772..1f339c85 100644 --- a/azalea/src/auto_tool.rs +++ b/azalea/src/auto_tool.rs @@ -31,7 +31,7 @@ impl AutoToolClientExt for Client { let block_state = self .world() .read() - .get_block_state(&block_pos) + .get_block_state(block_pos) .unwrap_or_default(); let best_tool_result = self.best_tool_in_hotbar_for_block(block_state); self.set_selected_hotbar_slot(best_tool_result.index as u8); diff --git a/azalea/src/container.rs b/azalea/src/container.rs index f452b1be..ee618df2 100644 --- a/azalea/src/container.rs +++ b/azalea/src/container.rs @@ -84,7 +84,7 @@ impl ContainerClientExt for Client { if !self .world() .read() - .get_block_state(&pos) + .get_block_state(pos) .unwrap_or_default() .is_collision_shape_empty() { diff --git a/azalea/src/pathfinder/debug.rs b/azalea/src/pathfinder/debug.rs index b00e4272..6b319531 100644 --- a/azalea/src/pathfinder/debug.rs +++ b/azalea/src/pathfinder/debug.rs @@ -67,9 +67,9 @@ pub fn debug_render_path_with_particles( let step_count = (start_vec3.distance_squared_to(&end_vec3).sqrt() * 4.0) as usize; - let target_block_state = chunks.get_block_state(&movement.target).unwrap_or_default(); + let target_block_state = chunks.get_block_state(movement.target).unwrap_or_default(); let above_target_block_state = chunks - .get_block_state(&movement.target.up(1)) + .get_block_state(movement.target.up(1)) .unwrap_or_default(); // this isn't foolproof, there might be another block that could be mined // depending on the move, but it's good enough for debugging diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs index c4586d29..c72573f5 100644 --- a/azalea/src/pathfinder/mod.rs +++ b/azalea/src/pathfinder/mod.rs @@ -1334,10 +1334,10 @@ mod tests { partial_chunks.set(&chunk_pos, Some(Chunk::default()), &mut chunks); } for block_pos in solid_blocks { - chunks.set_block_state(block_pos, azalea_registry::Block::Stone.into()); + chunks.set_block_state(*block_pos, azalea_registry::Block::Stone.into()); } for (block_pos, block_state) in extra_blocks { - chunks.set_block_state(block_pos, *block_state); + chunks.set_block_state(*block_pos, *block_state); } let player = SimulatedPlayerBundle::new(Vec3::new( diff --git a/azalea/src/pathfinder/moves/mod.rs b/azalea/src/pathfinder/moves/mod.rs index 44d31bfb..6d1c7c55 100644 --- a/azalea/src/pathfinder/moves/mod.rs +++ b/azalea/src/pathfinder/moves/mod.rs @@ -122,7 +122,7 @@ impl ExecuteCtx<'_, '_, '_, '_, '_, '_, '_> { let block_state = self .instance .read() - .get_block_state(&block) + .get_block_state(block) .unwrap_or_default(); if is_block_state_passable(block_state) { // block is already passable, no need to mine it @@ -138,7 +138,7 @@ impl ExecuteCtx<'_, '_, '_, '_, '_, '_, '_> { let block_state = self .instance .read() - .get_block_state(&block) + .get_block_state(block) .unwrap_or_default(); if is_block_state_passable(block_state) { // block is already passable, no need to mine it @@ -191,7 +191,7 @@ impl ExecuteCtx<'_, '_, '_, '_, '_, '_, '_> { pub fn get_block_state(&self, block: BlockPos) -> BlockState { self.instance .read() - .get_block_state(&block) + .get_block_state(block) .unwrap_or_default() } } diff --git a/azalea/src/pathfinder/world.rs b/azalea/src/pathfinder/world.rs index 3ec95136..e9337503 100644 --- a/azalea/src/pathfinder/world.rs +++ b/azalea/src/pathfinder/world.rs @@ -625,13 +625,13 @@ mod tests { .chunks .set(&ChunkPos { x: 0, z: 0 }, Some(Chunk::default()), &mut world); partial_world.chunks.set_block_state( - &BlockPos::new(0, 0, 0), + BlockPos::new(0, 0, 0), azalea_registry::Block::Stone.into(), &world, ); partial_world .chunks - .set_block_state(&BlockPos::new(0, 1, 0), BlockState::AIR, &world); + .set_block_state(BlockPos::new(0, 1, 0), BlockState::AIR, &world); let ctx = CachedWorld::new(Arc::new(RwLock::new(world.into())), BlockPos::default()); assert!(!ctx.is_block_pos_passable(BlockPos::new(0, 0, 0))); @@ -646,13 +646,13 @@ mod tests { .chunks .set(&ChunkPos { x: 0, z: 0 }, Some(Chunk::default()), &mut world); partial_world.chunks.set_block_state( - &BlockPos::new(0, 0, 0), + BlockPos::new(0, 0, 0), azalea_registry::Block::Stone.into(), &world, ); partial_world .chunks - .set_block_state(&BlockPos::new(0, 1, 0), BlockState::AIR, &world); + .set_block_state(BlockPos::new(0, 1, 0), BlockState::AIR, &world); let ctx = CachedWorld::new(Arc::new(RwLock::new(world.into())), BlockPos::default()); assert!(ctx.is_block_pos_solid(BlockPos::new(0, 0, 0))); @@ -667,19 +667,19 @@ mod tests { .chunks .set(&ChunkPos { x: 0, z: 0 }, Some(Chunk::default()), &mut world); partial_world.chunks.set_block_state( - &BlockPos::new(0, 0, 0), + BlockPos::new(0, 0, 0), azalea_registry::Block::Stone.into(), &world, ); partial_world .chunks - .set_block_state(&BlockPos::new(0, 1, 0), BlockState::AIR, &world); + .set_block_state(BlockPos::new(0, 1, 0), BlockState::AIR, &world); partial_world .chunks - .set_block_state(&BlockPos::new(0, 2, 0), BlockState::AIR, &world); + .set_block_state(BlockPos::new(0, 2, 0), BlockState::AIR, &world); partial_world .chunks - .set_block_state(&BlockPos::new(0, 3, 0), BlockState::AIR, &world); + .set_block_state(BlockPos::new(0, 3, 0), BlockState::AIR, &world); let ctx = CachedWorld::new(Arc::new(RwLock::new(world.into())), BlockPos::default()); assert!(ctx.is_standable_at_block_pos(BlockPos::new(0, 1, 0))); -- cgit v1.2.3