From 4ee4687053b7442f518823b08099c156f4da4e83 Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 29 Jul 2022 02:59:40 -0500 Subject: Split clientbound and serverbound packets --- azalea-protocol/src/read.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'azalea-protocol/src/read.rs') diff --git a/azalea-protocol/src/read.rs b/azalea-protocol/src/read.rs index e19b5538..6a56ccfb 100755 --- a/azalea-protocol/src/read.rs +++ b/azalea-protocol/src/read.rs @@ -1,4 +1,4 @@ -use crate::{connect::PacketFlow, packets::ProtocolPacket}; +use crate::packets::ProtocolPacket; use azalea_buf::{read_varint_async, Readable}; use azalea_crypto::Aes128CfbDec; use flate2::read::ZlibDecoder; @@ -31,13 +31,10 @@ where } } -fn packet_decoder( - stream: &mut impl Read, - flow: &PacketFlow, -) -> Result { +fn packet_decoder(stream: &mut impl Read) -> Result { // Packet ID let packet_id = stream.read_varint()?; - P::read(packet_id.try_into().unwrap(), flow, stream) + P::read(packet_id.try_into().unwrap(), stream) } // this is always true in multiplayer, false in singleplayer @@ -121,7 +118,6 @@ where } pub async fn read_packet<'a, P: ProtocolPacket, R>( - flow: &PacketFlow, stream: &'a mut R, compression_threshold: Option, cipher: &mut Option, @@ -150,7 +146,7 @@ where } // println!("decoding packet ({}ms)", start_time.elapsed().as_millis()); - let packet = packet_decoder(&mut buf.as_slice(), flow)?; + let packet = packet_decoder(&mut buf.as_slice())?; // println!("decoded packet ({}ms)", start_time.elapsed().as_millis()); Ok(packet) -- cgit v1.2.3