Difference between revisions of "Classic Protocol Extension"

From wiki.vg
Jump to navigation Jump to search
m
Line 11: Line 11:
 
:{| class="wikitable"
 
:{| class="wikitable"
 
|- class="row0"
 
|- class="row0"
| class="col0" | Packet ID
+
! class="col0" | Packet ID
| class="col1" | Field Name
+
! class="col1" | Field Name
| class="col2" | Field Type
+
! class="col2" | Field Type
| class="col3" | Example
+
! class="col3" | Example
| class="col4" | Notes
+
! class="col4" | Notes
 
|- class="row1"
 
|- class="row1"
 
| class="col0 centeralign" rowspan="2" | 0x10
 
| class="col0 centeralign" rowspan="2" | 0x10
Line 28: Line 28:
 
| class="col3" | Between 0 and 32767
 
| class="col3" | Between 0 and 32767
 
|- class="row3"
 
|- class="row3"
| class="col0" | Total Size:
+
! class="col0" | Total Size:
 
| class="col1 rightalign" colspan="4" | 67 bytes
 
| class="col1 rightalign" colspan="4" | 67 bytes
 
|}
 
|}
Line 35: Line 35:
 
:{| class="wikitable"
 
:{| class="wikitable"
 
|- class="row0"
 
|- class="row0"
| class="col0" | Packet ID
+
! class="col0" | Packet ID
| class="col1" | Field Name
+
! class="col1" | Field Name
| class="col2" | Field Type
+
! class="col2" | Field Type
| class="col3" | Example
+
! class="col3" | Example
| class="col4" | Notes
+
! class="col4" | Notes
 
|- class="row1"
 
|- class="row1"
 
| class="col0 centeralign" rowspan="2" | 0x11
 
| class="col0 centeralign" rowspan="2" | 0x11
Line 52: Line 52:
 
| class="col3" |
 
| class="col3" |
 
|- class="row3"
 
|- class="row3"
| class="col0" | Total Size:
+
! class="col0" | Total Size:
 
| class="col1 rightalign" colspan="4" | 69 bytes
 
| class="col1 rightalign" colspan="4" | 69 bytes
 
|}
 
|}
Line 63: Line 63:
 
:{| class="wikitable"
 
:{| class="wikitable"
 
|- class="row0"
 
|- class="row0"
| class="col0" | Packet ID
+
! class="col0" | Packet ID
| class="col1" | Field Name
+
! class="col1" | Field Name
| class="col2" | Field Type
+
! class="col2" | Field Type
| class="col3" | Example
+
! class="col3" | Example
| class="col4" | Notes
+
! class="col4" | Notes
 
|- class="row1"
 
|- class="row1"
 
| class="col0 centeralign" | 0x20
 
| class="col0 centeralign" | 0x20
Line 75: Line 75:
 
| class="col4" |
 
| class="col4" |
 
|- class="row2"
 
|- class="row2"
| class="col0" | Total Size:
+
! class="col0" | Total Size:
 
| class="col1 rightalign" colspan="4" | 3 bytes
 
| class="col1 rightalign" colspan="4" | 3 bytes
 
|}
 
|}

Revision as of 16:14, 11 October 2012

Negotiation

Extended clients should use magic number of 0x42 for the padding byte of the Player Identification packet. All standard/non-extended clients pad this packet with 0x00, so extended servers should be able to easily notice extended clients. All standard/non-extended servers will ignore the modified padding byte, preserving compatibility.

When the server sees that padding byte is 0x42, it should immediately reply with an ExtInfo packet, followed by zero or more ExtEntry packets, and await a response (ExtInfo packet) from the client.

After the client has sent its identification packet, it should await a response. If the server responds with an ExtInfo packet, it should parse it and any ExtEntry packets that follow. Client should then compare its locally-supported set of extensions with the list of extensions provided by the server, and find an intersection of these sets. These are the mutually-supported extensions.

At this time, client should send ExtInfo packet of its own, followed by the list of mutually-supported extensions. After receiving the last of ExtEntry packets, server should activate the mutually-supported extensions, and resume normal login procedure.

ExtInfo Packet

Packet ID Field Name Field Type Example Notes
0x10 AppName string MyServer Client or server software name
ExtensionCount short 1 Between 0 and 32767
Total Size: 67 bytes

ExtEntry Packet

Packet ID Field Name Field Type Example Notes
0x11 ExtName string MyExtension Name of a supported extension
Version int 1
Total Size: 69 bytes

Extensions

ClickDistance

Used to extend or restrict the distance at which client may click blocks, controlled by the server. Click range is given in player-space units (32 units per block). Upon receiving a SetClickDistance packet, client should immediately apply the change.

SetClickDistance packet

Server to Client
Packet ID Field Name Field Type Example Notes
0x20 Distance short 160
Total Size: 3 bytes