aboutsummaryrefslogtreecommitdiff
path: root/azalea/src/bot.rs
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2025-08-14 20:40:13 -0500
committerGitHub <noreply@github.com>2025-08-14 20:40:13 -0500
commite74ed047dbaf3877db4a89a2d589e992abd0bb11 (patch)
tree0a728c8be167a1d59a5492ed9df666f41cf12e57 /azalea/src/bot.rs
parent6695132ddb31780786c67b8b9ff5df8ab3891438 (diff)
downloadazalea-drasl-e74ed047dbaf3877db4a89a2d589e992abd0bb11.tar.xz
Sneaking (#237)
* start implementing sneaking * fix horizontal_collision being inverted and cleanup * clippy * change dimensions and eye height based on pose * proper support for automatically crouching in certain cases * fix anticheat issues * add line to changelog and update a comment
Diffstat (limited to 'azalea/src/bot.rs')
-rw-r--r--azalea/src/bot.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/azalea/src/bot.rs b/azalea/src/bot.rs
index 8784cb31..b037ed14 100644
--- a/azalea/src/bot.rs
+++ b/azalea/src/bot.rs
@@ -9,8 +9,8 @@ use azalea_core::{
tick::GameTick,
};
use azalea_entity::{
- EyeHeight, Jumping, LocalEntity, LookDirection, Position, clamp_look_direction,
- metadata::Player,
+ Jumping, LocalEntity, LookDirection, Position, clamp_look_direction,
+ dimensions::EntityDimensions, metadata::Player, update_dimensions,
};
use azalea_physics::PhysicsSet;
use bevy_app::Update;
@@ -43,7 +43,9 @@ impl Plugin for BotPlugin {
Update,
(
insert_bot,
- look_at_listener.before(clamp_look_direction),
+ look_at_listener
+ .before(clamp_look_direction)
+ .after(update_dimensions),
jump_listener,
),
)
@@ -224,12 +226,12 @@ pub struct LookAtEvent {
}
fn look_at_listener(
mut events: EventReader<LookAtEvent>,
- mut query: Query<(&Position, &EyeHeight, &mut LookDirection)>,
+ mut query: Query<(&Position, &EntityDimensions, &mut LookDirection)>,
) {
for event in events.read() {
- if let Ok((position, eye_height, mut look_direction)) = query.get_mut(event.entity) {
+ if let Ok((position, dimensions, 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(dimensions.eye_height.into()), event.position);
trace!("look at {} (currently at {})", event.position, **position);
look_direction.update(new_look_direction);