diff options
Diffstat (limited to 'azalea-protocol/src/packets/game/serverbound_player_abilities_packet.rs')
| -rwxr-xr-x | azalea-protocol/src/packets/game/serverbound_player_abilities_packet.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/azalea-protocol/src/packets/game/serverbound_player_abilities_packet.rs b/azalea-protocol/src/packets/game/serverbound_player_abilities_packet.rs index 7f979363..1f8727ac 100755 --- a/azalea-protocol/src/packets/game/serverbound_player_abilities_packet.rs +++ b/azalea-protocol/src/packets/game/serverbound_player_abilities_packet.rs @@ -1,29 +1,29 @@ use crate::packets::BufReadError; use azalea_buf::{McBufReadable, McBufWritable}; +use azalea_core::FixedBitSet; use azalea_protocol_macros::ServerboundGamePacket; use std::io::Cursor; #[derive(Clone, Debug, ServerboundGamePacket)] pub struct ServerboundPlayerAbilitiesPacket { - is_flying: bool, + pub is_flying: bool, } impl McBufReadable for ServerboundPlayerAbilitiesPacket { fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { - let byte = u8::read_from(buf)?; + let set = FixedBitSet::<2>::read_from(buf)?; Ok(Self { - is_flying: byte & 2 != 0, + is_flying: set.index(1), }) } } impl McBufWritable for ServerboundPlayerAbilitiesPacket { fn write_into(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { - let mut byte = 0; + let mut set = FixedBitSet::<2>::new(); if self.is_flying { - byte |= 2; + set.set(1); } - u8::write_into(&byte, buf)?; - Ok(()) + set.write_into(buf) } } |
