diff options
| author | mat <git@matdoes.dev> | 2025-06-26 12:32:01 +0930 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-06-26 10:05:58 +0700 |
| commit | f9e4b65713bbacabcd54416a388a92b90f56ab47 (patch) | |
| tree | 25d392d60836351311e9f498d40277c226c1e32c /azalea-client/src | |
| parent | af1ef9310093aa3c8dfd5054eb6d0b8c7c0d0b31 (diff) | |
| download | azalea-drasl-f9e4b65713bbacabcd54416a388a92b90f56ab47.tar.xz | |
start adding packet_order test
Diffstat (limited to 'azalea-client/src')
| -rw-r--r-- | azalea-client/src/lib.rs | 1 | ||||
| -rw-r--r-- | azalea-client/src/plugins/attack.rs | 1 | ||||
| -rw-r--r-- | azalea-client/src/plugins/loading.rs | 9 | ||||
| -rw-r--r-- | azalea-client/src/plugins/movement.rs | 36 | ||||
| -rw-r--r-- | azalea-client/src/plugins/packet/game/mod.rs | 17 |
5 files changed, 32 insertions, 32 deletions
diff --git a/azalea-client/src/lib.rs b/azalea-client/src/lib.rs index df04a606..19e13253 100644 --- a/azalea-client/src/lib.rs +++ b/azalea-client/src/lib.rs @@ -16,6 +16,7 @@ pub mod ping; pub mod player; mod plugins; +#[cfg(feature = "log")] #[doc(hidden)] pub mod test_utils; diff --git a/azalea-client/src/plugins/attack.rs b/azalea-client/src/plugins/attack.rs index 86ed5de5..ec4337e5 100644 --- a/azalea-client/src/plugins/attack.rs +++ b/azalea-client/src/plugins/attack.rs @@ -90,6 +90,7 @@ impl Client { pub struct AttackQueued { pub target: Entity, } +#[allow(clippy::type_complexity)] pub fn handle_attack_queued( mut commands: Commands, mut query: Query<( diff --git a/azalea-client/src/plugins/loading.rs b/azalea-client/src/plugins/loading.rs index 217d6f75..b195868b 100644 --- a/azalea-client/src/plugins/loading.rs +++ b/azalea-client/src/plugins/loading.rs @@ -14,8 +14,8 @@ impl Plugin for PlayerLoadedPlugin { GameTick, player_loaded_packet .after(PhysicsSet) - .after(MiningSet) - .after(crate::movement::send_position), + .before(MiningSet) + .before(crate::movement::send_position), ); } } @@ -36,8 +36,11 @@ pub fn player_loaded_packet( Entity, ( With<LocalEntity>, - With<InLoadedChunk>, Without<HasClientLoaded>, + // the vanilla client waits for the chunk mesh to be "compiled" for the renderer (or + // some other conditions) before sending PlayerLoaded. see LevelLoadStatusManager.tick + // in the decompiled source + With<InLoadedChunk>, ), >, ) { diff --git a/azalea-client/src/plugins/movement.rs b/azalea-client/src/plugins/movement.rs index b4649f20..5d43261f 100644 --- a/azalea-client/src/plugins/movement.rs +++ b/azalea-client/src/plugins/movement.rs @@ -6,14 +6,17 @@ use azalea_entity::{ metadata::Sprinting, }; use azalea_physics::{PhysicsSet, ai_step}; -use azalea_protocol::packets::{ - Packet, - game::{ - ServerboundPlayerCommand, ServerboundPlayerInput, - s_move_player_pos::ServerboundMovePlayerPos, - s_move_player_pos_rot::ServerboundMovePlayerPosRot, - s_move_player_rot::ServerboundMovePlayerRot, - s_move_player_status_only::ServerboundMovePlayerStatusOnly, +use azalea_protocol::{ + common::movements::MoveFlags, + packets::{ + Packet, + game::{ + ServerboundPlayerCommand, ServerboundPlayerInput, + s_move_player_pos::ServerboundMovePlayerPos, + s_move_player_pos_rot::ServerboundMovePlayerPosRot, + s_move_player_rot::ServerboundMovePlayerRot, + s_move_player_status_only::ServerboundMovePlayerStatusOnly, + }, }, }; use azalea_world::{MinecraftEntityId, MoveEntityError}; @@ -186,12 +189,16 @@ pub fn send_position( // if self.is_passenger() { // TODO: posrot packet for being a passenger // } + let flags = MoveFlags { + on_ground: physics.on_ground(), + horizontal_collision: physics.horizontal_collision, + }; let packet = if sending_position && sending_direction { Some( ServerboundMovePlayerPosRot { pos: **position, look_direction: *direction, - on_ground: physics.on_ground(), + flags, } .into_variant(), ) @@ -199,7 +206,7 @@ pub fn send_position( Some( ServerboundMovePlayerPos { pos: **position, - on_ground: physics.on_ground(), + flags, } .into_variant(), ) @@ -207,17 +214,12 @@ pub fn send_position( Some( ServerboundMovePlayerRot { look_direction: *direction, - on_ground: physics.on_ground(), + flags, } .into_variant(), ) } else if physics.last_on_ground() != physics.on_ground() { - Some( - ServerboundMovePlayerStatusOnly { - on_ground: physics.on_ground(), - } - .into_variant(), - ) + Some(ServerboundMovePlayerStatusOnly { flags }.into_variant()) } else { None }; diff --git a/azalea-client/src/plugins/packet/game/mod.rs b/azalea-client/src/plugins/packet/game/mod.rs index 1ea4db10..d9940937 100644 --- a/azalea-client/src/plugins/packet/game/mod.rs +++ b/azalea-client/src/plugins/packet/game/mod.rs @@ -12,7 +12,10 @@ use azalea_entity::{ indexing::{EntityIdIndex, EntityUuidIndex}, metadata::{Health, apply_metadata}, }; -use azalea_protocol::packets::{ConnectionProtocol, game::*}; +use azalea_protocol::{ + common::movements::MoveFlags, + packets::{ConnectionProtocol, game::*}, +}; use azalea_world::{InstanceContainer, InstanceName, MinecraftEntityId, PartialInstance}; use bevy_ecs::{prelude::*, system::SystemState}; pub use events::*; @@ -319,15 +322,6 @@ impl GamePacketHandler<'_> { .entity(self.player) .insert(LoadedBy(HashSet::from_iter(vec![self.player]))); } - - // send the client information that we have set - debug!( - "Sending client information because login: {:?}", - client_information - ); - commands.trigger(SendPacketEvent::new(self.player, - azalea_protocol::packets::game::s_client_information::ServerboundClientInformation { client_information: client_information.clone() }, - )); }, ); } @@ -443,8 +437,7 @@ impl GamePacketHandler<'_> { ServerboundMovePlayerPosRot { pos: **position, look_direction: *direction, - // this is always false - on_ground: false, + flags: MoveFlags::default(), }, )); }); |
