Skip to main content

steel_protocol/packets/game/
s_player_action.rs

1use steel_macros::{ReadFrom, ServerPacket};
2use steel_registry::blocks::properties::Direction;
3use steel_utils::BlockPos;
4
5/// Action types for the player action packet.
6#[derive(ReadFrom, Clone, Copy, Debug, PartialEq, Eq)]
7#[read(as = VarInt)]
8pub enum PlayerAction {
9    StartDestroyBlock = 0,
10    ChangeDestroyDirection = 1,
11    AbortDestroyBlock = 2,
12    StopDestroyBlock = 3,
13    DropAllItems = 4,
14    DropItem = 5,
15    ReleaseUseItem = 6,
16    SwapItemWithOffhand = 7,
17    Stab = 8,
18}
19
20/// Serverbound packet sent when a player performs an action like mining a block.
21#[derive(ReadFrom, ServerPacket, Clone, Debug)]
22pub struct SPlayerAction {
23    pub action: PlayerAction,
24    pub pos: BlockPos,
25    pub direction: Direction,
26    #[read(as = VarInt)]
27    pub sequence: i32,
28}