diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2022-09-02 12:11:14 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-02 12:11:14 -0500 |
| commit | cfb190d00c70f1b09789e23f89a3c67840e0fd87 (patch) | |
| tree | 9bdc021943753d60bf437526c4c294275eae13ac /azalea-protocol/src/packets/game/clientbound_player_info_packet.rs | |
| parent | 32458d743f757da3193717fe5554f490703640c0 (diff) | |
| download | azalea-drasl-cfb190d00c70f1b09789e23f89a3c67840e0fd87.tar.xz | |
get rid of Readable & Writable (#21)
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 | 9 |
1 files changed, 5 insertions, 4 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 4c61d5c7..85e285b6 100644 --- a/azalea-protocol/src/packets/game/clientbound_player_info_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_player_info_packet.rs @@ -1,6 +1,6 @@ use crate::packets::login::serverbound_hello_packet::ProfilePublicKeyData; use azalea_buf::{BufReadError, McBuf}; -use azalea_buf::{McBufReadable, McBufWritable, Readable, Writable}; +use azalea_buf::{McBufReadable, McBufWritable}; use azalea_chat::component::Component; use packet_macros::ClientboundGamePacket; use std::io::{Read, Write}; @@ -66,7 +66,7 @@ pub struct RemovePlayer { impl McBufReadable for Action { fn read_from(buf: &mut impl Read) -> Result<Self, BufReadError> { - let id = buf.read_byte()?; + let id = u8::read_from(buf)?; Ok(match id { 0 => Action::AddPlayer(Vec::<AddPlayer>::read_from(buf)?), 1 => Action::UpdateGameMode(Vec::<UpdateGameMode>::read_from(buf)?), @@ -79,13 +79,14 @@ impl McBufReadable for Action { } impl McBufWritable for Action { fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - buf.write_byte(match self { + let id: u8 = match self { Action::AddPlayer(_) => 0, Action::UpdateGameMode(_) => 1, Action::UpdateLatency(_) => 2, Action::UpdateDisplayName(_) => 3, Action::RemovePlayer(_) => 4, - })?; + }; + id.write_into(buf)?; match self { Action::AddPlayer(players) => players.write_into(buf)?, Action::UpdateGameMode(players) => players.write_into(buf)?, |
