diff options
Diffstat (limited to 'azalea-protocol/src')
| -rw-r--r-- | azalea-protocol/src/packets/login/clientbound_game_profile_packet.rs | 23 | ||||
| -rw-r--r-- | azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs | 4 |
2 files changed, 14 insertions, 13 deletions
diff --git a/azalea-protocol/src/packets/login/clientbound_game_profile_packet.rs b/azalea-protocol/src/packets/login/clientbound_game_profile_packet.rs index 88166c54..04ba5369 100644 --- a/azalea-protocol/src/packets/login/clientbound_game_profile_packet.rs +++ b/azalea-protocol/src/packets/login/clientbound_game_profile_packet.rs @@ -1,11 +1,11 @@ use super::LoginPacket; use crate::mc_buf::{Readable, Writable}; use azalea_auth::game_profile::GameProfile; -use azalea_core::{resource_location::ResourceLocation, serializable_uuid::SerializableUuid}; -use std::hash::Hash; +use azalea_core::serializable_uuid::SerializableUuid; use tokio::io::BufReader; +use uuid::Uuid; -#[derive(Hash, Clone, Debug)] +#[derive(Clone, Debug)] pub struct ClientboundGameProfilePacket { pub game_profile: GameProfile, } @@ -25,15 +25,16 @@ impl ClientboundGameProfilePacket { pub async fn read<T: tokio::io::AsyncRead + std::marker::Unpin + std::marker::Send>( buf: &mut BufReader<T>, ) -> Result<LoginPacket, String> { - let uuid = SerializableUuid::from_int_array( - buf.read_int().await?, - buf.read_int().await?, - buf.read_int().await?, - buf.read_int().await?, - ); - let name = buf.read_utf(16).await?; - ClientboundGameProfilePacket { + let uuid = Uuid::from_int_array([ + buf.read_int().await? as u32, + buf.read_int().await? as u32, + buf.read_int().await? as u32, + buf.read_int().await? as u32, + ]); + let name = buf.read_utf_with_len(16).await?; + Ok(ClientboundGameProfilePacket { game_profile: GameProfile::new(uuid, name), } + .get()) } } diff --git a/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs b/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs index 87fc6e03..53c6c9e1 100644 --- a/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs +++ b/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs @@ -1,7 +1,7 @@ use std::hash::Hash; use tokio::io::BufReader; -use crate::mc_buf::Readable; +use crate::mc_buf::{Readable, Writable}; use super::LoginPacket; @@ -25,7 +25,7 @@ impl ClientboundLoginCompressionPacket { let compression_threshold = buf.read_varint().await?; Ok(ClientboundLoginCompressionPacket { - compression_threshold + compression_threshold, } .get()) } |
