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 | |
| parent | 2a6ac0764fe9975f9b16d495ce773e4ae1f097e0 (diff) | |
| download | azalea-drasl-9b0bd29db4faa9d94df0cec472346b814e7efcb9.tar.xz | |
take BlockPos instead of &BlockPos in all function arguments
Diffstat (limited to 'azalea')
| -rw-r--r-- | azalea/examples/testbot/commands/debug.rs | 6 | ||||
| -rw-r--r-- | azalea/src/auto_tool.rs | 2 | ||||
| -rw-r--r-- | azalea/src/container.rs | 2 | ||||
| -rw-r--r-- | azalea/src/pathfinder/debug.rs | 4 | ||||
| -rw-r--r-- | azalea/src/pathfinder/mod.rs | 4 | ||||
| -rw-r--r-- | azalea/src/pathfinder/moves/mod.rs | 6 | ||||
| -rw-r--r-- | azalea/src/pathfinder/world.rs | 16 |
7 files changed, 20 insertions, 20 deletions
diff --git a/azalea/examples/testbot/commands/debug.rs b/azalea/examples/testbot/commands/debug.rs index b97ad71d..ea5dbe6f 100644 --- a/azalea/examples/testbot/commands/debug.rs +++ b/azalea/examples/testbot/commands/debug.rs @@ -110,7 +110,7 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) { }; let block_pos = hit_result.block_pos; - let block = source.bot.world().read().get_block_state(&block_pos); + let block = source.bot.world().read().get_block_state(block_pos); source.reply(&format!("I'm looking at {block:?} at {block_pos:?}")); @@ -125,7 +125,7 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) { let z = get_integer(ctx, "z").unwrap(); println!("getblock xyz {x} {y} {z}"); let block_pos = BlockPos::new(x, y, z); - let block = source.bot.world().read().get_block_state(&block_pos); + let block = source.bot.world().read().get_block_state(block_pos); source.reply(&format!("Block at {block_pos} is {block:?}")); 1 })), @@ -138,7 +138,7 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) { let z = get_integer(ctx, "z").unwrap(); println!("getfluid xyz {x} {y} {z}"); let block_pos = BlockPos::new(x, y, z); - let block = source.bot.world().read().get_fluid_state(&block_pos); + let block = source.bot.world().read().get_fluid_state(block_pos); source.reply(&format!("Fluid at {block_pos} is {block:?}")); 1 })), 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))); |
