Difference between revisions of "Pre-release protocol"

From wiki.vg
Jump to navigation Jump to search
(→‎Map Chunk (0x33): added a log of map chunks received.)
(→‎Changed packets: 0x09 respawn change: dimension is now an int.)
Line 89: Line 89:
  
 
=== [[Protocol#Login_Request_.280x01.29|Login Request (0x01)]] ===
 
=== [[Protocol#Login_Request_.280x01.29|Login Request (0x01)]] ===
 +
 
World height was changed to an integer.
 
World height was changed to an integer.
 +
 
{| class="wikitable"
 
{| class="wikitable"
 
|- class="row0"
 
|- class="row0"
Line 147: Line 149:
 
| class="col1 rightalign" colspan="4" | 28 bytes + length of strings
 
| class="col1 rightalign" colspan="4" | 28 bytes + length of strings
 
|}
 
|}
 
TODO: Figure out other packets
 
  
 
=== [[Protocol#Handshake_.280x02.29|Handshake (0x02)]] ===
 
=== [[Protocol#Handshake_.280x02.29|Handshake (0x02)]] ===
  
 
==== Client to Server ====
 
==== Client to Server ====
 +
 
The hostname and port were added to this packet, most likely to allow [http://en.wikipedia.org/wiki/Virtual_hosting virtual hosting] .([https://github.com/sadimusi/MVHP/blob/master/mvhp.py sample implementation])
 
The hostname and port were added to this packet, most likely to allow [http://en.wikipedia.org/wiki/Virtual_hosting virtual hosting] .([https://github.com/sadimusi/MVHP/blob/master/mvhp.py sample implementation])
 +
 
{| class="wikitable"
 
{| class="wikitable"
 
|- class="row0"
 
|- class="row0"
Line 170: Line 172:
 
! class="col0" | Total Size:
 
! class="col0" | Total Size:
 
| class="col1 rightalign" colspan="4" | 3 bytes + length of strings
 
| class="col1 rightalign" colspan="4" | 3 bytes + length of strings
 +
|}
 +
 +
=== [[Protocol#Respawn_.280x09.29|Respawn (0x09]] ===
 +
 +
Dimension is now an int, slightly bizarrely. I wonder if they intended to make world_height an int, in line with 0x01 login?
 +
 +
{| class="wikitable"
 +
|- class="row0"
 +
! class="col0" | Packet ID
 +
! class="col1" | Field Name
 +
! class="col2" | Field Type
 +
! class="col3" | Example
 +
! class="col4" | Notes
 +
|- class="row1"
 +
| class="col0 centeralign" rowspan="6" | 0x09
 +
| class="col1 centeralign" | Dimension
 +
| class="col2 centeralign" | int
 +
| class="col3 centeralign" | <code>1</code>
 +
| class="col4" | <code>-1</code>: The Nether, <code>0</code>: The Overworld, <code>1</code>: The End
 +
|- class="row2"
 +
| class="col1 centeralign" | Difficulty
 +
| class="col2 centeralign" | byte
 +
| class="col3 centeralign" | <code>1</code>
 +
| class="col4" | <code>0</code> thru <code>3</code> for Peaceful, Easy, Normal, Hard. <code>1</code> is always sent c->s
 +
|- class="row2"
 +
| class="col1 centeralign" | Creative mode
 +
| class="col2 centeralign" | byte
 +
| class="col3 centeralign" | <code>1</code>
 +
| class="col4" | <code>0</code> for survival, <code>1</code> for creative.
 +
|- class="row1"
 +
| class="col1 centeralign" | World height
 +
| class="col2 centeralign" | short
 +
| class="col3 centeralign" | <code>128</code>
 +
| class="col4" | Defaults to <code>128</code>
 +
|- class="row1"
 +
| class="col1 centeralign" | Map Seed
 +
| class="col2 centeralign" | long
 +
| class="col3 centeralign" | <code>-3815848935435401459</code>
 +
| class="col4" | The server's map seed.
 +
|- class="row1"
 +
| class="col1 centeralign" | Level Type
 +
| class="col2 centeralign" | string
 +
| class="col3 centeralign" | DEFAULT
 +
| class="col4" | See 0x01 login
 +
|- class="row2"
 +
! class="col0" | Total Size:
 +
| class="col1 rightalign" colspan="4" | 16 bytes + length of string
 
|}
 
|}
  

Revision as of 13:52, 15 February 2012

This page documents the changes from the last stable Minecraft release (currently 1.1) to the current pre-release

New packets

Entity Head Look (0x23)

Changes the direction an entity's head is facing.

Packet ID Field Name Field Type Example Notes
0x23 Entity ID int
Head Yaw byte Head yaw in steps of 2π/256
Total Size: 6 bytes

Update Tile Entity (0x84)

Essentially a block update on a tile entity.

Packet ID Field Name Field Type Example Notes
0x84 X int
Y short
Z int
Action byte The type of update to perform
Custom 1 int Varies
Custom 2 int Varies
Custom 3 int Varies
Total Size: 24 bytes

Actions

  • 1: Set mob displayed inside a mob spawner. Custom 1 contains the mob type

Changed packets

Login Request (0x01)

World height was changed to an integer.

Packet ID Field Name Field Type Example Notes
0x01 Entity ID int 1298 The Players Entity ID
Not used string (empty string) Not used
Map Seed long 971768181197178410 The server's map seed. Must be sent in respawn packets by the client.
Level Type string DEFAULT DEFAULT or SUPERFLAT; level-type in server.properties
Server mode int 0 0 for survival, 1 for creative
Dimension byte 0 -1: The Nether, 0: The Overworld, 1: The End
Difficulty byte 1 0 thru 3 for Peaceful, Easy, Normal, Hard
World height int 256 Defaults to 256
Max players unsigned byte 8 Used by the client to draw the player list
Total Size: 28 bytes + length of strings

Handshake (0x02)

Client to Server

The hostname and port were added to this packet, most likely to allow virtual hosting .(sample implementation)

Packet ID Field Name Field Type Example Notes
0x02 UsernameAndHost string TkTech;localhost:25565 The username of the player attempting to connect, and the host he is connecting to, seperated by a semicolon.
Total Size: 3 bytes + length of strings

Respawn (0x09

Dimension is now an int, slightly bizarrely. I wonder if they intended to make world_height an int, in line with 0x01 login?

Packet ID Field Name Field Type Example Notes
0x09 Dimension int 1 -1: The Nether, 0: The Overworld, 1: The End
Difficulty byte 1 0 thru 3 for Peaceful, Easy, Normal, Hard. 1 is always sent c->s
Creative mode byte 1 0 for survival, 1 for creative.
World height short 128 Defaults to 128
Map Seed long -3815848935435401459 The server's map seed.
Level Type string DEFAULT See 0x01 login
Total Size: 16 bytes + length of string

Mob Spawn (0x18)

New byte field: head yaw

This needs confirmation!

Packet ID Field Name Field Type Example Notes
0x18 EID int 446 Entity ID
Type byte 91 The type of mob. See Entities#Mobs
X int 13366 The Absolute Integer X Position of the object
Y int 2176 The Absolute Integer Y Position of the object
Z int 1680 The Absolute Integer Z Position of the object
Yaw byte -27 The yaw in steps of 2π/256
Pitch byte 0 The pitch in steps of 2π/256
Head Yaw byte Head yaw in steps of 2π/256
Metadata Metadata 127 Varies by mob, see Entities
Total Size: 21 bytes + Metadata (at least 1)

Map Chunk (0x33)

This is currently a best guess

Here's a packet capture: https://gist.github.com/1835702

Packet ID Field Name Field Type Example Notes
0x33 X int Chunk X Coordinate (x16 to get true X) Confirmed!
Z int Chunk Z Coordinate (x16 to get true Z) Confirmed!
Unknown Bool boolean Seems to be True when Unknown Short #1 is 2^n - 1
Unknown Short #1 short Possibly the dimensions in all directions. Or Y offset?
Unknown Short #2 short I've only seen 0
Compressed size int Size of compressed region data. Confirmed!
Unknown Int int Doesn't seem to be used by the client. Always 0. I expect this is Mod API stuff.
Compressed data unsigned byte array The region data is compressed using ZLib Deflate function. Confirmed!
Total Size: 22 bytes + Compressed chunk size

Other changes

Protocol version is now 27.

Protocol History

2012-02-15

  • 12w07a
  • Protocol version is now 27
  • Updated packets: 0x01, 0x09, 0x33

2012-02-09

  • 12w06a
  • Protocol version is now 25
  • New packet: 0x84

2012-01-26

  • 12w04a
  • Protocol version has not been changed
  • Handshake Packet by client (0x02) now contains the server host and port
  • Window Open Packet (0x64): WindowTitle is now longer than accepted by older clients. Contains a keyword such as "container.furnace"

2012-01-19

  • 12w03a
  • Protocol version is now 24
  • New packet: 0x23
  • MobSpawn: new field, 1 byte inserted before metadata.