Difference between revisions of "Pre-release protocol"

From wiki.vg
Jump to navigation Jump to search
(Reset, added information about undocumented 1.21-pre2)
Tag: Replaced
 
Line 1: Line 1:
This page documents the changes from the [[Protocol|last stable Minecraft release]] (currently 1.3.2) to the current pre-release (or weekly release).
+
There is currently a pre-release version available: 1.21-pre2, but it has not yet been documented. For the latest stable Minecraft release, see the [[Protocol|Protocol]] page. For previous pre-release pages, see the [[Protocol version numbers|Protocol version numbers]] page.
  
== New packets ==
+
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.
  
-None-
+
== Contents ==
  
== Changed packets ==
+
<div style="float:right;">__TOC__</div>
  
=== Time Update (0x04) ===
+
=== Data types ===
  
''Server to Client''
+
No changes so far.
  
Time is based on ticks, where 20 ticks happen every second. There are 24000 ticks in a day, making Minecraft days exactly 20 minutes long.
+
=== Packets ===
  
The time of day is based on the timestamp modulo 24000. 0 is sunrise, 6000 is noon, 12000 is sunset, and 18000 is midnight.  
+
No changes so far.
  
The default SMP server increments both by 20 every second.
+
[[Category:Minecraft Modern]]
 
 
The &#39;Time&#39; is the Age of the world. It is not changing on server commands and will increased by 20 every second.
 
 
 
{| 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="2" | 0x04
 
| class="col1 centeralign" | Time
 
| class="col2 centeralign" | long
 
| class="col3 centeralign" | 45464654
 
| class="col4" | The &#39;Age of the world&#39;, in ticks
 
 
 
|- class="row2"
 
| class="col0 centeralign" | Day Time
 
| class="col1 centeralign" | long
 
| class="col2 centeralign" | 21321
 
| class="col3" | The world (or region) time, in ticks
 
|- class="row3"
 
! class="col0" | Total Size:
 
| class="col1 rightalign" colspan="4" | 17 Bytes
 
|}
 
 
 
=== Spawn Named Entity (0x14) ===
 
 
 
See the change in metadata [[#metadata|below]]. (Under Protocol History, 2012-08-24)
 
 
 
=== Spawn Dropped Item (0x15) ===
 
 
 
'''''TODO'''''
 
 
 
It includes a new byte array after the "Damage" field, and before the "X" field if certain conditions are met. If the array does not exist, then the length of the array is "-1".
 
 
 
=== Spawn Mob (0x18) ===
 
 
 
See the change in metadata [[#metadata|below]]. (Under Protocol History, 2012-08-24)
 
 
 
=== Entity Metadata (0x28) ===
 
 
 
See the change in metadata [[#metadata|below]]. (Under Protocol History, 2012-08-24)
 
 
 
 
 
=== Click Window (0x66) ===
 
 
 
''Client to Server''
 
 
 
This packet is sent by the player when it clicks on a slot in a window.
 
 
 
{| 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 | 0x66
 
| class="col1 centeralign" | Window id
 
| class="col2 centeralign" | byte
 
| class="col3 centeralign" | <code>0</code>
 
| class="col4" | The id of the window which was clicked. 0 for player inventory.
 
|- class="row2"
 
| class="col0 centeralign" | Slot
 
| class="col1 centeralign" | short
 
| class="col2 centeralign" | <code>36</code>
 
| class="col3" | The clicked slot. See below.
 
|- class="row3"
 
| class="col0 centeralign" | Right-click
 
| class="col1 centeralign" | byte
 
| class="col2 centeralign" | <code>1</code>
 
| class="col3" |
 
|- class="row4"
 
| class="col0 centeralign" | Action number
 
| class="col1 centeralign" | short
 
| class="col2 centeralign" | <code>12</code>
 
| class="col3" | A unique number for the action, used for transaction handling (See the Transaction packet).
 
|- class="row5"
 
| class="col0 centeralign" | Shift
 
| class="col1 centeralign" | boolean
 
| class="col2 centeralign" | <code>0</code>
 
| class="col3" | This is true if the user was holding keyboard shift when they clicked.
 
|- class="row6"
 
| class="col0 centeralign" | Clicked item
 
| class="col1 centeralign" | [[Slot_Data|slot]]
 
| class="col2 centeralign" |
 
| class="col3" |
 
|- class="row7"
 
| class="col0" | Total Size:
 
| class="col1 rightalign" colspan="4" | 9 bytes + slot data
 
|}
 
 
 
When the user middle-clicks a slot, "shift" is 2 and "right click" is 3. The vanilla software treats a middle click as if no click occurred in the first place.
 
 
 
=== Locale and View Distance (0xCC) ===
 
 
 
''Client to server''
 
 
 
Sent when the player connects, or when settings are changed.
 
 
 
{| 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="5" | 0xCC
 
| class="col1 centeralign" | Locale
 
| class="col2 centeralign" | string
 
| class="col3 centeralign" | en_GB
 
|- class="row2"
 
| class="col0 centeralign" | View distance
 
| class="col1 centeralign" | byte
 
| class="col2 centeralign" | 0
 
| class="col3" | 0-3 for 'far', 'normal', 'short', 'tiny'.
 
|- class="row3"
 
| class="col0 centeralign" | Chat flags
 
| class="col1 centeralign" | byte
 
| class="col2 centeralign" | 8
 
| class="col3" | Chat settings. See notes below.
 
|- class="row4"
 
| class="col0 centeralign" | Difficulty
 
| class="col1 centeralign" | byte
 
| class="col2 centeralign" | 0
 
| class="col3 centeralign" | Client-side difficulty from options.txt
 
|- class="row5"
 
| class="col0 centeralign" | Show Cape
 
| class="col1 centeralign" | boolean
 
| class="col2 centeralign" | true
 
| class="col3 centeralign" | Client-side "show cape" option
 
|- class="row6"
 
| class="col0" | Total Size:
 
| class="col1 rightalign" colspan="4" | 9 bytes + length of string
 
|}
 
 
 
== Changed data types ==
 
 
 
{{anchor|metadata}}
 
== Entity Metadata Format ==
 
 
 
Note that entity metadata is a totally distinct concept from block metadata.
 
 
 
The entity metadata format is quirky dictionary format, where the key and the value's type are packed in a single byte.
 
 
 
To parse, repeat the following procedure:
 
 
 
# Read an unsigned byte
 
# If this byte == 127, stop reading
 
# Decompose the byte. <br> The bottom 5 bits (0x1F) serve as an identifier (key) for the data to follow. <br> The top 3 bits (0xE0) serve as a type.
 
# Read and unpack based on the type (below)
 
 
 
{| class="wikitable"
 
|-
 
! Type
 
! Meaning
 
|-
 
| 0
 
| byte
 
|-
 
| 1
 
| short
 
|-
 
| 2
 
| int
 
|-
 
| 3
 
| float
 
|-
 
| 4
 
| string16
 
|-
 
| 5
 
| short, byte, short (slot type) - If first short is empty, no further data is sent.
 
|-
 
| 6
 
| int, int, int (x, y, z)
 
|}
 
 
 
In Python-like code:
 
<source lang="python">
 
#socket is positioned at the beginning of the metadata array. Also note that the method unpack() doesn't exist in socket
 
metadata = {}
 
x = socket.unpack('byte')
 
while x != 127:
 
    index = x & 0x1F # Lower 5 bits
 
    ty    = x >> 5  # Upper 3 bits
 
    if ty == 0: val = socket.unpack('byte')
 
    if ty == 1: val = socket.unpack('short')
 
    if ty == 2: val = socket.unpack('int')
 
    if ty == 3: val = socket.unpack('float')
 
    if ty == 4: val = socket.unpack('string16')
 
    if ty == 5:
 
        val = {}
 
        val["id"] = socket.unpack('short')
 
        if val["id"] != -1:
 
            val["count"] = socket.unpack('byte')
 
            val["damage"] = socket.unpack('short')
 
    if ty == 6:
 
        val = []
 
        for i in range(3):
 
            val.append(socket.unpack('int'))
 
    metadata[index] = (ty, val)
 
    x = socket.unpack('byte')
 
return metadata
 
</source>
 
 
 
== Removed packets ==
 
 
 
-None-
 
 
 
== Protocol History ==
 
=== 2012-10-11 ===
 
* 12w41a
 
* Protocol version is now 46
 
* 0xcc Changed to include boolean 'show cape' field.
 
* Spawn named entity metadata includes an int at index 16, 1 = show cape, 0 = don't show cape
 
 
 
=== 2012-10-04 ===
 
* 12w40a
 
* Protocol version is now 45
 
* Packet 0x66 changed
 
 
 
=== 2012-09-06 ===
 
* 12w36a
 
* Protocol version is now 42
 
 
 
=== 2012-08-24 ===
 
* 12w34b
 
* Protocol version is now 41
 
 
 
* Changed Entity Metadata Format
 
 
 
=== 2012-08-09 ===
 
* 12w32a
 
* Protocol version is now 40
 
 
 
* Changed Time Update packet
 

Latest revision as of 09:24, 6 June 2024

There is currently a pre-release version available: 1.21-pre2, but it has not yet been documented. For the latest stable Minecraft release, see the Protocol page. For previous pre-release pages, see the Protocol version numbers page.

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.

Contents

Data types

No changes so far.

Packets

No changes so far.