diff options
| author | mat <git@matdoes.dev> | 2025-08-12 20:50:40 -1030 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-08-12 20:50:40 -1030 |
| commit | 55a7db13ef028f5b6c6e87a81406b3525cea196f (patch) | |
| tree | 6a995bc0b46c527e9fab0874508f81e07deb673e /azalea-client/src/plugins/movement.rs | |
| parent | ac66744586880afd657969ae078700a9749e293a (diff) | |
| download | azalea-drasl-55a7db13ef028f5b6c6e87a81406b3525cea196f.tar.xz | |
send correct packets on teleport
Diffstat (limited to 'azalea-client/src/plugins/movement.rs')
| -rw-r--r-- | azalea-client/src/plugins/movement.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/azalea-client/src/plugins/movement.rs b/azalea-client/src/plugins/movement.rs index 675796f6..c9b3b070 100644 --- a/azalea-client/src/plugins/movement.rs +++ b/azalea-client/src/plugins/movement.rs @@ -5,7 +5,7 @@ use azalea_core::{ tick::GameTick, }; use azalea_entity::{ - Attributes, InLoadedChunk, Jumping, LastSentPosition, LookDirection, Physics, Position, + Attributes, HasClientLoaded, Jumping, LastSentPosition, LookDirection, Physics, Position, metadata::Sprinting, }; use azalea_physics::{PhysicsSet, ai_step}; @@ -155,7 +155,7 @@ pub fn send_position( &mut Physics, &mut LastSentLookDirection, ), - With<InLoadedChunk>, + With<HasClientLoaded>, >, mut commands: Commands, ) { @@ -183,9 +183,9 @@ pub fn send_position( // boolean sendingPosition = Mth.lengthSquared(xDelta, yDelta, zDelta) > // Mth.square(2.0E-4D) || this.positionReminder >= 20; - let sending_position = ((x_delta.powi(2) + y_delta.powi(2) + z_delta.powi(2)) - > 2.0e-4f64.powi(2)) - || physics_state.position_remainder >= 20; + let is_delta_large_enough = + (x_delta.powi(2) + y_delta.powi(2) + z_delta.powi(2)) > 2.0e-4f64.powi(2); + let sending_position = is_delta_large_enough || physics_state.position_remainder >= 20; let sending_direction = y_rot_delta != 0.0 || x_rot_delta != 0.0; // if self.is_passenger() { @@ -348,7 +348,7 @@ pub(crate) fn tick_controls(mut query: Query<&mut PhysicsState>) { pub fn local_player_ai_step( mut query: Query< (&PhysicsState, &mut Physics, &mut Sprinting, &mut Attributes), - With<InLoadedChunk>, + With<HasClientLoaded>, >, ) { for (physics_state, mut physics, mut sprinting, mut attributes) in query.iter_mut() { |
