diff --git a/crates/proto/src/connection.rs b/crates/proto/src/connection.rs index e55000ca..1616419f 100644 --- a/crates/proto/src/connection.rs +++ b/crates/proto/src/connection.rs @@ -130,9 +130,12 @@ impl Connection { }; let pos = decrypted_stream.position() as usize; - + compression - .decompress(&decrypted_stream.into_inner()[pos..], &mut decompressed_stream) + .decompress( + &decrypted_stream.into_inner()[pos..], + &mut decompressed_stream, + ) .map_err(|e| ConnectionError::CompressError(e))?; Cursor::new(decompressed_stream.as_slice()) diff --git a/crates/proto/src/gamepacket.rs b/crates/proto/src/gamepacket.rs index 8956815c..b9167864 100644 --- a/crates/proto/src/gamepacket.rs +++ b/crates/proto/src/gamepacket.rs @@ -849,7 +849,10 @@ impl GamePacket { VAR::::proto_deserialize(stream)?; // Read the game packet header and parse it into an u16 - let game_packet_header: u16 = VAR::::proto_deserialize(stream)?.into_inner().try_into().map_err(ProtoCodecError::FromIntError)?; + let game_packet_header: u16 = VAR::::proto_deserialize(stream)? + .into_inner() + .try_into() + .map_err(ProtoCodecError::FromIntError)?; // Get the first 10 bits as the packet id // Can never be more than a 16-bit integer due to being 10-bits big diff --git a/crates/proto/src/login/provider/default.rs b/crates/proto/src/login/provider/default.rs index ebefe74c..fb0d1d39 100644 --- a/crates/proto/src/login/provider/default.rs +++ b/crates/proto/src/login/provider/default.rs @@ -28,9 +28,7 @@ impl DefaultLoginProvider { impl LoginProviderServer for DefaultLoginProvider { fn compression(&self) -> Compression { - Compression::Snappy { - threshold: 1, - } + Compression::Snappy { threshold: 1 } } fn encryption_enabled(&self) -> bool { false diff --git a/crates/proto/src/packets/level_chunk.rs b/crates/proto/src/packets/level_chunk.rs index 5cb4489b..989d4b2c 100644 --- a/crates/proto/src/packets/level_chunk.rs +++ b/crates/proto/src/packets/level_chunk.rs @@ -40,7 +40,8 @@ impl ProtoCodec for LevelChunkPacket { unimplemented!() } - let len = self.serialized_chunk_data + let len = self + .serialized_chunk_data .len() .try_into() .map_err(ProtoCodecError::FromIntError)?; @@ -50,7 +51,7 @@ impl ProtoCodec for LevelChunkPacket { stream.extend_from_slice(&self.serialized_chunk_data); println!("finish"); - + Ok(()) } diff --git a/crates/proto/src/packets/text_message.rs b/crates/proto/src/packets/text_message.rs index 4a6d5a53..45a81fb5 100644 --- a/crates/proto/src/packets/text_message.rs +++ b/crates/proto/src/packets/text_message.rs @@ -139,12 +139,10 @@ impl ProtoCodec for TextMessagePacket { let message_type = match message_type { 0 => TextMessageData::Raw(String::proto_deserialize(stream)?), - 1 => { - TextMessageData::Chat { - player_name: String::proto_deserialize(stream)?, - message: String::proto_deserialize(stream)?, - } - } + 1 => TextMessageData::Chat { + player_name: String::proto_deserialize(stream)?, + message: String::proto_deserialize(stream)?, + }, 2 => { let message = String::proto_deserialize(stream)?; diff --git a/crates/proto/src/types/disconnect_reason.rs b/crates/proto/src/types/disconnect_reason.rs index 235532e5..ae1756ba 100644 --- a/crates/proto/src/types/disconnect_reason.rs +++ b/crates/proto/src/types/disconnect_reason.rs @@ -1,5 +1,5 @@ -use bedrockrs_proto_derive::ProtoCodec; use bedrockrs_core::int::VAR; +use bedrockrs_proto_derive::ProtoCodec; #[derive(ProtoCodec, Debug, Clone)] #[enum_repr(VAR::)] diff --git a/crates/proto/src/types/gamerule.rs b/crates/proto/src/types/gamerule.rs index 21bedeb0..def7296d 100644 --- a/crates/proto/src/types/gamerule.rs +++ b/crates/proto/src/types/gamerule.rs @@ -51,12 +51,8 @@ impl ProtoCodec for GameRuleValue { .into_inner() { 1 => GameRuleValue::ValBool(bool::proto_deserialize(stream)?), - 2 => GameRuleValue::ValVarU32( - VAR::::proto_deserialize(stream)?.into_inner(), - ), - 3 => GameRuleValue::ValF32( - LE::::proto_deserialize(stream)?.into_inner(), - ), + 2 => GameRuleValue::ValVarU32(VAR::::proto_deserialize(stream)?.into_inner()), + 3 => GameRuleValue::ValF32(LE::::proto_deserialize(stream)?.into_inner()), other => { return Err(ProtoCodecError::InvalidEnumID( format!("{other:?}"),