From 3f60bdadac1a02e1109148bbbe5a8a3545f13849 Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Thu, 17 Apr 2025 16:16:51 -0500 Subject: Move login state to the ECS (#213) * use packet handlers code for login custom_query * initial broken implementation for ecs-only login * fixes * run Update schedule 60 times per second and delete code related to run_schedule_sender * fix tests * fix online-mode * reply to query packets in a separate system and make it easier for plugins to disable individual replies * remove unused imports --- azalea-protocol/src/write.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'azalea-protocol/src/write.rs') diff --git a/azalea-protocol/src/write.rs b/azalea-protocol/src/write.rs index adefc340..dd863f9e 100644 --- a/azalea-protocol/src/write.rs +++ b/azalea-protocol/src/write.rs @@ -54,6 +54,15 @@ pub async fn write_raw_packet( where W: AsyncWrite + Unpin + Send, { + let network_packet = encode_to_network_packet(raw_packet, compression_threshold, cipher); + stream.write_all(&network_packet).await +} + +pub fn encode_to_network_packet( + raw_packet: &[u8], + compression_threshold: Option, + cipher: &mut Option, +) -> Vec { trace!("Writing raw packet: {raw_packet:?}"); let mut raw_packet = raw_packet.to_vec(); if let Some(threshold) = compression_threshold { @@ -64,7 +73,7 @@ where if let Some(cipher) = cipher { azalea_crypto::encrypt_packet(cipher, &mut raw_packet); } - stream.write_all(&raw_packet).await + raw_packet } pub fn compression_encoder( -- cgit v1.2.3