steel_protocol/packets/game/s_player_abilities.rs
1use steel_macros::{ReadFrom, ServerPacket};
2
3/// Sent by the client when the player starts or stops flying.
4/// The server uses this to track the player's flying state.
5#[derive(ServerPacket, ReadFrom, Clone, Debug)]
6pub struct SPlayerAbilities {
7 /// Bitfield containing only the FLYING flag (0x02 if flying, 0x00 if not)
8 pub flags: u8,
9}
10
11impl SPlayerAbilities {
12 const FLAG_FLYING: u8 = 0x02;
13
14 /// Returns whether the player is flying
15 #[must_use]
16 pub const fn is_flying(&self) -> bool {
17 (self.flags & Self::FLAG_FLYING) != 0
18 }
19}