diff options
| author | mat <github@matdoes.dev> | 2022-05-01 23:06:56 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-05-01 23:06:56 -0500 |
| commit | bec2da64d81883e3ea909452e71e17b9d22b2adc (patch) | |
| tree | d4f94abc09534768f2531a4c23f54dcc2dab2814 /azalea-protocol/src/packets/game/clientbound_player_info_packet.rs | |
| parent | 4d75415130a008f83c3bd594ca4cefd01f3d53dd (diff) | |
| parent | db2fcecdc38ea7a43b098c6282dd906b73981f97 (diff) | |
| download | azalea-drasl-bec2da64d81883e3ea909452e71e17b9d22b2adc.tar.xz | |
Merge branch 'main' into chunk-decoding
Diffstat (limited to 'azalea-protocol/src/packets/game/clientbound_player_info_packet.rs')
| -rw-r--r-- | azalea-protocol/src/packets/game/clientbound_player_info_packet.rs | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/azalea-protocol/src/packets/game/clientbound_player_info_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_info_packet.rs index 3d4c3ac7..97b68259 100644 --- a/azalea-protocol/src/packets/game/clientbound_player_info_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_player_info_packet.rs @@ -1,10 +1,7 @@ -// i don't know the actual name of this packet, i couldn't find it in the source code - use crate::mc_buf::{McBufReadable, McBufWritable, Readable, Writable}; -use async_trait::async_trait; use azalea_chat::component::Component; use packet_macros::{GamePacket, McBufReadable, McBufWritable}; -use tokio::io::AsyncRead; +use std::io::Read; use uuid::Uuid; #[derive(Clone, Debug, GamePacket)] @@ -64,19 +61,15 @@ pub struct RemovePlayer { uuid: Uuid, } -#[async_trait] impl McBufReadable for Action { - async fn read_into<R>(buf: &mut R) -> Result<Self, String> - where - R: AsyncRead + std::marker::Unpin + std::marker::Send, - { - let id = buf.read_byte().await?; + fn read_into(buf: &mut impl Read) -> Result<Self, String> { + let id = buf.read_byte()?; Ok(match id { - 0 => Action::AddPlayer(Vec::<AddPlayer>::read_into(buf).await?), - 1 => Action::UpdateGameMode(Vec::<UpdateGameMode>::read_into(buf).await?), - 2 => Action::UpdateLatency(Vec::<UpdateLatency>::read_into(buf).await?), - 3 => Action::UpdateDisplayName(Vec::<UpdateDisplayName>::read_into(buf).await?), - 4 => Action::RemovePlayer(Vec::<RemovePlayer>::read_into(buf).await?), + 0 => Action::AddPlayer(Vec::<AddPlayer>::read_into(buf)?), + 1 => Action::UpdateGameMode(Vec::<UpdateGameMode>::read_into(buf)?), + 2 => Action::UpdateLatency(Vec::<UpdateLatency>::read_into(buf)?), + 3 => Action::UpdateDisplayName(Vec::<UpdateDisplayName>::read_into(buf)?), + 4 => Action::RemovePlayer(Vec::<RemovePlayer>::read_into(buf)?), _ => panic!("Unknown player info action id: {}", id), }) } |
