steel_protocol/packets/game/s_client_command.rs
1//! Serverbound client command packet - sent by the client to perform actions like respawning.
2
3use steel_macros::{ReadFrom, ServerPacket};
4
5/// The action the client wants to perform.
6#[derive(ReadFrom, Clone, Copy, Debug, PartialEq, Eq)]
7#[read(as = VarInt)]
8pub enum ClientCommandAction {
9 /// The client clicked "Respawn" on the death screen.
10 PerformRespawn = 0,
11 /// The client is requesting stats (F3+F4 or similar).
12 RequestStats = 1,
13 /// The client is requesting game rule values.
14 RequestGameRuleValues = 2,
15}
16
17/// Sent by the client when it wants to perform an action such as respawning after death.
18///
19/// When the player dies and sees the death screen, clicking "Respawn" sends this
20/// packet with `action = PerformRespawn`.
21#[derive(ReadFrom, ServerPacket, Clone, Debug)]
22pub struct SClientCommand {
23 /// The action the client wants to perform.
24 pub action: ClientCommandAction,
25}