Player Movement
This packet contains pressed movement keys and the player's look direction. It does not contain any position coordinates.
The client sends this packet to the server once every tick. If the client's framerate drops below the tickrate, at most one packet is sent per frame.
- ID: 0x1E (30)
- Size: 8 bytes
- LZ4 Compressed: Yes
- State: Playing
- Bound To: Client -> Server
Structure
Offset | Field Name | Field Type | Notes |
---|---|---|---|
0x00 | Tick | be u32 | The current tick. |
0x04 | Keys | u8 bitfield | Bitfield of which movement keys are pressed. See Keys bitfield. |
0x05 | Direction | u8 | The horizontal direction, relative to the player's yaw, the player is walking in or has last walked in. When the player stops walking, this value is not updated. Strafing right starts at0 and increases when changing the direction counter-clockwise (to the left). When using the keyboard, only distinct increments of 32 can be achieved, but the server supports any value between 0 and 255 . |
0x06 | Yaw | u8 | The player's horizontal look rotation. A yaw of 0 means the player is looking into the positive Y direction. Rotating counter-clockwise (to the left) increases the yaw. After reaching 255 , the yaw overflows back to 0 . |
0x07 | Pitch | u8 | The player's vertical look rotation. A pitch of 0 means the player is looking straight down (into the negative Z direction). Looking straight up yields a pitch of 128 . |
Keys bitfield
Contains information about which movement keys are pressed. All bits are always low while the player's character is seated or tumbling.
Bits | Field name | Notes |
---|---|---|
7 | Unused | Guaranteed to not be used. Always low. |
6 | ||
5 | ||
4 | Aim | High when the player is aiming with a tool. This value is set using Tool:setMovementSlowDown(boolean) and read using Character:isAiming() . |
3 | Sprint | High when the player is sprinting while moving horizontally. Low in all other cases, including when the player is holding the Sprint button while standing still. Always lags one tick behind when starting a sprint from standstill. The sprint bitflag also continues to stay high for one more tick after the player has stopped moving horizontally. |
2 | Horizontal | High when any of the Move Forward, Move Backward, Stafe Left or Strafe Right keys are pressed. |
1 | Crawl | High when the player is holding the Crawl (crouch) keybind. This is not connected to the actual crawl state of the player's character. If the character is crawling and unable to stand up, the value can be either high or low depending on wether the player is holding the Crawl key or not. |
0 | Jump | High when the player is holding the Jump button. The player's character does not have to be on the ground. |