Difference between revisions of "Pre-release protocol"

From wiki.vg
Jump to navigation Jump to search
(→‎Serverbound: added Handshake packet with new protocol version number)
(Status 6 is used to swap/assign items to the extra hand.)
Line 59: Line 59:
 
=== Serverbound ===
 
=== Serverbound ===
  
No changes so far.
+
==== Player Digging ====
 +
 
 +
Sent when the player mines a block. A Notchian server only accepts digging packets with coordinates within a 6-unit radius of the player's position.
 +
 
 +
{| class="wikitable"
 +
! Packet ID
 +
! State
 +
! Bound To
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
|rowspan="3"| 0x07
 +
|rowspan="3"| Play
 +
|rowspan="3"| Server
 +
| Status
 +
| Byte
 +
| The action the player is taking against the block (see below)
 +
|-
 +
| Location
 +
| Position
 +
| Block position
 +
|-
 +
| Face
 +
| Byte
 +
| The face being hit (see below)
 +
|}
 +
 
 +
Status can (currently) be one of six values:
 +
 
 +
{| class="wikitable"
 +
! Meaning
 +
! Value
 +
|-
 +
| Started digging
 +
| <code>0</code>
 +
|-
 +
| Cancelled digging
 +
| <code>1</code>
 +
|-
 +
| Finished digging
 +
| <code>2</code>
 +
|-
 +
| Drop item stack
 +
| <code>3</code>
 +
|-
 +
| Drop item
 +
| <code>4</code>
 +
|-
 +
| Shoot arrow / finish eating
 +
| <code>5</code>
 +
|-
 +
| Swap item in Hand
 +
| <code>6</code>
 +
|}
 +
 
 +
Notchian clients send a 0 (started digging) when they start digging and a 2 (finished digging) once they think they are finished. If digging is aborted, the client simply send a 1 (cancel digging).
 +
 
 +
Status code 4 (drop item) is a special case. In-game, when you use the Drop Item command (keypress 'q'), a dig packet with a status of 4, and all other values set to 0, is sent from client to server. Status code 3 is similar, but drops the entire stack.
 +
 
 +
Status code 5 (shoot arrow / finish eating) is also a special case. The x, y and z fields are all set to 0 like above, with the exception of the face field, which is set to 255.
 +
 
 +
Status code 6 is another special case. Used to swap or assign an item to the second hand. The rest of the fields (x, y, z and face) are all set to 0.
 +
 
 +
The face can be one of six values, representing the face being hit:
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Value
 +
| 0
 +
| 1
 +
| 2
 +
| 3
 +
| 4
 +
| 5
 +
|-
 +
! Offset
 +
| -Y
 +
| +Y
 +
| -Z
 +
| +Z
 +
| -X
 +
| +X
 +
|}
  
 
== Status ==
 
== Status ==

Revision as of 20:05, 29 July 2015

This page documents the changes from the last stable Minecraft release (currently 1.8.8, protocol 47) to the current pre-release (currently 15w31a, protocol 49). Note that this page contains bleeding-edge information that may not be completely or correctly documented.

One who wishes to commandeer the merging of this into Protocol when an update is made must be sure to respect any changes that may have occurred to the respective packets there.

Protocol history

None so far.

New/modified data types

None so far.

Handshaking

Clientbound

No changes so far.

Serverbound

Handshake

This causes the server to switch into the target state.

Packet ID State Bound To Field Name Field Type Notes
0x00 Handshaking Server Protocol Version VarInt See protocol version numbers (currently 47 49)
Server Address String hostname or IP, e.g. localhost or 127.0.0.1
Server Port Unsigned Short default is 25565
Next State VarInt 1 for status, 2 for login

Play

Clientbound

No changes so far.

Serverbound

Player Digging

Sent when the player mines a block. A Notchian server only accepts digging packets with coordinates within a 6-unit radius of the player's position.

Packet ID State Bound To Field Name Field Type Notes
0x07 Play Server Status Byte The action the player is taking against the block (see below)
Location Position Block position
Face Byte The face being hit (see below)

Status can (currently) be one of six values:

Meaning Value
Started digging 0
Cancelled digging 1
Finished digging 2
Drop item stack 3
Drop item 4
Shoot arrow / finish eating 5
Swap item in Hand 6

Notchian clients send a 0 (started digging) when they start digging and a 2 (finished digging) once they think they are finished. If digging is aborted, the client simply send a 1 (cancel digging).

Status code 4 (drop item) is a special case. In-game, when you use the Drop Item command (keypress 'q'), a dig packet with a status of 4, and all other values set to 0, is sent from client to server. Status code 3 is similar, but drops the entire stack.

Status code 5 (shoot arrow / finish eating) is also a special case. The x, y and z fields are all set to 0 like above, with the exception of the face field, which is set to 255.

Status code 6 is another special case. Used to swap or assign an item to the second hand. The rest of the fields (x, y, z and face) are all set to 0.

The face can be one of six values, representing the face being hit:

Value 0 1 2 3 4 5
Offset -Y +Y -Z +Z -X +X

Status

Clientbound

No changes so far.

Serverbound

No changes so far.

Login

Clientbound

No changes so far.

Serverbound

No changes so far.