aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/client.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-client/src/client.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-client/src/client.rs')
-rw-r--r--azalea-client/src/client.rs21
1 files changed, 16 insertions, 5 deletions
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs
index 9481ba2d..be9c8e99 100644
--- a/azalea-client/src/client.rs
+++ b/azalea-client/src/client.rs
@@ -14,10 +14,12 @@ use azalea_core::{
tick::GameTick,
};
use azalea_entity::{
- EntityUpdateSet, EyeHeight, Position,
+ EntityUpdateSet, PlayerAbilities, Position,
+ dimensions::EntityDimensions,
indexing::{EntityIdIndex, EntityUuidIndex},
metadata::Health,
};
+use azalea_physics::local_player::PhysicsState;
use azalea_protocol::{
ServerAddress,
common::client_information::ClientInformation,
@@ -55,9 +57,9 @@ use crate::{
interact::BlockStatePredictionHandler,
inventory::Inventory,
join::{ConnectOpts, StartJoinServerEvent},
- local_player::{Hunger, InstanceHolder, PermissionLevel, PlayerAbilities, TabList},
+ local_player::{Hunger, InstanceHolder, PermissionLevel, TabList},
mining::{self},
- movement::{LastSentLookDirection, PhysicsState},
+ movement::LastSentLookDirection,
packet::game::SendPacketEvent,
player::{GameProfileComponent, PlayerInfo, retroactively_add_game_profile_component},
};
@@ -427,12 +429,21 @@ impl Client {
)
}
+ /// Get the bounding box dimensions for our client, which contains our
+ /// width, height, and eye height.
+ ///
+ /// This is a shortcut for
+ /// `self.component::<EntityDimensions>()`.
+ pub fn dimensions(&self) -> EntityDimensions {
+ self.component::<EntityDimensions>()
+ }
+
/// Get the position of this client's eyes.
///
/// This is a shortcut for
- /// `bot.position().up(bot.component::<EyeHeight>())`.
+ /// `bot.position().up(bot.dimensions().eye_height)`.
pub fn eye_position(&self) -> Vec3 {
- self.position().up((*self.component::<EyeHeight>()) as f64)
+ self.position().up(self.dimensions().eye_height as f64)
}
/// Get the health of this client.