diff options
| author | mat <git@matdoes.dev> | 2025-06-11 22:58:41 -0630 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-06-11 22:58:41 -0630 |
| commit | a2606569bb79867d07a075bcf7b05730e4264d72 (patch) | |
| tree | fb97fb52aa0c4d7575f6bd5e4e36c2f01c87f942 /azalea/src/bot.rs | |
| parent | 89ddd5e85f4f2fb98697df15528df6e07a3ddd07 (diff) | |
| download | azalea-drasl-a2606569bb79867d07a075bcf7b05730e4264d72.tar.xz | |
use owned instead of borrowed Vec3 more
Diffstat (limited to 'azalea/src/bot.rs')
| -rw-r--r-- | azalea/src/bot.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/azalea/src/bot.rs b/azalea/src/bot.rs index 9e8566bf..745f3fdb 100644 --- a/azalea/src/bot.rs +++ b/azalea/src/bot.rs @@ -229,7 +229,7 @@ fn look_at_listener( for event in events.read() { if let Ok((position, eye_height, mut look_direction)) = query.get_mut(event.entity) { let new_look_direction = - direction_looking_at(&position.up(eye_height.into()), &event.position); + direction_looking_at(position.up(eye_height.into()), event.position); trace!("look at {} (currently at {})", event.position, **position); *look_direction = new_look_direction; } @@ -238,7 +238,7 @@ fn look_at_listener( /// Return the look direction that would make a client at `current` be /// looking at `target`. -pub fn direction_looking_at(current: &Vec3, target: &Vec3) -> LookDirection { +pub fn direction_looking_at(current: Vec3, target: Vec3) -> LookDirection { // borrowed from mineflayer's Bot.lookAt because i didn't want to do math let delta = target - current; let y_rot = (PI - f64::atan2(-delta.x, -delta.z)) * (180.0 / PI); |
