Difference between revisions of "Protocol"
Jump to navigation
Jump to search
m (→Update Score: It's not the score name; it's the entity name) |
m (More documentation on plugin message) |
||
(434 intermediate revisions by more than 100 users not shown) | |||
Line 3: | Line 3: | ||
|BACKGROUND = #99CCFF | |BACKGROUND = #99CCFF | ||
|WIDTH = 100% | |WIDTH = 100% | ||
− | |ICON = | + | |ICON = |
|HEADING = Heads up! | |HEADING = Heads up! | ||
− | |CONTENT = This article is about the protocol for the latest '''stable''' release of Minecraft ''' | + | |CONTENT = This article is about the protocol for the latest '''stable''' release of Minecraft '''Java Edition''' ([[Protocol version numbers|1.19, protocol 759]]). For the Java Edition pre-releases, see [[Pre-release protocol]]. For the incomplete Bedrock Edition docs, see [[Bedrock Protocol]]. For the old Pocket Edition, see [[Pocket Edition Protocol Documentation]]. |
}} | }} | ||
This page presents a dissection of the current '''[https://minecraft.net/ Minecraft] protocol'''. | This page presents a dissection of the current '''[https://minecraft.net/ Minecraft] protocol'''. | ||
− | If you're having trouble, check out the [[Protocol FAQ|FAQ]] or ask for help in the IRC channel | + | If you're having trouble, check out the [[Protocol FAQ|FAQ]] or ask for help in the IRC channel [ircs://irc.libera.chat:6697 #mcdevs on irc.libera.chat] ([https://wiki.vg/MCDevs More Information]). |
− | '''Note:''' While you may use the contents of this page without restriction to create servers, clients, bots, | + | '''Note:''' While you may use the contents of this page without restriction to create servers, clients, bots, etc; substantial reproductions of this page must be attributed IAW [https://creativecommons.org/licenses/by-sa/4.0/ CC BY-SA 4.0]. |
The changes between versions may be viewed at [[Protocol History]]. | The changes between versions may be viewed at [[Protocol History]]. | ||
Line 18: | Line 18: | ||
== Definitions == | == Definitions == | ||
− | The Minecraft server accepts connections from TCP clients and communicates with them using ''packets''. A packet is a sequence of bytes sent over the TCP connection. The meaning of a packet depends both on its packet ID and the current state of the connection. The initial state of each connection is [[#Handshaking|Handshaking]], and state is switched using the packets [[#Handshake|Handshake]] | + | The Minecraft server accepts connections from TCP clients and communicates with them using ''packets''. A packet is a sequence of bytes sent over the TCP connection. The meaning of a packet depends both on its packet ID and the current state of the connection. The initial state of each connection is [[#Handshaking|Handshaking]], and state is switched using the packets [[#Handshake|Handshake]] and [[#Login Success|Login Success]]. |
=== Data types === | === Data types === | ||
Line 47: | Line 47: | ||
|- | |- | ||
| Global palette | | Global palette | ||
− | | A table/dictionary/palette mapping nonnegative integers to block states. | + | | A table/dictionary/palette mapping nonnegative integers to block states. Block state IDs are created in a linear fashion based off of order of assignment. One block state ID allocated for each unique block state for a block; if a block has multiple properties then the number of allocated states is the product of the number of values for each property. A current list of properties and state ID ranges is found on [https://pokechu22.github.io/Burger/1.19.html burger]. |
+ | |||
+ | Alternatively, the vanilla server now includes an option to export the current block state ID mapping, by running <code>java -cp minecraft_server.jar net.minecraft.data.Main --reports</code>. See [[Data Generators]] for more information. | ||
|- | |- | ||
| Notchian | | Notchian | ||
| The official implementation of vanilla Minecraft as developed and released by Mojang. | | The official implementation of vanilla Minecraft as developed and released by Mojang. | ||
+ | |- | ||
+ | | Sequence | ||
+ | | The action number counter for local block changes, incremented by one when clicking a block with a hand, right clicking an item, or starting or finishing digging a block. Counter handles latency to avoid applying outdated block changes to the local world. Also is used to revert ghost blocks created when placing blocks, using buckets, or breaking blocks. | ||
|} | |} | ||
== Packet format == | == Packet format == | ||
+ | |||
+ | Packets cannot be larger than 2<sup>21</sup> − 1 or 2097151 bytes (the maximum that can be sent in a 3-byte VarInt). For compressed packets, this applies to both the compressed length and uncompressed lengths. | ||
=== Without compression === | === Without compression === | ||
Line 64: | Line 71: | ||
| Length | | Length | ||
| VarInt | | VarInt | ||
− | | Length of | + | | Length of Packet ID + Data |
|- | |- | ||
| Packet ID | | Packet ID | ||
| VarInt | | VarInt | ||
− | | | + | | |
|- | |- | ||
| Data | | Data | ||
Line 77: | Line 84: | ||
=== With compression === | === With compression === | ||
− | Once a [[#Set Compression|Set Compression]] packet (with a non-negative threshold) is sent, [[wikipedia:Zlib|zlib]] compression is enabled for all following packets. The format of a packet changes | + | Once a [[#Set Compression|Set Compression]] packet (with a non-negative threshold) is sent, [[wikipedia:Zlib|zlib]] compression is enabled for all following packets. The format of a packet changes slightly to include the size of the uncompressed packet. |
{| class=wikitable | {| class=wikitable | ||
Line 97: | Line 104: | ||
|rowspan="2"| Yes | |rowspan="2"| Yes | ||
| Packet ID | | Packet ID | ||
− | | | + | | VarInt |
| zlib compressed packet ID (see the sections below) | | zlib compressed packet ID (see the sections below) | ||
|- | |- | ||
Line 105: | Line 112: | ||
|} | |} | ||
− | + | If the size of the buffer containing the packet data and ID (as a VarInt) is smaller than the threshold specified in the packet [[#Set Compression|Set Compression]]. It will be sent as uncompressed. This is done by setting the data length as 0. (Comparable to sending a non-compressed format with an extra 0 between the length, and packet data). | |
− | |||
− | |||
− | If | + | If it's larger than the threshold, then it follows the regular compressed protocol format. |
− | Compression can be disabled by sending the packet [[#Set Compression|Set Compression]] | + | Compression can be disabled by sending the packet [[#Set Compression|Set Compression]] with a negative Threshold, or not sending the Set Compression packet at all. |
== Handshaking == | == Handshaking == | ||
Line 138: | Line 143: | ||
| Protocol Version | | Protocol Version | ||
| VarInt | | VarInt | ||
− | | See [[protocol version numbers]] (currently | + | | See [[protocol version numbers]] (currently 759 in Minecraft 1.19). |
|- | |- | ||
| Server Address | | Server Address | ||
| String (255) | | String (255) | ||
− | | Hostname or IP, e.g. localhost or 127.0.0.1, that was used to connect. | + | | Hostname or IP, e.g. localhost or 127.0.0.1, that was used to connect. The Notchian server does not use this information. Note that SRV records are a simple redirect, e.g. if _minecraft._tcp.example.com points to mc.example.org, users connecting to example.com will provide example.org as server address in addition to connecting to it. |
− | |- | + | |- |
| Server Port | | Server Port | ||
| Unsigned Short | | Unsigned Short | ||
− | | Default is 25565. | + | | Default is 25565. The Notchian server does not use this information. |
|- | |- | ||
| Next State | | Next State | ||
| VarInt Enum | | VarInt Enum | ||
− | | 1 for [[#Status| | + | | 1 for [[#Status|Status]], 2 for [[#Login|Login]]. |
|} | |} | ||
Line 157: | Line 162: | ||
{{Warning|This packet uses a nonstandard format. It is never length-prefixed, and the packet ID is an Unsigned Byte instead of a VarInt.}} | {{Warning|This packet uses a nonstandard format. It is never length-prefixed, and the packet ID is an Unsigned Byte instead of a VarInt.}} | ||
− | While not technically part of the current protocol, legacy clients may send this packet to initiate [[Server List Ping]], and modern servers should handle it correctly. | + | While not technically part of the current protocol, legacy clients may send this packet to initiate [[Server List Ping]], and modern servers should handle it correctly. |
+ | The format of this packet is a remnant of the pre-Netty age, before the switch to Netty in 1.7 brought the standard format that is recognized now. This packet merely exists to inform legacy clients that they can't join our modern server. | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 172: | Line 178: | ||
| Payload | | Payload | ||
| Unsigned Byte | | Unsigned Byte | ||
− | | always 1 (<code>0x01</code>) | + | | always 1 (<code>0x01</code>). |
|} | |} | ||
See [[Server List Ping#1.6]] for the details of the protocol that follows this packet. | See [[Server List Ping#1.6]] for the details of the protocol that follows this packet. | ||
− | == | + | == Status == |
+ | {{Main|Server List Ping}} | ||
=== Clientbound === | === Clientbound === | ||
− | ==== | + | ==== Status Response ==== |
− | |||
− | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 193: | Line 198: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="2"| 0x00 |
− | |rowspan=" | + | |rowspan="2"| Status |
− | |rowspan=" | + | |rowspan="2"| Client |
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | JSON Response |
− | | | + | | String (32767) |
− | | | + | | See [[Server List Ping#Response]]; as with all strings this is prefixed by its length as a VarInt. |
+ | |} | ||
+ | |||
+ | ==== Ping Response ==== | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
|- | |- | ||
− | | | + | | 0x01 |
− | | | + | | Status |
− | | | + | | Client |
− | | | + | | Payload |
− | | | + | | Long |
− | | | + | | Should be the same as sent by the client. |
− | | | + | |} |
− | + | ||
− | + | === Serverbound === | |
− | + | ||
− | + | ==== Status Request ==== | |
+ | |||
+ | The status can only be requested once immediately after the handshake, before any ping. The server won't respond otherwise. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
|- | |- | ||
− | | | + | | 0x00 |
− | | | + | | Status |
− | | | + | | Server |
− | | | + | |colspan="3"| ''no fields'' |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
− | ==== | + | ==== Ping Request ==== |
− | |||
− | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 255: | Line 255: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | + | | 0x01 | |
− | | | + | | Status |
− | + | | Server | |
− | + | | Payload | |
− | + | | Long | |
− | + | | May be any number. Notchian clients use a system-dependent time value which is counted in milliseconds. | |
− | |||
− | |||
− | |||
− | |||
− | | | ||
− | | | ||
− | |||
− | | | ||
− | |- | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
− | ==== | + | == Login == |
+ | |||
+ | The login process is as follows: | ||
+ | |||
+ | # C→S: [[#Handshake|Handshake]] with Next State set to 2 (login) | ||
+ | # C→S: [[#Login Start|Login Start]] | ||
+ | # S→C: [[#Encryption Request|Encryption Request]] | ||
+ | # Client auth | ||
+ | # C→S: [[#Encryption Response|Encryption Response]] | ||
+ | # Server auth, both enable encryption | ||
+ | # S→C: [[#Set Compression|Set Compression]] (optional) | ||
+ | # S→C: [[#Login Success|Login Success]] | ||
+ | |||
+ | Set Compression, if present, must be sent before Login Success. Note that anything sent after Set Compression must use the [[#With compression|Post Compression packet format]]. | ||
+ | |||
+ | For unauthenticated ("cracked"/offline-mode) and integrated servers (either of the two conditions is enough for an unencrypted connection) there is no encryption. In that case [[#Login Start|Login Start]] is directly followed by [[#Login Success|Login Success]]. The Notchian server uses UUID v3 for offline player UUIDs, with the namespace “OfflinePlayer” and the value as the player’s username. For example, Notch’s offline UUID would be derived from the string “OfflinePlayer:Notch”. This is not a requirement however, the UUID may be anything. | ||
+ | |||
+ | See [[Protocol Encryption]] for details. | ||
+ | |||
+ | === Clientbound === | ||
− | + | ==== Disconnect (login) ==== | |
{| class="wikitable" | {| class="wikitable" | ||
Line 291: | Line 294: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | | | + | | 0x00 |
− | | | + | | Login |
− | + | | Client | |
− | | | + | | Reason |
− | | | + | | [[Chat]] |
− | | The | + | | The reason why the player was disconnected. |
− | + | |} | |
− | + | ||
− | + | ==== Encryption Request ==== | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |} | ||
− | |||
− | ==== | ||
− | |||
− | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 327: | Line 312: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="5"| 0x01 |
− | |rowspan=" | + | |rowspan="5"| Login |
− | |rowspan=" | + | |rowspan="5"| Client |
− | | | + | | Server ID |
+ | | String (20) | ||
+ | | Appears to be empty. | ||
+ | |- | ||
+ | | Public Key Length | ||
| VarInt | | VarInt | ||
− | | | + | | Length of Public Key |
|- | |- | ||
− | | | + | | Public Key |
− | | | + | | Byte Array |
− | | | + | | The server's public key, in bytes. |
|- | |- | ||
− | | | + | | Verify Token Length |
| VarInt | | VarInt | ||
− | | | + | | Length of Verify Token. Always 4 for Notchian servers. |
|- | |- | ||
− | | | + | | Verify Token |
− | | | + | | Byte Array |
− | | | + | | A sequence of random bytes generated by the server. |
− | | | + | |} |
− | + | ||
− | + | See [[Protocol Encryption]] for details. | |
− | + | ||
− | + | ==== Login Success ==== | |
− | | | + | |
− | | | + | {| class="wikitable" |
− | + | ! Packet ID | |
+ | ! State | ||
+ | ! Bound To | ||
+ | !colspan="2"| Field Name | ||
+ | !colspan="2"| Field Type | ||
+ | ! Notes | ||
|- | |- | ||
− | | | + | |rowspan="7"| 0x02 |
− | | | + | |rowspan="7"| Login |
− | | | + | |rowspan="7"| Client |
+ | |colspan="2"| UUID | ||
+ | |colspan="2"| UUID | ||
+ | |colspan="2"| | ||
|- | |- | ||
− | | | + | |colspan="2"| Username |
− | | | + | |colspan="2"| String (16) |
− | | | + | |colspan="2"| |
|- | |- | ||
− | | | + | |colspan="2"| Number Of Properties |
− | | | + | |colspan="2"| VarInt |
− | | | + | | Number of elements in the following array. |
|- | |- | ||
− | | | + | |rowspan="4"| Property |
− | | | + | | Name |
− | | | + | |rowspan="4"| Array |
+ | | String (32767) | ||
+ | |colspan="2"| | ||
|- | |- | ||
− | | | + | | Value |
− | | | + | | String (32767) |
− | | | + | |colspan="1"| |
|- | |- | ||
− | | | + | | Is Signed |
− | | | + | | Boolean |
− | | | + | |colspan="2"| |
|- | |- | ||
− | | | + | | Signature |
− | | | + | | Optional String (32767) |
− | | | + | | Only if Is Signed is true. |
|} | |} | ||
− | + | This packet switches the connection state to [[#Play|play]]. | |
+ | |||
+ | {{Warning2|The (notchian) server might take a bit to fully transition to the Play state, so it's recommended to wait before sending Play packets, either by setting a timeout, or waiting for Play packets from the server (usually [[#Login (play)|Login (play)]]). | ||
− | + | The notchian client doesn't send any (non-[[#Keep Alive|keep alive]]) packets until the next tick/[[#Set Time|Set Time]] packet. | |
+ | }} | ||
+ | |||
+ | ==== Set Compression ==== | ||
+ | |||
+ | Enables compression. If compression is enabled, all following packets are encoded in the [[#With compression|compressed packet format]]. Negative or zero values will disable compression, meaning the packet format should remain in the [[#Without compression|uncompressed packet format]]. However, this packet is entirely optional, and if not sent, compression will also not be enabled (the notchian server does not send the packet when compression is disabled). | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 395: | Line 401: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | | | + | | 0x03 |
− | | | + | | Login |
− | + | | Client | |
− | | | + | | Threshold |
| VarInt | | VarInt | ||
− | | | + | | Maximum size of a packet before it is compressed. |
+ | |} | ||
+ | |||
+ | ==== Login Plugin Request ==== | ||
+ | |||
+ | Used to implement a custom handshaking flow together with [[#Login Plugin Response|Login Plugin Response]]. | ||
+ | |||
+ | Unlike plugin messages in "play" mode, these messages follow a lock-step request/response scheme, where the client is expected to respond to a request indicating whether it understood. The notchian client always responds that it hasn't understood, and sends an empty payload. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
|- | |- | ||
− | | | + | |rowspan="3"| 0x04 |
− | | | + | |rowspan="3"| Login |
− | | | + | |rowspan="3"| Client |
+ | | Message ID | ||
+ | | VarInt | ||
+ | | Generated by the server - should be unique to the connection. | ||
|- | |- | ||
− | | | + | | Channel |
− | | | + | | Identifier |
− | | Name of the | + | | Name of the [[plugin channel]] used to send the data. |
|- | |- | ||
− | | | + | | Data |
− | + | | Byte Array | |
− | + | | Any data, depending on the channel. The length of this array must be inferred from the packet length. | |
− | |||
− | |||
− | | Byte | ||
− | | | ||
|} | |} | ||
− | + | === Serverbound === | |
− | + | ==== Login Start ==== | |
{| class="wikitable" | {| class="wikitable" | ||
− | ! | + | ! Packet ID |
− | ! | + | ! State |
− | ! | + | ! Bound To |
− | ! | + | ! Field Name |
− | ! | + | ! Field Type |
+ | ! Notes | ||
+ | |- | ||
+ | |rowspan="7"| 0x00 | ||
+ | |rowspan="7"| Login | ||
+ | |rowspan="7"| Server | ||
+ | | Name | ||
+ | | String (16) | ||
+ | | Player's Username. | ||
|- | |- | ||
− | | | + | | Has Sig Data |
− | | | + | | Boolean |
− | | | + | | Whether or not the next 5 fields should be sent. |
− | |||
− | |||
|- | |- | ||
− | | | + | | Timestamp |
− | | | + | | Long |
− | | | + | | When the key data will expire. Optional. Only sent if Has Sig Data is true. |
− | | | + | |- |
− | | | + | | Public Key Length |
+ | | VarInt | ||
+ | | Length of Public Key. Optional. Only sent if Has Sig Data is true. | ||
|- | |- | ||
− | | | + | | Public Key |
− | | | + | | Byte Array |
− | | | + | | The encoded bytes of the public key the client received from Mojang. Optional. Only sent if Has Sig Data is true. |
− | |||
− | |||
|- | |- | ||
− | | | + | | Signature Length |
− | | | + | | VarInt |
− | | | + | | Length of Signature. Optional. Only sent if Has Sig Data is true. |
− | |||
− | |||
|- | |- | ||
− | | | + | | Signature |
− | | | + | | Byte Array |
− | | | + | | The bytes of the public key signature the client received from Mojang. Optional. Only sent if Has Sig Data is true. |
− | | | + | |} |
− | + | ||
+ | ==== Encryption Response ==== | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
|- | |- | ||
− | | | + | |rowspan="8"| 0x01 |
− | | | + | |rowspan="8"| Login |
− | | | + | |rowspan="8"| Server |
− | | | + | | Shared Secret Length |
− | | | + | | VarInt |
+ | | Length of Shared Secret. | ||
|- | |- | ||
− | | | + | | Shared Secret |
− | | | + | | Byte Array |
− | | | + | | Shared Secret value, encrypted with the server's public key. |
− | |||
− | |||
|- | |- | ||
− | | | + | | Has Verify Token |
− | | | + | | Boolean |
− | | | + | | Whether or not the Verify Token should be sent. If not, then the salt and signature will be sent. |
− | | | + | |- |
− | | | + | | Optional Verify Token Length |
+ | | VarInt | ||
+ | | Length of Verify Token. Optional and only sent if Has Verify Token is true. | ||
|- | |- | ||
− | | | + | | Optional Verify Token |
− | | | + | | Byte Array |
− | | | + | | Verify Token value, encrypted with the same public key as the shared secret. Optional and only sent if Has Verify Token is true. |
− | |||
− | |||
|- | |- | ||
− | | | + | | Optional Salt |
− | | | + | | Long |
− | | | + | | Cryptography, used for validating the message signature. Optional and only sent if Has Verify Token is false. |
− | |||
− | |||
|- | |- | ||
− | | | + | | Optional Message Signature Length |
− | | | + | | VarInt |
− | | | + | | Array Length. Optional and only sent if Has Verify Token is false. |
− | |||
− | |||
|- | |- | ||
− | | | + | | Optional Message Signature |
− | | | + | | Byte Array |
− | | | + | | The bytes of the public key signature the client received from Mojang. Optional and only sent if Has Verify Token is false. |
− | | | + | |} |
− | + | ||
+ | See [[Protocol Encryption]] for details. See [[Mojang_API#Player_Certificates]] for an API to get the message signature. | ||
+ | |||
+ | ==== Login Plugin Response ==== | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
|- | |- | ||
− | | | + | |rowspan="3"| 0x02 |
− | | | + | |rowspan="3"| Login |
− | | | + | |rowspan="3"| Server |
− | | | + | | Message ID |
− | | | + | | VarInt |
+ | | Should match ID from server. | ||
|- | |- | ||
− | | <code> | + | | Successful |
− | + | | Boolean | |
− | + | | <code>true</code> if the client understood the request, <code>false</code> otherwise. When <code>false</code>, no payload follows. | |
− | |||
− | |||
|- | |- | ||
− | | | + | | Data |
− | | | + | | Optional Byte Array |
− | | | + | | Any data, depending on the channel. The length of this array must be inferred from the packet length. |
− | | | + | |} |
− | + | ||
+ | == Play == | ||
+ | |||
+ | === Clientbound === | ||
+ | |||
+ | ==== Spawn Entity ==== | ||
+ | |||
+ | Sent by the server when a vehicle or other non-living entity is created. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
|- | |- | ||
− | | | + | |rowspan="13"| 0x00 |
− | | | + | |rowspan="13"| Play |
− | | | + | |rowspan="13"| Client |
− | | | + | | Entity ID |
− | | | + | | VarInt |
+ | | A unique integer ID mostly used in the protocol to identify the entity. | ||
|- | |- | ||
− | | | + | | Entity UUID |
− | | | + | | UUID |
− | | | + | | A unique identifier that is mostly used in persistence and places where the uniqueness matters more. |
− | |||
− | |||
|- | |- | ||
− | | | + | | Type |
− | | | + | | VarInt |
− | | | + | | The type of the entity (see "type" field of the list of [[entity_metadata#Mobs|Mob types]]). |
− | |||
− | |||
|- | |- | ||
− | | | + | | X |
− | | | + | | Double |
− | | | + | | |
− | |||
− | |||
|- | |- | ||
− | | | + | | Y |
− | | | + | | Double |
− | | | + | | |
− | |||
− | |||
|- | |- | ||
− | | | + | | Z |
− | | | + | | Double |
− | | | + | | |
− | | | + | |- |
− | | | + | | Pitch |
+ | | Angle | ||
+ | | To get the real pitch, you must divide this by (256.0F / 360.0F) | ||
|- | |- | ||
− | | | + | | Yaw |
− | | | + | | Angle |
− | | | + | | To get the real yaw, you must divide this by (256.0F / 360.0F) |
− | |||
− | |||
|- | |- | ||
− | | | + | | Head Yaw |
− | | | + | | Angle |
− | | | + | |- Only used by living entities, where the head of the entity may differ from the general body rotation. |
− | | | + | | Data |
− | | | + | | VarInt |
+ | | Meaning dependent on the value of the Type field, see [[Object Data]] for details. | ||
|- | |- | ||
− | | | + | | Velocity X |
− | | | + | | Short |
− | | | + | |rowspan="3"| Same units as [[#Set Entity Motion|Set Entity Motion]]. |
− | |||
− | |||
|- | |- | ||
− | | | + | | Velocity Y |
− | | | + | | Short |
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | Velocity Z |
− | | | + | | Short |
− | |||
− | |||
− | |||
|} | |} | ||
− | + | ==== Spawn Experience Orb ==== | |
− | + | Spawns one or more experience orbs. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 605: | Line 638: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="5"| 0x01 |
− | |rowspan=" | + | |rowspan="5"| Play |
− | |rowspan=" | + | |rowspan="5"| Client |
+ | | Entity ID | ||
+ | | VarInt | ||
+ | | | ||
+ | |- | ||
+ | | X | ||
+ | | Double | ||
+ | | | ||
+ | |- | ||
+ | | Y | ||
+ | | Double | ||
+ | | | ||
+ | |- | ||
+ | | Z | ||
+ | | Double | ||
+ | | | ||
+ | |- | ||
+ | | Count | ||
+ | | Short | ||
+ | | The amount of experience this orb will reward once collected. | ||
+ | |} | ||
+ | |||
+ | ==== Spawn Player ==== | ||
+ | |||
+ | This packet is sent by the server when a player comes into visible range, ''not'' when a player joins. | ||
+ | |||
+ | This packet must be sent after the [[#Player Info|Player Info]] packet that adds the player data for the client to use when spawning a player. If the Player Info for the player spawned by this packet is not present when this packet arrives, Notchian clients will not spawn the player entity. The Player Info packet includes skin/cape data. | ||
+ | |||
+ | Servers can, however, safely spawn player entities for players not in visible range. The client appears to handle it correctly. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
+ | |- | ||
+ | |rowspan="7"| 0x02 | ||
+ | |rowspan="7"| Play | ||
+ | |rowspan="7"| Client | ||
| Entity ID | | Entity ID | ||
| VarInt | | VarInt | ||
− | | | + | | A unique integer ID mostly used in the protocol to identify the player. |
|- | |- | ||
| Player UUID | | Player UUID | ||
| UUID | | UUID | ||
− | | See below for notes on {{Minecraft Wiki|Server.properties#online-mode|offline mode}} and NPCs | + | | See below for notes on {{Minecraft Wiki|Server.properties#online-mode|offline mode}} and NPCs. |
|- | |- | ||
| X | | X | ||
| Double | | Double | ||
− | | | + | | |
|- | |- | ||
| Y | | Y | ||
| Double | | Double | ||
− | | | + | | |
|- | |- | ||
| Z | | Z | ||
| Double | | Double | ||
− | | | + | | |
|- | |- | ||
| Yaw | | Yaw | ||
| Angle | | Angle | ||
− | | | + | | |
|- | |- | ||
| Pitch | | Pitch | ||
| Angle | | Angle | ||
− | + | | | |
− | |||
− | |||
− | |||
− | | | ||
|} | |} | ||
When in {{Minecraft Wiki|Server.properties#online-mode|online mode}}, the UUIDs must be valid and have valid skin blobs. | When in {{Minecraft Wiki|Server.properties#online-mode|online mode}}, the UUIDs must be valid and have valid skin blobs. | ||
− | In offline mode, [[Wikipedia:Universally unique identifier#Versions 3 and 5 (namespace name-based)|UUID v3]] is used with the String <code>OfflinePlayer:<player name></code>, encoded in UTF-8 (and case-sensitive). | + | In offline mode, [[Wikipedia:Universally unique identifier#Versions 3 and 5 (namespace name-based)|UUID v3]] is used with the String <code>OfflinePlayer:<player name></code>, encoded in UTF-8 (and case-sensitive). The Notchain server uses <code>UUID.nameUUIDFromBytes</code>, implemented by OpenJDK [https://github.com/AdoptOpenJDK/openjdk-jdk8u/blob/9a91972c76ddda5c1ce28b50ca38cbd8a30b7a72/jdk/src/share/classes/java/util/UUID.java#L153-L175 here]. |
For NPCs UUID v2 should be used. Note: | For NPCs UUID v2 should be used. Note: | ||
Line 651: | Line 720: | ||
In an example UUID, <code>xxxxxxxx-xxxx-Yxxx-xxxx-xxxxxxxxxxxx</code>, the UUID version is specified by <code>Y</code>. So, for UUID v3, <code>Y</code> will always be <code>3</code>, and for UUID v2, <code>Y</code> will always be <code>2</code>. | In an example UUID, <code>xxxxxxxx-xxxx-Yxxx-xxxx-xxxxxxxxxxxx</code>, the UUID version is specified by <code>Y</code>. So, for UUID v3, <code>Y</code> will always be <code>3</code>, and for UUID v2, <code>Y</code> will always be <code>2</code>. | ||
− | ==== Animation (clientbound) ==== | + | ==== Entity Animation (clientbound) ==== |
Sent whenever an entity should change animation. | Sent whenever an entity should change animation. | ||
Line 663: | Line 732: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan="2"| | + | |rowspan="2"| 0x03 |
|rowspan="2"| Play | |rowspan="2"| Play | ||
|rowspan="2"| Client | |rowspan="2"| Client | ||
| Entity ID | | Entity ID | ||
| VarInt | | VarInt | ||
− | | Player ID | + | | Player ID. |
|- | |- | ||
| Animation | | Animation | ||
| Unsigned Byte | | Unsigned Byte | ||
− | | Animation ID (see below) | + | | Animation ID (see below). |
|} | |} | ||
Line 700: | Line 769: | ||
|} | |} | ||
− | ==== Statistics ==== | + | ==== Award Statistics ==== |
+ | |||
+ | Sent as a response to [[#Client Command|Client Command]] (id 1). Will only send the changed values if previously requested. | ||
{| class="wikitable" | {| class="wikitable" | ||
! Packet ID | ! Packet ID | ||
! State | ! State | ||
− | ! Bound To | + | ! Bound To |
!colspan="2"| Field Name | !colspan="2"| Field Name | ||
!colspan="2"| Field Type | !colspan="2"| Field Type | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="4"| 0x04 |
− | |rowspan=" | + | |rowspan="4"| Play |
− | |rowspan=" | + | |rowspan="4"| Client |
|colspan="2"| Count | |colspan="2"| Count | ||
|colspan="2"| VarInt | |colspan="2"| VarInt | ||
− | | Number of elements in the following array | + | | Number of elements in the following array. |
+ | |- | ||
+ | |rowspan="3"| Statistic | ||
+ | | Category ID | ||
+ | |rowspan="3"| Array | ||
+ | | VarInt | ||
+ | | See below. | ||
|- | |- | ||
− | + | | Statistic ID | |
− | | | + | | VarInt |
− | + | | See below. | |
− | | | ||
− | |||
|- | |- | ||
| Value | | Value | ||
| VarInt | | VarInt | ||
− | | The amount to set it to | + | | The amount to set it to. |
|} | |} | ||
− | + | Categories (these are namespaced, but with <code>:</code> replaced with <code>.</code>): | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{| class="wikitable" | {| class="wikitable" | ||
− | ! | + | ! Name |
− | ! | + | ! ID |
− | + | ! Registry | |
− | + | |- | |
− | + | | <code>minecraft.mined</code> | |
− | + | | 0 | |
+ | | Blocks | ||
+ | |- | ||
+ | | <code>minecraft.crafted</code> | ||
+ | | 1 | ||
+ | | Items | ||
+ | |- | ||
+ | | <code>minecraft.used</code> | ||
+ | | 2 | ||
+ | | Items | ||
+ | |- | ||
+ | | <code>minecraft.broken</code> | ||
+ | | 3 | ||
+ | | Items | ||
|- | |- | ||
− | | | + | | <code>minecraft.picked_up</code> |
− | + | | 4 | |
− | + | | Items | |
− | |||
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | <code>minecraft.dropped</code> |
− | | | + | | 5 |
− | | | + | | Items |
|- | |- | ||
− | | | + | | <code>minecraft.killed</code> |
− | + | | 6 | |
− | | | + | | Entities |
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | <code>minecraft.killed_by</code> |
− | + | | 7 | |
− | + | | Entities | |
− | |||
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | <code>minecraft.custom</code> |
− | + | | 8 | |
− | + | | Custom | |
− | |||
− | |||
− | | | ||
− | | | ||
|} | |} | ||
− | + | Blocks, Items, and Entities use block (not block state), item, and entity ids. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | Custom has the following (unit only matters for clients): | |
{| class="wikitable" | {| class="wikitable" | ||
− | ! | + | ! Name |
− | + | ! ID | |
− | + | ! Unit | |
− | |||
− | ! | ||
− | ! | ||
|- | |- | ||
− | | | + | | <code>minecraft.leave_game</code> |
− | + | | 0 | |
− | + | | None | |
− | |||
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | <code>minecraft.play_one_minute</code> |
− | | | + | | 1 |
− | | | + | | Time |
|- | |- | ||
− | | | + | | <code>minecraft.time_since_death</code> |
− | | | + | | 2 |
− | | | + | | Time |
|- | |- | ||
− | | | + | | <code>minecraft.time_since_rest</code> |
− | + | | 3 | |
− | + | | Time | |
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | <code>minecraft.sneak_time</code> |
− | + | | 4 | |
− | + | | Time | |
− | |||
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | <code>minecraft.walk_one_cm</code> |
− | + | | 5 | |
− | + | | Distance | |
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | <code>minecraft.crouch_one_cm</code> |
− | + | | 6 | |
− | + | | Distance | |
− | |||
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | <code>minecraft.sprint_one_cm</code> |
− | | | + | | 7 |
− | | | + | | Distance |
|- | |- | ||
− | + | | <code>minecraft.walk_on_water_one_cm</code> | |
− | + | | 8 | |
− | + | | Distance | |
− | + | |- | |
+ | | <code>minecraft.fall_one_cm</code> | ||
+ | | 9 | ||
+ | | Distance | ||
|- | |- | ||
− | | | + | | <code>minecraft.climb_one_cm</code> |
− | + | | 10 | |
− | | | + | | Distance |
− | | | ||
|- | |- | ||
− | | | + | | <code>minecraft.fly_one_cm</code> |
− | | | + | | 11 |
− | | | + | | Distance |
|- | |- | ||
− | | | + | | <code>minecraft.walk_under_water_one_cm</code> |
− | | | + | | 12 |
− | | | + | | Distance |
|- | |- | ||
− | | | + | | <code>minecraft.minecart_one_cm</code> |
− | | | + | | 13 |
− | | | + | | Distance |
|- | |- | ||
− | | | + | | <code>minecraft.boat_one_cm</code> |
− | | | + | | 14 |
− | | | + | | Distance |
|- | |- | ||
− | | | + | | <code>minecraft.pig_one_cm</code> |
− | | | + | | 15 |
− | | | + | | Distance |
− | |||
|- | |- | ||
− | | | + | | <code>minecraft.horse_one_cm</code> |
− | | | + | | 16 |
− | | | + | | Distance |
− | |||
|- | |- | ||
− | | | + | | <code>minecraft.aviate_one_cm</code> |
− | | | + | | 17 |
− | + | | Distance | |
− | | | ||
|- | |- | ||
− | | | + | | <code>minecraft.swim_one_cm</code> |
− | + | | 18 | |
− | | | + | | Distance |
− | | | ||
|- | |- | ||
− | | | + | | <code>minecraft.strider_one_cm</code> |
− | | | + | | 19 |
− | | | + | | Distance |
|- | |- | ||
− | | | + | | <code>minecraft.jump</code> |
− | | | + | | 20 |
− | | | + | | None |
− | |||
|- | |- | ||
− | | | + | | <code>minecraft.drop</code> |
− | + | | 21 | |
− | + | | None | |
− | + | |- | |
− | + | | <code>minecraft.damage_dealt</code> | |
+ | | 22 | ||
+ | | Damage | ||
|- | |- | ||
− | | | + | | <code>minecraft.damage_dealt_absorbed</code> |
− | | | + | | 23 |
+ | | Damage | ||
|- | |- | ||
− | | | + | | <code>minecraft.damage_dealt_resisted</code> |
− | | | + | | 24 |
+ | | Damage | ||
|- | |- | ||
− | | | + | | <code>minecraft.damage_taken</code> |
− | | | + | | 25 |
+ | | Damage | ||
|- | |- | ||
− | | | + | | <code>minecraft.damage_blocked_by_shield</code> |
− | | | + | | 26 |
+ | | Damage | ||
|- | |- | ||
− | | | + | | <code>minecraft.damage_absorbed</code> |
− | | | + | | 27 |
+ | | Damage | ||
|- | |- | ||
− | | | + | | <code>minecraft.damage_resisted</code> |
− | | | + | | 28 |
+ | | Damage | ||
|- | |- | ||
− | | | + | | <code>minecraft.deaths</code> |
− | | | + | | 29 |
− | | | + | | None |
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | <code>minecraft.mob_kills</code> |
− | | | + | | 30 |
+ | | None | ||
|- | |- | ||
− | | | + | | <code>minecraft.animals_bred</code> |
− | | | + | | 31 |
+ | | None | ||
|- | |- | ||
− | | | + | | <code>minecraft.player_kills</code> |
− | | | + | | 32 |
+ | | None | ||
|- | |- | ||
− | | | + | | <code>minecraft.fish_caught</code> |
− | | | + | | 33 |
+ | | None | ||
|- | |- | ||
− | | | + | | <code>minecraft.talked_to_villager</code> |
− | | | + | | 34 |
− | | | + | | None |
− | + | |- | |
− | + | | <code>minecraft.traded_with_villager</code> | |
− | + | | 35 | |
− | + | | None | |
− | + | |- | |
− | + | | <code>minecraft.eat_cake_slice</code> | |
− | + | | 36 | |
− | + | | None | |
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | <code>minecraft.fill_cauldron</code> |
− | + | | 37 | |
− | + | | None | |
− | |||
− | |||
− | | | ||
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | <code>minecraft.use_cauldron</code> |
− | + | | 38 | |
− | + | | None | |
− | |||
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | <code>minecraft.clean_armor</code> |
− | | | + | | 39 |
− | | | + | | None |
− | | | + | |- |
− | + | | <code>minecraft.clean_banner</code> | |
− | + | | 40 | |
− | + | | None | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | <code>minecraft.clean_shulker_box</code> |
− | + | | 41 | |
− | + | | None | |
− | |||
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | <code>minecraft.interact_with_brewingstand</code> |
− | + | | 42 | |
− | + | | None | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | <code>minecraft.interact_with_beacon</code> |
− | + | | 43 | |
− | + | | None | |
− | | | ||
− | |||
− | | | ||
|- | |- | ||
− | | | + | | <code>minecraft.inspect_dropper</code> |
− | | | + | | 44 |
− | | | + | | None |
|- | |- | ||
− | | | + | | <code>minecraft.inspect_hopper</code> |
− | | | + | | 45 |
− | | | + | | None |
|- | |- | ||
− | | | + | | <code>minecraft.inspect_dispenser</code> |
− | + | | 46 | |
− | + | | None | |
− | |||
− | |||
|- | |- | ||
− | | | + | | <code>minecraft.play_noteblock</code> |
− | | | + | | 47 |
− | | | + | | None |
|- | |- | ||
− | | | + | | <code>minecraft.tune_noteblock</code> |
− | | | + | | 48 |
− | | | + | | None |
+ | |- | ||
+ | | <code>minecraft.pot_flower</code> | ||
+ | | 49 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.trigger_trapped_chest</code> | ||
+ | | 50 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.open_enderchest</code> | ||
+ | | 51 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.enchant_item</code> | ||
+ | | 52 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.play_record</code> | ||
+ | | 53 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.interact_with_furnace</code> | ||
+ | | 54 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.interact_with_crafting_table</code> | ||
+ | | 55 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.open_chest</code> | ||
+ | | 56 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.sleep_in_bed</code> | ||
+ | | 57 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.open_shulker_box</code> | ||
+ | | 58 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.open_barrel</code> | ||
+ | | 59 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.interact_with_blast_furnace</code> | ||
+ | | 60 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.interact_with_smoker</code> | ||
+ | | 61 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.interact_with_lectern</code> | ||
+ | | 62 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.interact_with_campfire</code> | ||
+ | | 63 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.interact_with_cartography_table</code> | ||
+ | | 64 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.interact_with_loom</code> | ||
+ | | 65 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.interact_with_stonecutter</code> | ||
+ | | 66 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.bell_ring</code> | ||
+ | | 67 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.raid_trigger</code> | ||
+ | | 68 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.raid_win</code> | ||
+ | | 69 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.interact_with_anvil</code> | ||
+ | | 70 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.interact_with_grindstone</code> | ||
+ | | 71 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.target_hit</code> | ||
+ | | 72 | ||
+ | | None | ||
+ | |- | ||
+ | | <code>minecraft.interact_with_smithing_table</code> | ||
+ | | 73 | ||
+ | | None | ||
|} | |} | ||
− | + | Units: | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | * None: just a normal number (formatted with 0 decimal places) | |
+ | * Damage: value is 10 times the normal amount | ||
+ | * Distance: a distance in centimeters (hundredths of blocks) | ||
+ | * Time: a time span in ticks | ||
− | + | ==== Acknowledge Block Change ==== | |
{| class="wikitable" | {| class="wikitable" | ||
Line 1,117: | Line 1,170: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="4"| 0x05 |
− | |rowspan=" | + | |rowspan="4"| Play |
− | |rowspan=" | + | |rowspan="4"| Client |
− | | | + | | Sequence ID |
− | | | + | | VarInt |
− | | | + | | Represents the sequence to acknowledge, this is used for properly syncing block changes to the client after interactions. |
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | |||
− | |||
− | |||
|} | |} | ||
− | |||
− | + | ==== Set Block Destroy Stage ==== | |
− | + | 0–9 are the displayable destroy stages and each other number means that there is no animation on this coordinate. | |
+ | |||
+ | Block break animations can still be applied on air; the animation will remain visible although there is no block being broken. However, if this is applied to a transparent block, odd graphical effects may happen, including water losing its transparency. (An effect similar to this can be seen in normal gameplay when breaking ice blocks) | ||
+ | |||
+ | If you need to display several break animations at the same time you have to give each of them a unique Entity ID. The entity ID does not need to correspond to an actual entity on the client. It is valid to use a randomly generated number. | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 1,147: | Line 1,196: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | | | + | |rowspan="3"| 0x06 |
− | | Play | + | |rowspan="3"| Play |
− | | Client | + | |rowspan="3"| Client |
− | | | + | | Entity ID |
− | | | + | | VarInt |
− | | | + | | The ID of the entity breaking the block. |
+ | |- | ||
+ | | Location | ||
+ | | Position | ||
+ | | Block Position. | ||
+ | |- | ||
+ | | Destroy Stage | ||
+ | | Byte | ||
+ | | 0–9 to set it, any other value to remove it. | ||
|} | |} | ||
− | ==== | + | ==== Block Entity Data ==== |
− | + | Sets the block entity associated with the block at the given location. | |
{| class="wikitable" | {| class="wikitable" | ||
Line 1,167: | Line 1,224: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="3"| 0x07 |
− | |rowspan=" | + | |rowspan="3"| Play |
− | |rowspan=" | + | |rowspan="3"| Client |
− | | | + | | Location |
− | | | + | | Position |
− | | | + | | |
|- | |- | ||
− | | | + | | Type |
− | | | + | | VarInt |
− | | The | + | | The type of the block entity |
|- | |- | ||
− | | | + | | NBT Data |
− | | [[ | + | | [[NBT|NBT Tag]] |
− | | | + | | Data to set. May be a TAG_END (0), in which case the block entity at the given location is removed (though this is not required since the client will remove the block entity automatically on chunk unload or block removal). |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
− | + | ==== Block Action ==== | |
+ | |||
+ | This packet is used for a number of actions and animations performed by blocks, usually non-persistent. The client ignores the provided block type and instead uses the block state in their world. | ||
− | + | See [[Block Actions]] for a list of values. | |
− | [[ | ||
− | + | {{Warning2|This packet uses a block ID, not a block state.}} | |
{| class="wikitable" | {| class="wikitable" | ||
Line 1,206: | Line 1,256: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="4"| 0x08 |
− | |rowspan=" | + | |rowspan="4"| Play |
− | |rowspan=" | + | |rowspan="4"| Client |
− | | | + | | Location |
+ | | Position | ||
+ | | Block coordinates. | ||
+ | |- | ||
+ | | Action ID (Byte 1) | ||
| Unsigned Byte | | Unsigned Byte | ||
− | | | + | | Varies depending on block — see [[Block Actions]]. |
|- | |- | ||
− | | | + | | Action Parameter (Byte 2) |
− | | | + | | Unsigned Byte |
− | | | + | | Varies depending on block — see [[Block Actions]]. |
|- | |- | ||
− | | | + | | Block Type |
− | | | + | | VarInt |
− | | | + | | The block type ID for the block. This must match the block at the given coordinates. |
|} | |} | ||
− | |||
− | ==== | + | ==== Block Update ==== |
+ | |||
+ | Fired whenever a block is changed within the render distance. | ||
− | + | {{Warning2|Changing a block in a chunk that is not loaded is not a stable action. The Notchian client currently uses a ''shared'' empty chunk which is modified for all block changes in unloaded chunks; while in 1.9 this chunk never renders in older versions the changed block will appear in all copies of the empty chunk. Servers should avoid sending block changes in unloaded chunks and clients should ignore such packets.}} | |
{| class="wikitable" | {| class="wikitable" | ||
Line 1,236: | Line 1,291: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="2"| 0x09 |
− | |rowspan=" | + | |rowspan="2"| Play |
− | |rowspan=" | + | |rowspan="2"| Client |
− | | | + | | Location |
− | | | + | | Position |
− | | | + | | Block Coordinates. |
|- | |- | ||
− | | | + | | Block ID |
− | | | + | | VarInt |
− | | The | + | | The new block state ID for the block as given in the {{Minecraft Wiki|Data values#Block IDs|global palette}}. See that section for more information. |
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
− | + | ==== Boss Bar ==== | |
{| class="wikitable" | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | !colspan="2"| Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
|- | |- | ||
− | + | |rowspan="14"| 0x0A | |
− | + | |rowspan="14"| Play | |
− | + | |rowspan="14"| Client | |
+ | |colspan="2"| UUID | ||
+ | | UUID | ||
+ | | Unique ID for this bar. | ||
|- | |- | ||
− | | | + | |colspan="2"| Action |
− | | | + | | VarInt Enum |
− | | | + | | Determines the layout of the remaining packet. |
|- | |- | ||
− | + | ! Action | |
− | + | ! Field Name | |
+ | ! | ||
+ | ! | ||
|- | |- | ||
− | | | + | |rowspan="5"| 0: add |
− | | | + | | Title |
+ | | [[Chat]] | ||
+ | | | ||
|- | |- | ||
− | | | + | | Health |
− | | | + | | Float |
+ | | From 0 to 1. Values greater than 1 do not crash a Notchian client, and start [https://i.johni0702.de/nA.png rendering part of a second health bar] at around 1.5. | ||
|- | |- | ||
− | | | + | | Color |
− | | | + | | VarInt Enum |
− | | | + | | Color ID (see below). |
|- | |- | ||
− | | | + | | Division |
+ | | VarInt Enum | ||
+ | | Type of division (see below). | ||
|- | |- | ||
− | | | + | | Flags |
+ | | Unsigned Byte | ||
+ | | Bit mask. 0x1: should darken sky, 0x2: is dragon bar (used to play end music), 0x04: create fog (previously was also controlled by 0x02). | ||
|- | |- | ||
− | | | + | | 1: remove |
− | | | + | | ''no fields'' |
+ | | ''no fields'' | ||
+ | | Removes this boss bar. | ||
|- | |- | ||
− | | | + | | 2: update health |
− | | | + | | Health |
+ | | Float | ||
+ | | ''as above'' | ||
|- | |- | ||
− | | | + | | 3: update title |
+ | | Title | ||
+ | | [[Chat]] | ||
+ | | | ||
|- | |- | ||
− | | | + | |rowspan="2"| 4: update style |
+ | | Color | ||
+ | | VarInt Enum | ||
+ | | Color ID (see below). | ||
+ | |- | ||
+ | | Dividers | ||
+ | | VarInt Enum | ||
+ | | ''as above'' | ||
+ | |- | ||
+ | | 5: update flags | ||
+ | | Flags | ||
+ | | Unsigned Byte | ||
+ | | ''as above'' | ||
|- | |- | ||
− | | | + | |} |
− | + | ||
+ | {| class="wikitable" | ||
+ | ! ID | ||
+ | ! Color | ||
|- | |- | ||
− | | | + | | 0 |
+ | | Pink | ||
|- | |- | ||
− | | | + | | 1 |
+ | | Blue | ||
|- | |- | ||
− | | | + | | 2 |
− | + | | Red | |
− | | | ||
|- | |- | ||
− | | | + | | 3 |
− | | | + | | Green |
|- | |- | ||
− | | | + | | 4 |
− | | | + | | Yellow |
|- | |- | ||
− | | | + | | 5 |
− | | | + | | Purple |
− | |||
|- | |- | ||
− | | | + | | 6 |
− | | | + | | White |
− | |||
|} | |} | ||
− | ==== | + | {| class="wikitable" |
− | + | ! ID | |
− | + | ! Type of division | |
+ | |- | ||
+ | | 0 | ||
+ | | No division | ||
+ | |- | ||
+ | | 1 | ||
+ | | 6 notches | ||
+ | |- | ||
+ | | 2 | ||
+ | | 10 notches | ||
+ | |- | ||
+ | | 3 | ||
+ | | 12 notches | ||
+ | |- | ||
+ | | 4 | ||
+ | | 20 notches | ||
+ | |} | ||
+ | |||
+ | ==== Change Difficulty ==== | ||
+ | |||
+ | Changes the difficulty setting in the client's option menu | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 1,329: | Line 1,439: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="2"| 0x0B |
− | |rowspan=" | + | |rowspan="2"| Play |
− | |rowspan=" | + | |rowspan="2"| Client |
− | | | + | | Difficulty |
− | | Byte | + | | Unsigned Byte |
− | | | + | | 0: peaceful, 1: easy, 2: normal, 3: hard. |
|- | |- | ||
− | | | + | | Difficulty locked? |
− | | | + | | Boolean |
− | + | | | |
− | |||
− | |||
− | |||
− | | | ||
|} | |} | ||
− | + | ==== Chat Preview (clientbound) ==== | |
− | + | Sets the message to preview on the client. | |
− | |||
− | |||
− | |||
− | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 1,361: | Line 1,463: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="3"| 0x0C |
− | |rowspan=" | + | |rowspan="3"| Play |
− | |rowspan=" | + | |rowspan="3"| Client |
− | | | + | | Query ID |
− | | | + | | Integer |
− | | | + | | |
+ | |- | ||
+ | | Component is Present | ||
+ | | Boolean | ||
+ | | | ||
|- | |- | ||
− | | | + | | Message to Preview |
− | | | + | | Component |
− | | | + | | |
|} | |} | ||
− | ==== | + | ==== Clear Titles ==== |
− | |||
− | |||
− | |||
− | |||
− | + | Clear the client's current title information, with the option to also reset it. | |
{| class="wikitable" | {| class="wikitable" | ||
Line 1,389: | Line 1,491: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="1"| 0x0D |
− | |rowspan=" | + | |rowspan="1"| Play |
− | |rowspan=" | + | |rowspan="1"| Client |
− | | | + | | Reset |
− | | | + | | Boolean |
− | | | + | | |
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
− | ==== | + | ==== Command Suggestions Response ==== |
− | |||
− | + | The server responds with a list of auto-completions of the last word sent to it. In the case of regular chat, this is a player username. Command names and parameters are also supported. The client sorts these alphabetically before listing them. | |
{| class="wikitable" | {| class="wikitable" | ||
Line 1,410: | Line 1,507: | ||
! State | ! State | ||
! Bound To | ! Bound To | ||
− | ! Field Name | + | !colspan="2"| Field Name |
− | ! Field Type | + | !colspan="2"| Field Type |
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="8"| 0x0E |
− | |rowspan=" | + | |rowspan="8"| Play |
− | |rowspan=" | + | |rowspan="8"| Client |
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | |colspan="2"| ID |
− | | VarInt | + | |colspan="2"| VarInt |
− | | | + | | Transaction ID. |
|- | |- | ||
− | | | + | |colspan="2"| Start |
− | | | + | |colspan="2"| VarInt |
− | | | + | | Start of the text to replace. |
+ | |- | ||
+ | |colspan="2"| Length | ||
+ | |colspan="2"| VarInt | ||
+ | | Length of the text to replace. | ||
|- | |- | ||
− | | | + | |colspan="2"| Count |
− | | | + | |colspan="2"| VarInt |
− | | | + | | Number of elements in the following array. |
|- | |- | ||
− | | | + | |rowspan="3"| Matches |
− | | | + | | Match |
− | | | + | |rowspan="3"| Array |
+ | | String (32767) | ||
+ | | One eligible value to insert, note that each command is sent separately instead of in a single string, hence the need for Count. Note that for instance this doesn't include a leading <code>/</code> on commands. | ||
|- | |- | ||
− | | | + | | Has tooltip |
− | | | + | | Boolean |
− | | | + | | True if the following is present. |
|- | |- | ||
− | | | + | | Tooltip |
− | | | + | | Optional [[Chat]] |
− | | | + | | Tooltip to display; only present if previous boolean is true. |
|} | |} | ||
− | ==== | + | ==== Commands ==== |
+ | |||
+ | Lists all of the commands on the server, and how they are parsed. | ||
− | + | This is a directed graph, with one root node. Each redirect or child node must refer only to nodes that have already been declared. | |
{| class="wikitable" | {| class="wikitable" | ||
Line 1,458: | Line 1,560: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | | | + | |rowspan="3"| 0x0F |
− | | Play | + | |rowspan="3"| Play |
− | | Client | + | |rowspan="3"| Client |
− | | | + | | Count |
− | | [[ | + | | VarInt |
− | | | + | | Number of elements in the following array. |
+ | |- | ||
+ | | Nodes | ||
+ | | Array of [[Command Data|Node]] | ||
+ | | An array of nodes. | ||
+ | |- | ||
+ | | Root index | ||
+ | | VarInt | ||
+ | | Index of the <code>root</code> node in the previous array. | ||
|} | |} | ||
− | ==== | + | For more information on this packet, see the [[Command Data]] article. |
+ | |||
+ | ==== Close Container (clientbound) ==== | ||
− | + | This packet is sent from the server to the client when a window is forcibly closed, such as when a chest is destroyed while it's open. The notchian client disregards the provided window ID and closes any active window. | |
{| class="wikitable" | {| class="wikitable" | ||
Line 1,478: | Line 1,590: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | | | + | | 0x10 |
− | + | | Play | |
− | + | | Client | |
− | | | + | | Window ID |
− | | | + | | Unsigned Byte |
− | + | | This is the ID of the window that was closed. 0 for inventory. | |
− | |||
− | |||
− | |||
− | | | ||
|} | |} | ||
− | + | ==== Set Container Content ==== | |
− | + | [[File:Inventory-slots.png|thumb|The inventory slots]] | |
− | ==== | ||
− | |||
− | |||
− | + | Sent by the server when items in multiple slots (in a window) are added/removed. This includes the main inventory, equipped armour and crafting slots. This packet with Window ID set to "0" is sent during the player joining sequence to initialise the player's inventory. | |
{| class="wikitable" | {| class="wikitable" | ||
Line 1,506: | Line 1,611: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="5"| 0x11 |
− | |rowspan=" | + | |rowspan="5"| Play |
− | |rowspan=" | + | |rowspan="5"| Client |
− | | | + | | Window ID |
− | | | + | | Unsigned Byte |
− | | | + | | The ID of window which items are being sent for. 0 for player inventory. |
|- | |- | ||
− | | | + | | State ID |
− | | | + | | VarInt |
− | | | + | | The last received State ID from either a [[#Set Container Slot|Set Container Slot]] or a [[#Set Container Content|Set Container Content]] packet |
|- | |- | ||
− | | | + | | Count |
− | | | + | | VarInt |
− | | | + | | Number of elements in the following array. |
|- | |- | ||
− | | | + | | Slot Data |
− | | | + | | Array of [[Slot Data|Slot]] |
− | |||
|- | |- | ||
− | | | + | | Carried Item |
− | | | + | | [[Slot Data|Slot]] |
− | + | | Item held by player. | |
− | |||
− | |||
− | |||
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
− | + | See [[Inventory#Windows|inventory windows]] for further information about how slots are indexed. | |
− | + | ==== Set Container Property ==== | |
− | + | This packet is used to inform the client that part of a GUI window should be updated. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 1,584: | Line 1,648: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="3"| 0x12 |
− | |rowspan=" | + | |rowspan="3"| Play |
− | |rowspan=" | + | |rowspan="3"| Client |
− | | | + | | Window ID |
| Unsigned Byte | | Unsigned Byte | ||
− | | | + | | |
+ | |- | ||
+ | | Property | ||
+ | | Short | ||
+ | | The property to be updated, see below. | ||
|- | |- | ||
| Value | | Value | ||
− | | | + | | Short |
− | | | + | | The new value for the property, see below. |
|} | |} | ||
− | + | The meaning of the Property field depends on the type of the window. The following table shows the known combinations of window type and property, and how the value is to be interpreted. | |
{| class="wikitable" | {| class="wikitable" | ||
− | ! | + | |- |
− | ! | + | ! Window type |
+ | ! Property | ||
! Value | ! Value | ||
|- | |- | ||
− | | | + | |rowspan="4"| Furnace |
− | | | + | | 0: Fire icon (fuel left) |
− | | | + | | counting from fuel burn time down to 0 (in-game ticks) |
|- | |- | ||
− | | 1 | + | | 1: Maximum fuel burn time |
− | | | + | | fuel burn time or 0 (in-game ticks) |
− | | | + | |- |
+ | | 2: Progress arrow | ||
+ | | counting from 0 to maximum progress (in-game ticks) | ||
+ | |- | ||
+ | | 3: Maximum progress | ||
+ | | always 200 on the notchian server | ||
|- | |- | ||
− | | | + | |rowspan="10"| Enchantment Table |
− | | | + | | 0: Level requirement for top enchantment slot |
− | | | + | |rowspan="3"| The enchantment's xp level requirement |
|- | |- | ||
− | | | + | | 1: Level requirement for middle enchantment slot |
− | |||
− | |||
|- | |- | ||
− | | | + | | 2: Level requirement for bottom enchantment slot |
− | |||
− | |||
|- | |- | ||
− | | | + | | 3: The enchantment seed |
− | | | + | | Used for drawing the enchantment names (in [[Wikipedia:Standard Galactic Alphabet|SGA]]) clientside. The same seed ''is'' used to calculate enchantments, but some of the data isn't sent to the client to prevent easily guessing the entire list (the seed value here is the regular seed bitwise and <code>0xFFFFFFF0</code>). |
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | 4: Enchantment ID shown on mouse hover over top enchantment slot |
− | | | + | |rowspan="3"| The enchantment id (set to -1 to hide it), see below for values |
− | |||
|- | |- | ||
− | | | + | | 5: Enchantment ID shown on mouse hover over middle enchantment slot |
− | |||
− | |||
|- | |- | ||
− | | | + | | 6: Enchantment ID shown on mouse hover over bottom enchantment slot |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | 7: Enchantment level shown on mouse hover over the top slot |
− | |rowspan=" | + | |rowspan="3"| The enchantment level (1 = I, 2 = II, 6 = VI, etc.), or -1 if no enchant |
− | + | |- | |
− | | | + | | 8: Enchantment level shown on mouse hover over the middle slot |
− | | | + | |- |
− | | | + | | 9: Enchantment level shown on mouse hover over the bottom slot |
− | | | + | |- |
− | + | |rowspan="3"| Beacon | |
− | + | | 0: Power level | |
− | + | | 0-4, controls what effect buttons are enabled | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | 1: First potion effect |
− | | | + | | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the first effect, or -1 if no effect |
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | 2: Second potion effect |
− | | | + | | {{Minecraft Wiki|Data values#Status effects|Potion effect ID}} for the second effect, or -1 if no effect |
− | |||
|- | |- | ||
− | | | + | | Anvil |
− | | | + | | 0: Repair cost |
− | | | + | | The repair's cost in xp levels |
|- | |- | ||
− | | | + | |rowspan="2"| Brewing Stand |
− | | | + | | 0: Brew time |
− | | | + | | 0 – 400, with 400 making the arrow empty, and 0 making the arrow full |
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | 1: Fuel time |
− | | | + | | 0 - 20, with 0 making the arrow empty, and 20 making the arrow full |
− | |||
|- | |- | ||
− | | | + | | Stonecutter |
− | | | + | | 0: Selected recipe |
− | | | + | | The index of the selected recipe. -1 means none is selected. |
|- | |- | ||
− | | | + | | Loom |
− | | | + | | 0: Selected pattern |
− | | | + | | The index of the selected pattern. 0 means none is selected, 0 is also the internal id of the "base" pattern. |
|- | |- | ||
− | | | + | | Lectern |
− | | | + | | 0: Page number |
− | | | + | | The current page number, starting from 0. |
|} | |} | ||
− | + | For an enchanting table, the following numerical IDs are used: | |
− | |||
− | |||
− | |||
− | |||
{| class="wikitable" | {| class="wikitable" | ||
− | ! | + | ! Numerical ID |
− | ! | + | ! Enchantment ID |
− | ! | + | ! Enchantment Name |
− | + | |- | |
− | + | | 0 | |
− | + | | minecraft:protection | |
+ | | Protection | ||
|- | |- | ||
− | | | + | | 1 |
− | + | | minecraft:fire_protection | |
− | + | | Fire Protection | |
− | |||
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | 2 |
− | | | + | | minecraft:feather_falling |
− | | | + | | Feather Falling |
|- | |- | ||
− | | | + | | 3 |
− | | | + | | minecraft:blast_protection |
− | | | + | | Blast Protection |
|- | |- | ||
− | | | + | | 4 |
− | | | + | | minecraft:projectile_protection |
− | + | | Projectile Protection | |
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | + | | 5 | |
+ | | minecraft:respiration | ||
+ | | Respiration | ||
|- | |- | ||
− | | | + | | 6 |
− | | | + | | minecraft:aqua_affinity |
− | | | + | | Aqua Affinity |
|- | |- | ||
− | | | + | | 7 |
− | | | + | | minecraft:thorns |
− | | | + | | Thorns |
|- | |- | ||
− | | | + | | 8 |
− | | | + | | minecraft:depth_strider |
− | | | + | | Depth Strider |
|- | |- | ||
− | | | + | | 9 |
− | | | + | | minecraft:frost_walker |
− | | | + | | Frost Walker |
|- | |- | ||
− | | | + | | 10 |
− | | | + | | minecraft:binding_curse |
− | | | + | | Curse of Binding |
|- | |- | ||
− | | | + | | 11 |
− | | | + | | minecraft:soul_speed |
− | | | + | | Soul Speed |
|- | |- | ||
− | | | + | | 12 |
− | | | + | | minecraft:sharpness |
− | | | + | | Sharpness |
|- | |- | ||
− | | | + | | 13 |
− | | | + | | minecraft:smite |
− | | | + | | Smite |
|- | |- | ||
− | | | + | | 14 |
− | | | + | | minecraft:bane_of_arthropods |
− | | | + | | Bane of Arthropods |
|- | |- | ||
− | | | + | | 15 |
− | | | + | | minecraft:knockback |
− | | | + | | Knockback |
|- | |- | ||
− | | | + | | 16 |
− | | | + | | minecraft:fire_aspect |
− | | | + | | Fire Aspect |
|- | |- | ||
− | | | + | | 17 |
− | | | + | | minecraft:looting |
− | | | + | | Looting |
|- | |- | ||
− | | | + | | 18 |
− | | | + | | minecraft:sweeping |
− | | | + | | Sweeping Edge |
|- | |- | ||
− | | | + | | 19 |
− | | | + | | minecraft:efficiency |
− | | | + | | Efficiency |
|- | |- | ||
− | | | + | | 20 |
− | | | + | | minecraft:silk_touch |
− | | | + | | Silk Touch |
|- | |- | ||
− | | | + | | 21 |
− | | | + | | minecraft:unbreaking |
− | | | + | | Unbreaking |
|- | |- | ||
− | | | + | | 22 |
− | | | + | | minecraft:fortune |
− | | | + | | Fortune |
|- | |- | ||
− | | | + | | 23 |
− | | | + | | minecraft:power |
− | | | + | | Power |
|- | |- | ||
− | | | + | | 24 |
− | | | + | | minecraft:punch |
− | | | + | | Punch |
|- | |- | ||
− | | | + | | 25 |
− | | | + | | minecraft:flame |
− | | | + | | Flame |
|- | |- | ||
− | | | + | | 26 |
− | | | + | | minecraft:infinity |
− | | | + | | Infinity |
|- | |- | ||
− | | | + | | 27 |
− | | | + | | minecraft:luck_of_the_sea |
− | | | + | | Luck of the Sea |
|- | |- | ||
− | | | + | | 28 |
− | | | + | | minecraft:lure |
− | | | + | | Lure |
|- | |- | ||
− | | | + | | 29 |
− | | | + | | minecraft:loyalty |
− | | | + | | Loyalty |
|- | |- | ||
− | | | + | | 30 |
− | | | + | | minecraft:impaling |
− | | | + | | Impaling |
|- | |- | ||
− | | | + | | 31 |
− | | | + | | minecraft:riptide |
− | | | + | | Riptide |
|- | |- | ||
− | | | + | | 32 |
− | | | + | | minecraft:channeling |
− | | | + | | Channeling |
|- | |- | ||
− | | | + | | 33 |
− | | | + | | minecraft:multishot |
− | | | + | | Multishot |
|- | |- | ||
− | | | + | | 34 |
− | | | + | | minecraft:quick_charge |
− | | | + | | Quick Charge |
|- | |- | ||
− | | | + | | 35 |
− | | | + | | minecraft:piercing |
− | | | + | | Piercing |
|- | |- | ||
− | | | + | | 36 |
− | | | + | | minecraft:mending |
− | | | + | | Mending |
|- | |- | ||
− | | | + | | 37 |
− | | | + | | minecraft:vanishing_curse |
− | | | + | | Curse of Vanishing |
− | | | + | |} |
− | + | ||
− | + | ==== Set Container Slot ==== | |
− | + | ||
+ | Sent by the server when an item in a slot (in a window) is added/removed. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
|- | |- | ||
− | | | + | |rowspan="4"| 0x13 |
− | | | + | |rowspan="4"| Play |
− | | | + | |rowspan="4"| Client |
+ | | Window ID | ||
+ | | Byte | ||
+ | | The window which is being updated. 0 for player inventory. Note that all known window types include the player inventory. This packet will only be sent for the currently opened window while the player is performing actions, even if it affects the player inventory. After the window is closed, a number of these packets are sent to update the player's inventory window (0). | ||
|- | |- | ||
− | | | + | | State ID |
− | | | + | | VarInt |
− | | | + | | The last received State ID from either a [[#Set Container Slot|Set Container Slot]] or a [[#Set Container Content|Set Container Content]] packet |
|- | |- | ||
− | | | + | | Slot |
− | | | + | | Short |
− | | | + | | The slot that should be updated. |
|- | |- | ||
− | | | + | | Slot Data |
− | | | + | | [[Slot Data|Slot]] |
− | |||
− | |||
− | |||
− | |||
| | | | ||
+ | |} | ||
+ | |||
+ | To set the cursor (the item currently dragged with the mouse), use -1 as Window ID and as Slot. | ||
+ | |||
+ | This packet can only be used to edit the hotbar of the player's inventory if window ID is set to 0 (slots 36 through 45) if the player is in creative, with their inventory open, and not in their survival inventory tab. Otherwise, when window ID is 0, it can edit any slot in the player's inventory. If the window ID is set to -2, then any slot in the inventory can be used but no add item animation will be played. | ||
+ | |||
+ | ==== Set Cooldown ==== | ||
+ | |||
+ | Applies a cooldown period to all items with the given type. Used by the Notchian server with enderpearls. This packet should be sent when the cooldown starts and also when the cooldown ends (to compensate for lag), although the client will end the cooldown automatically. Can be applied to any item, note that interactions still get sent to the server with the item but the client does not play the animation nor attempt to predict results (i.e block placing). | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
|- | |- | ||
− | + | |rowspan="2"| 0x14 | |
− | | | + | |rowspan="2"| Play |
− | + | |rowspan="2"| Client | |
− | | | + | | Item ID |
− | + | | VarInt | |
− | | | + | | Numeric ID of the item to apply a cooldown to. |
− | | | ||
− | | | ||
− | |||
|- | |- | ||
− | | | + | | Cooldown Ticks |
− | | | + | | VarInt |
− | | | + | | Number of ticks to apply a cooldown for, or 0 to clear the cooldown. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
− | + | ==== Plugin Message (clientbound) ==== | |
+ | |||
+ | {{Main|Plugin channels}} | ||
+ | |||
+ | Mods and plugins can use this to send their data. Minecraft itself uses several [[plugin channel]]s. These internal channels are in the <code>minecraft</code> namespace. | ||
+ | |||
+ | More information on how it works on [https://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/ Dinnerbone's blog]. More documentation about internal and popular registered channels are [[plugin channel|here]]. | ||
{| class="wikitable" | {| class="wikitable" | ||
− | ! ID | + | ! Packet ID |
− | ! | + | ! State |
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
|- | |- | ||
− | | | + | |rowspan="2"| 0x15 |
− | | | + | |rowspan="2"| Play |
+ | |rowspan="2"| Client | ||
+ | | Channel | ||
+ | | Identifier | ||
+ | | Name of the [[plugin channel]] used to send the data. | ||
|- | |- | ||
− | | | + | | Data |
− | | | + | | Byte Array |
− | | | + | | Any data. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
− | ==== | + | In notchian client/server implementation, when sending data, data size is capped at 32767 bytes when server-bound and 1048576 bytes when client-bound. Though nothing prevents the server and client from reading larger data. |
+ | |||
+ | ==== Custom Sound Effect ==== | ||
+ | {{See also|#Sound}} | ||
− | + | Used to play a sound effect on the client. Custom sounds may be added by resource packs. | |
{| class="wikitable" | {| class="wikitable" | ||
Line 1,997: | Line 2,007: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="8"| 0x16 |
− | |rowspan=" | + | |rowspan="8"| Play |
− | |rowspan=" | + | |rowspan="8"| Client |
− | | | + | | Sound Name |
+ | | Identifier | ||
+ | | All sound effect names can be seen [https://pokechu22.github.io/Burger/1.19.html#sounds here]. | ||
+ | |- | ||
+ | | Sound Category | ||
+ | | VarInt Enum | ||
+ | | The category that this sound will be played from ([https://gist.github.com/konwboj/7c0c380d3923443e9d55 current categories]). | ||
+ | |- | ||
+ | | Effect Position X | ||
| Int | | Int | ||
− | | | + | | Effect X multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part). |
|- | |- | ||
− | | | + | | Effect Position Y |
− | | | + | | Int |
− | | | + | | Effect Y multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part). |
|- | |- | ||
− | | | + | | Effect Position Z |
− | | | + | | Int |
− | | | + | | Effect Z multiplied by 8 ([[Data types#Fixed-point numbers|fixed-point number]] with only 3 bits dedicated to the fractional part). |
|- | |- | ||
− | | | + | | Volume |
| Float | | Float | ||
− | | | + | | 1 is 100%, can be more. |
|- | |- | ||
− | | | + | | Pitch |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
| Float | | Float | ||
− | | | + | | Float between 0.5 and 2.0 by Notchian clients. |
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | Seed |
− | | | + | | long |
− | | | + | | Seed used to pick sound variant. |
|} | |} | ||
− | + | ==== Disconnect (play) ==== | |
+ | |||
+ | Sent by the server before it disconnects a client. The client assumes that the server has already closed the connection by the time the packet arrives. | ||
{| class="wikitable" | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
|- | |- | ||
− | + | | 0x17 | |
− | + | | Play | |
− | | | + | | Client |
− | | | + | | Reason |
− | | | + | | [[Chat]] |
− | | | + | | Displayed to the client when the connection terminates. |
− | | | + | |} |
− | | | + | |
+ | ==== Entity Event ==== | ||
+ | |||
+ | Entity statuses generally trigger an animation for an entity. The available statuses vary by the entity's type (and are available to subclasses of that type as well). | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
|- | |- | ||
− | | | + | |rowspan="2"| 0x18 |
− | | 2 | + | |rowspan="2"| Play |
+ | |rowspan="2"| Client | ||
+ | | Entity ID | ||
+ | | Int | ||
+ | | | ||
|- | |- | ||
− | | | + | | Entity Status |
− | | | + | | Byte Enum |
+ | | See [[Entity statuses]] for a list of which statuses are valid for each type of entity. | ||
+ | |} | ||
+ | |||
+ | ==== Explosion ==== | ||
+ | |||
+ | Sent when an explosion occurs (creepers, TNT, and ghast fireballs). | ||
+ | |||
+ | Each block in Records is set to air. Coordinates for each axis in record is int(X) + record.x | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
|- | |- | ||
− | | | + | |rowspan="9"| 0x19 |
− | | | + | |rowspan="9"| Play |
+ | |rowspan="9"| Client | ||
+ | | X | ||
+ | | Double | ||
+ | | | ||
|- | |- | ||
− | | | + | | Y |
− | | | + | | Double |
+ | | | ||
|- | |- | ||
− | | | + | | Z |
− | | | + | | Double |
+ | | | ||
|- | |- | ||
− | | | + | | Strength |
− | | | + | | Float |
+ | | A strength greater than or equal to 2.0 spawns a <code>minecraft:explosion_emitter</code> particle, while a lesser strength spawns a <code>minecraft:explosion</code> particle. | ||
|- | |- | ||
− | | | + | | Record Count |
− | | | + | | VarInt |
+ | | Number of elements in the following array. | ||
|- | |- | ||
− | | | + | | Records |
− | | | + | | Array of (Byte, Byte, Byte) |
+ | | Each record is 3 signed bytes long; the 3 bytes are the XYZ (respectively) signed offsets of affected blocks. | ||
|- | |- | ||
− | | | + | | Player Motion X |
− | | | + | | Float |
+ | | X velocity of the player being pushed by the explosion. | ||
|- | |- | ||
− | | | + | | Player Motion Y |
− | | | + | | Float |
+ | | Y velocity of the player being pushed by the explosion. | ||
|- | |- | ||
− | | | + | | Player Motion Z |
− | | | + | | Float |
+ | | Z velocity of the player being pushed by the explosion. | ||
+ | |} | ||
+ | |||
+ | ==== Unload Chunk ==== | ||
+ | |||
+ | Tells the client to unload a chunk column. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
|- | |- | ||
− | | | + | |rowspan="2"| 0x1A |
− | | | + | |rowspan="2"| Play |
+ | |rowspan="2"| Client | ||
+ | | Chunk X | ||
+ | | Int | ||
+ | | Block coordinate divided by 16, rounded down. | ||
|- | |- | ||
− | | | + | | Chunk Z |
− | | | + | | Int |
− | | | + | | Block coordinate divided by 16, rounded down. |
− | | | + | |} |
− | + | ||
+ | It is legal to send this packet even if the given chunk is not currently loaded. | ||
+ | |||
+ | ==== Game Event ==== | ||
+ | |||
+ | Used for a wide variety of game events, from weather to bed use to gamemode to demo messages. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
|- | |- | ||
− | | | + | |rowspan="2"| 0x1B |
− | | | + | |rowspan="2"| Play |
+ | |rowspan="2"| Client | ||
+ | | Event | ||
+ | | Unsigned Byte | ||
+ | | See below. | ||
|- | |- | ||
− | | | + | | Value |
− | | | + | | Float |
+ | | Depends on Reason. | ||
+ | |} | ||
+ | |||
+ | ''Events'': | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Event | ||
+ | ! Effect | ||
+ | ! Value | ||
|- | |- | ||
− | | | + | | 0 |
− | | | + | | No respawn block available |
+ | | Note: Sends message 'block.minecraft.spawn.not_valid'(You have no home bed or charged respawn anchor, or it was obstructed) to the client. | ||
|- | |- | ||
− | | | + | | 1 |
− | | | + | | End raining |
+ | | | ||
|- | |- | ||
− | | | + | | 2 |
− | | | + | | Begin raining |
+ | | | ||
|- | |- | ||
− | | | + | | 3 |
− | | | + | | Change gamemode |
+ | | 0: Survival, 1: Creative, 2: Adventure, 3: Spectator. | ||
|- | |- | ||
− | | | + | | 4 |
− | | | + | | Win game |
+ | | 0: Just respawn player. <br>1: Roll the credits and respawn player. <br> Note that 1 is only sent by notchian server when player has not yet achieved advancement "The end?", else 0 is sent. | ||
|- | |- | ||
− | | | + | | 5 |
− | | | + | | Demo event |
+ | | 0: Show welcome to demo screen<br> 101: Tell movement controls<br> 102: Tell jump control<br> 103: Tell inventory control<br> 104: Tell that the demo is over and print a message about how to take a screenshot. | ||
|- | |- | ||
− | | | + | | 6 |
− | | | + | | Arrow hit player |
+ | | Note: Sent when any player is struck by an arrow. | ||
|- | |- | ||
− | | | + | | 7 |
− | | | + | | Rain level change |
+ | | Note: Seems to change both skycolor and lightning.<br>Rain level starting from 0 to 1. | ||
|- | |- | ||
− | | | + | | 8 |
− | | | + | | Thunder level change |
+ | | Note: Seems to change both skycolor and lightning (same as Rain level change, but doesn't start rain). It also requires rain to render by notchian client.<br>Thunder level starting from 0 to 1. | ||
|- | |- | ||
− | | | + | | 9 |
− | | | + | | Play pufferfish sting sound. |
|- | |- | ||
− | | | + | | 10 |
− | | | + | | Play elder guardian mob appearance (effect and sound). |
+ | | | ||
|- | |- | ||
− | | | + | | 11 |
− | | | + | | Enable respawn screen |
− | | | + | | 0: Enable respawn screen, 1: Immediately respawn (sent when the doImmediateRespawn gamerule changes). |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
− | ==== | + | ==== Open Horse Screen ==== |
− | + | This packet is used exclusively for opening the horse GUI. [[#Open Screen|Open Screen]] is used for all other GUIs. The client will not open the inventory if the Entity ID does not point to an horse-like animal. | |
{| class="wikitable" | {| class="wikitable" | ||
Line 2,206: | Line 2,258: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="3"| 0x1C |
− | |rowspan=" | + | |rowspan="3"| Play |
− | |rowspan=" | + | |rowspan="3"| Client |
− | | | + | | Window ID |
− | |||
− | |||
− | |||
− | |||
| Unsigned Byte | | Unsigned Byte | ||
− | | | + | | |
|- | |- | ||
− | | | + | | Slot count |
− | | | + | | VarInt |
− | | | + | | |
|- | |- | ||
− | | | + | | Entity ID |
− | | | + | | Integer |
− | | | + | | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
− | ==== | + | ==== Initialize World Border ==== |
− | |||
− | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 2,246: | Line 2,280: | ||
! State | ! State | ||
! Bound To | ! Bound To | ||
− | ! | + | ! Field Name |
− | ! | + | ! Field Type |
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="8"| 0x1D |
− | |rowspan=" | + | |rowspan="8"| Play |
− | |rowspan=" | + | |rowspan="8"| Client |
− | | | + | | X |
− | | | + | | Double |
− | | | + | | |
+ | |- | ||
+ | | Z | ||
+ | | Double | ||
+ | | | ||
|- | |- | ||
− | | | + | | Old Diameter |
− | | | + | | Double |
− | | | + | | Current length of a single side of the world border, in meters. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | New Diameter |
− | + | | Double | |
− | + | | Target length of a single side of the world border, in meters. | |
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | Speed |
− | | | + | | VarLong |
− | | | + | | Number of real-time ''milli''seconds until New Diameter is reached. It appears that Notchian server does not sync world border speed to game ticks, so it gets out of sync with server lag. If the world border is not moving, this is set to 0. |
|- | |- | ||
− | | | + | | Portal Teleport Boundary |
− | | | + | | VarInt |
− | | | + | | Resulting coordinates from a portal teleport are limited to ±value. Usually 29999984. |
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | Warning Blocks |
− | | | + | | VarInt |
− | | | + | | In meters. |
|- | |- | ||
− | | | + | | Warning Time |
− | | | + | | VarInt |
− | | | + | | In seconds as set by <code>/worldborder warning time</code>. |
|- | |- | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
− | + | The Notchian client determines how solid to display the warning by comparing to whichever is higher, the warning distance or whichever is lower, the distance from the current diameter to the target diameter or the place the border will be after warningTime seconds. In pseudocode: | |
− | + | <syntaxhighlight lang="java"> | |
+ | distance = max(min(resizeSpeed * 1000 * warningTime, abs(targetDiameter - currentDiameter)), warningDistance); | ||
+ | if (playerDistance < distance) { | ||
+ | warning = 1.0 - playerDistance / distance; | ||
+ | } else { | ||
+ | warning = 0.0; | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ==== Keep Alive (clientbound) ==== | ||
+ | |||
+ | The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same payload (see [[#Keep Alive (serverbound)|serverbound Keep Alive]]). If the client does not respond to them for over 30 seconds, the server kicks the client. Vice versa, if the server does not send any keep-alives for 20 seconds, the client will disconnect and yields a "Timed out" exception. | ||
+ | |||
+ | The Notchian server uses a system-dependent time in milliseconds to generate the keep alive ID value. | ||
{| class="wikitable" | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
|- | |- | ||
− | ! | + | | 0x1E |
− | ! | + | | Play |
+ | | Client | ||
+ | | Keep Alive ID | ||
+ | | Long | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | ==== Chunk Data and Update Light ==== | ||
+ | {{Main|Chunk Format}} | ||
+ | {{See also|#Unload Chunk}} | ||
+ | |||
+ | {{Need Info|How do biomes work now? The biome change happened at the same time as the seed change, but it's not clear how/if biomes could be computed given that it's not the actual seed... ([https://www.reddit.com/r/Mojira/comments/e5at6i/a_discussion_for_the_changes_to_how_biomes_are/ /r/mojira discussion] which notes that it seems to be some kind of interpolation, and 3D biomes are only used in the nether)}} | ||
+ | |||
+ | The server only sends skylight information for chunk pillars in the {{Minecraft Wiki|Overworld}}, it's up to the client to know in which dimension the player is currently located. You can also infer this information from the primary bitmask and the amount of uncompressed bytes sent. This packet also sends all block entities in the chunk (though sending them is not required; it is still legal to send them with [[#Block Entity Data|Block Entity Data]] later). | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | !colspan="2"| Field Name | ||
+ | !colspan="2"| Field Type | ||
+ | ! Notes | ||
|- | |- | ||
− | | | + | |rowspan="25"| 0x1F |
− | | | + | |rowspan="25"| Play |
+ | |rowspan="25"| Client | ||
+ | |colspan="2"| Chunk X | ||
+ | |colspan="2"| Int | ||
+ | | Chunk coordinate (block coordinate divided by 16, rounded down) | ||
|- | |- | ||
− | | | + | |colspan="2"| Chunk Z |
− | | | + | |colspan="2"| Int |
+ | | Chunk coordinate (block coordinate divided by 16, rounded down) | ||
|- | |- | ||
− | | 2 | + | |colspan="2"| Heightmaps |
− | | | + | |colspan="2"| [[NBT]] |
+ | | Compound containing one long array named <code>MOTION_BLOCKING</code>, which is a heightmap for the highest solid block at each position in the chunk (as a compacted long array with 256 entries, with the number of bits per entry varying depending on the world's height, defined by the formula <code>ceil(log2(height + 1))</code>). The Notchian server also adds a <code>WORLD_SURFACE</code> long array, the purpose of which is unknown, but it's not required for the chunk to be accepted. | ||
+ | |- | ||
+ | |colspan="2"| Size | ||
+ | |colspan="2"| VarInt | ||
+ | | Size of Data in bytes | ||
+ | |- | ||
+ | |colspan="2"| Data | ||
+ | |colspan="2"| Byte array | ||
+ | | See [[Chunk Format#Data structure|data structure]] in Chunk Format | ||
+ | |- | ||
+ | |colspan="2"| Number of block entities | ||
+ | |colspan="2"| VarInt | ||
+ | | Number of elements in the following array | ||
+ | |- | ||
+ | |rowspan="4" | Block Entity | ||
+ | | Packed XZ | ||
+ | |rowspan="4" | Array | ||
+ | | Byte | ||
+ | | The packed section coordinates, calculated from <code><nowiki>((blockX & 15) << 4) | (blockZ & 15)</nowiki></code> | ||
+ | |- | ||
+ | | Y | ||
+ | | Short | ||
+ | | The height relative to the world | ||
+ | |- | ||
+ | | Type | ||
+ | | VarInt | ||
+ | | The type of block entity | ||
+ | |- | ||
+ | | Data | ||
+ | | [[NBT]] | ||
+ | | The block entity's data, without the X, Y, and Z values | ||
+ | |- | ||
+ | |colspan="2"| Trust Edges | ||
+ | |colspan="2"| Boolean | ||
+ | | If edges should be trusted for light updates. | ||
+ | |- | ||
+ | |colspan="2"| Sky Light Mask | ||
+ | |colspan="2"| BitSet | ||
+ | | BitSet containing bits for each section in the world + 2. Each set bit indicates that the corresponding 16×16×16 chunk section has data in the Sky Light array below. The least significant bit is for blocks 16 blocks to 1 block below the min world height (one section below the world), while the most significant bit covers blocks 1 to 16 blocks above the max world height (one section above the world). | ||
+ | |- | ||
+ | |colspan="2"| Block Light Mask | ||
+ | |colspan="2"| BitSet | ||
+ | | BitSet containing bits for each section in the world + 2. Each set bit indicates that the corresponding 16×16×16 chunk section has data in the Block Light array below. The order of bits is the same as in Sky Light Mask. | ||
|- | |- | ||
− | | | + | |colspan="2"| Empty Sky Light Mask |
− | | | + | |colspan="2"| BitSet |
+ | | BitSet containing bits for each section in the world + 2. Each set bit indicates that the corresponding 16×16×16 chunk section has all zeros for its Sky Light data. The order of bits is the same as in Sky Light Mask. | ||
|- | |- | ||
− | | | + | |colspan="2"| Empty Block Light Mask |
− | | | + | |colspan="2"| BitSet |
+ | | BitSet containing bits for each section in the world + 2. Each set bit indicates that the corresponding 16×16×16 chunk section has all zeros for its Block Light data. The order of bits is the same as in Sky Light Mask. | ||
|- | |- | ||
− | | | + | |colspan="2"| Sky Light array count |
− | | | + | |colspan="2"| VarInt |
+ | | Number of entries in the following array; should match the number of bits set in Sky Light Mask | ||
|- | |- | ||
− | | | + | |rowspan="2"| Sky Light arrays |
− | | | + | | Length |
+ | |rowspan="2"| Array | ||
+ | | VarInt | ||
+ | | Length of the following array in bytes (always 2048) | ||
|- | |- | ||
− | | | + | | Sky Light array |
− | | | + | | Array of 2048 bytes |
+ | | There is 1 array for each bit set to true in the sky light mask, starting with the lowest value. Half a byte per light value. Indexed <code><nowiki>((y<<8) | (z<<4) | x) / 2 </nowiki></code> If there's a remainder, masked 0xF0 else 0x0F. | ||
|- | |- | ||
− | | | + | |colspan="2"| Block Light array count |
− | | | + | |colspan="2"| VarInt |
+ | | Number of entries in the following array; should match the number of bits set in Block Light Mask | ||
|- | |- | ||
− | | | + | |rowspan="2"| Block Light arrays |
− | | | + | | Length |
+ | |rowspan="2"| Array | ||
+ | | VarInt | ||
+ | | Length of the following array in bytes (always 2048) | ||
|- | |- | ||
− | | | + | | Block Light array |
− | | | + | | Array of 2048 bytes |
+ | | There is 1 array for each bit set to true in the block light mask, starting with the lowest value. Half a byte per light value. Indexed <code><nowiki>((y<<8) | (z<<4) | x) / 2 </nowiki></code> If there's a remainder, masked 0xF0 else 0x0F. | ||
|} | |} | ||
− | + | Note that the Notchian client requires an [[#Set Center Chunk|Set Center Chunk]] packet when it crosses a chunk border, otherwise it'll only display render distance + 2 chunks around the chunk it spawned in. | |
− | + | The compacted array format has been adjusted so that individual entries no longer span across multiple longs, affecting the main data array and heightmaps. | |
− | + | New format, 5 bits per block, containing the following references to blocks in a palette (not shown): <span style="border: solid 2px hsl(0, 90%, 60%)">1</span><span style="border: solid 2px hsl(30, 90%, 60%)">2</span><span style="border: solid 2px hsl(60, 90%, 60%)">2</span><span style="border: solid 2px hsl(90, 90%, 60%)">3</span><span style="border: solid 2px hsl(120, 90%, 60%)">4</span><span style="border: solid 2px hsl(150, 90%, 60%)">4</span><span style="border: solid 2px hsl(180, 90%, 60%)">5</span><span style="border: solid 2px hsl(210, 90%, 60%)">6</span><span style="border: solid 2px hsl(240, 90%, 60%)">6</span><span style="border: solid 2px hsl(270, 90%, 60%)">4</span><span style="border: solid 2px hsl(300, 90%, 60%)">8</span><span style="border: solid 2px hsl(330, 90%, 60%)">0</span><span style="border: solid 2px hsl(0, 90%, 30%)">7</span><span style="border: solid 2px hsl(30, 90%, 30%)">4</span><span style="border: solid 2px hsl(60, 90%, 30%)">3</span><span style="border: solid 2px hsl(90, 90%, 30%)">13</span><span style="border: solid 2px hsl(120, 90%, 30%)">15</span><span style="border: solid 2px hsl(150, 90%, 30%)">16</span><span style="border: solid 2px hsl(180, 90%, 30%)">9</span><span style="border: solid 2px hsl(210, 90%, 30%)">14</span><span style="border: solid 2px hsl(240, 90%, 30%)">10</span><span style="border: solid 2px hsl(270, 90%, 30%)">12</span><span style="border: solid 2px hsl(300, 90%, 30%)">0</span><span style="border: solid 2px hsl(330, 90%, 30%)">2</span> | |
+ | |||
+ | <code>0020863148418841</code> <code><span style="outline: dashed 2px black">0000</span><span style="outline: solid 2px hsl(330, 90%, 60%)">00000</span><span style="outline: solid 2px hsl(300, 90%, 60%)">01000</span><span style="outline: solid 2px hsl(270, 90%, 60%)">00100</span><span style="outline: solid 2px hsl(240, 90%, 60%)">00110</span><span style="outline: solid 2px hsl(210, 90%, 60%)">00110</span><span style="outline: solid 2px hsl(180, 90%, 60%)">00101</span><span style="outline: solid 2px hsl(150, 90%, 60%)">00100</span><span style="outline: solid 2px hsl(120, 90%, 60%)">00100</span><span style="outline: solid 2px hsl(90, 90%, 60%)">00011</span><span style="outline: solid 2px hsl(60, 90%, 60%)">00010</span><span style="outline: solid 2px hsl(30, 90%, 60%)">00010</span><span style="outline: solid 2px hsl(0, 90%, 60%)">00001</span></code><br> | ||
+ | <code>01018A7260F68C87</code> <code><span style="outline: dashed 2px black">0000</span><span style="outline: solid 2px hsl(330, 90%, 30%)">00010</span><span style="outline: solid 2px hsl(300, 90%, 30%)">00000</span><span style="outline: solid 2px hsl(270, 90%, 30%)">01100</span><span style="outline: solid 2px hsl(240, 90%, 30%)">01010</span><span style="outline: solid 2px hsl(210, 90%, 30%)">01110</span><span style="outline: solid 2px hsl(180, 90%, 30%)">01001</span><span style="outline: solid 2px hsl(150, 90%, 30%)">10000</span><span style="outline: solid 2px hsl(120, 90%, 30%)">01111</span><span style="outline: solid 2px hsl(90, 90%, 30%)">01101</span><span style="outline: solid 2px hsl(60, 90%, 30%)">00011</span><span style="outline: solid 2px hsl(30, 90%, 30%)">00100</span><span style="outline: solid 2px hsl(0, 90%, 30%)">00111</span></code> | ||
+ | |||
+ | ==== World Event ==== | ||
+ | Sent when a client is to play a sound or particle effect. | ||
+ | |||
+ | By default, the Minecraft client adjusts the volume of sound effects based on distance. The final boolean field is used to disable this, and instead the effect is played from 2 blocks away in the correct direction. Currently this is only used for effect 1023 (wither spawn), effect 1028 (enderdragon death), and effect 1038 (end portal opening); it is ignored on other effects. | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 2,365: | Line 2,486: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="4"| 0x20 |
− | |rowspan=" | + | |rowspan="4"| Play |
− | |rowspan=" | + | |rowspan="4"| Client |
− | | | + | | Event |
− | | | + | | Int |
− | | | + | | The event, see below. |
|- | |- | ||
− | | | + | | Location |
− | | | + | | Position |
− | | | + | | The location of the event. |
|- | |- | ||
− | | | + | | Data |
− | | | + | | Int |
− | | | + | | Extra data for certain events, see below. |
|- | |- | ||
− | | | + | | Disable Relative Volume |
− | |||
− | |||
− | |||
− | |||
| Boolean | | Boolean | ||
− | | | + | | See above. |
|} | |} | ||
− | + | Events: | |
− | |||
− | |||
{| class="wikitable" | {| class="wikitable" | ||
− | ! | + | ! ID |
− | ! | + | ! Name |
− | + | ! Data | |
− | |||
− | ! | ||
− | |||
|- | |- | ||
− | + | !colspan="3"| Sound | |
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | 1000 |
− | | | + | | Dispenser dispenses |
− | | | + | | |
|- | |- | ||
− | | | + | | 1001 |
− | | | + | | Dispenser fails to dispense |
− | | | + | | |
|- | |- | ||
− | | | + | | 1002 |
− | | | + | | Dispenser shoots |
− | | | + | | |
|- | |- | ||
− | | | + | | 1003 |
− | | | + | | Ender eye launched |
− | | | + | | |
|- | |- | ||
− | | | + | | 1004 |
− | | | + | | Firework shot |
− | | | + | | |
|- | |- | ||
− | | | + | | 1005 |
− | | | + | | Iron door opened |
− | | | + | | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | 1006 |
− | + | | Wooden door opened | |
− | + | | | |
− | |||
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | 1007 |
− | | | + | | Wooden trapdoor opened |
− | | | + | | |
|- | |- | ||
− | | | + | | 1008 |
− | | | + | | Fence gate opened |
− | | | + | | |
|- | |- | ||
− | | | + | | 1009 |
− | | | + | | Fire extinguished |
− | | | + | | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | 1010 |
− | + | | Play record | |
− | | | + | | Special case, see below for more info. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | 1011 |
− | | | + | | Iron door closed |
− | | | + | | |
− | | | + | |- |
− | | | + | | 1012 |
− | | | + | | Wooden door closed |
+ | | | ||
|- | |- | ||
− | | | + | | 1013 |
− | | | + | | Wooden trapdoor closed |
− | | | + | | |
|- | |- | ||
− | | | + | | 1014 |
− | | | + | | Fence gate closed |
− | | | + | | |
|- | |- | ||
− | | | + | | 1015 |
− | | | + | | Ghast warns |
− | | | + | | |
|- | |- | ||
− | | | + | | 1016 |
− | | | + | | Ghast shoots |
− | | | + | | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | 1017 |
− | | | + | | Enderdragon shoots |
− | | | + | | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | 1018 |
− | + | | Blaze shoots | |
− | + | | | |
− | |||
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | 1019 |
− | | | + | | Zombie attacks wood door |
− | | | + | | |
|- | |- | ||
− | | | + | | 1020 |
− | | | + | | Zombie attacks iron door |
− | | | + | | |
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | + | | 1021 | |
− | + | | Zombie breaks wood door | |
+ | | | ||
|- | |- | ||
− | | | + | | 1022 |
− | | | + | | Wither breaks block |
+ | | | ||
|- | |- | ||
− | | | + | | 1023 |
− | | | + | | Wither spawned |
+ | | | ||
|- | |- | ||
− | | | + | | 1024 |
− | | | + | | Wither shoots |
+ | | | ||
|- | |- | ||
− | | | + | | 1025 |
− | | | + | | Bat takes off |
− | | | + | | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | 1026 |
− | + | | Zombie infects | |
− | + | | | |
− | |||
− | | | ||
− | | | ||
|- | |- | ||
− | + | | 1027 | |
− | + | | Zombie villager converted | |
− | + | | | |
− | |||
|- | |- | ||
− | | | + | | 1028 |
− | | | + | | Ender dragon death |
− | + | | | |
− | | | ||
|- | |- | ||
− | | | + | | 1029 |
− | + | | Anvil destroyed | |
− | | | + | | |
− | | | ||
|- | |- | ||
− | | | + | | 1030 |
− | | | + | | Anvil used |
− | | | + | | |
|- | |- | ||
− | | | + | | 1031 |
− | + | | Anvil landed | |
− | | | + | | |
− | | | ||
|- | |- | ||
− | | | + | | 1032 |
− | | | + | | Portal travel |
− | | | + | | |
|- | |- | ||
− | | | + | | 1033 |
− | | | + | | Chorus flower grown |
− | | | + | | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | 1034 |
− | + | | Chorus flower died | |
− | + | | | |
− | | | ||
− | |||
− | | | ||
|- | |- | ||
− | | | + | | 1035 |
− | | | + | | Brewing stand brewed |
− | | | + | | |
|- | |- | ||
− | | | + | | 1036 |
− | + | | Iron trapdoor opened | |
− | | | + | | |
− | |||
− | | | ||
|- | |- | ||
− | + | | 1037 | |
− | + | | Iron trapdoor closed | |
− | + | | | |
− | |||
|- | |- | ||
− | | | + | | 1038 |
− | + | | End portal created in overworld | |
− | | | + | | |
− | | | ||
|- | |- | ||
− | | | + | | 1039 |
− | | | + | | Phantom bites |
− | | | + | | |
|- | |- | ||
− | | | + | | 1040 |
− | + | | Zombie converts to drowned | |
− | + | | | |
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | 1041 |
− | | | + | | Husk converts to zombie by drowning |
− | + | | | |
− | |||
− | |||
− | |||
− | | | ||
|- | |- | ||
− | | | + | | 1042 |
− | | | + | | Grindstone used |
− | | | + | | |
|- | |- | ||
− | | | + | | 1043 |
− | | | + | | Book page turned |
− | | | + | | |
|- | |- | ||
− | |||
− | |||
− | |||
|- | |- | ||
− | + | !colspan="3"| Particle | |
− | |||
− | |||
|- | |- | ||
− | | | + | | 1500 |
− | | | + | | Composter composts |
− | | | + | | |
|- | |- | ||
− | | | + | | 1501 |
− | | | + | | Lava converts block (either water to stone, or removes existing blocks such as torches) |
− | + | | | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | | | ||
|- | |- | ||
− | | | + | | 1502 |
− | + | | Redstone torch burns out | |
− | | | + | | |
− | | | ||
|- | |- | ||
− | | | + | | 1503 |
− | | | + | | Ender eye placed |
− | | | + | | |
|- | |- | ||
− | | | + | | 2000 |
− | | | + | | Spawns 10 smoke particles, e.g. from a fire |
− | + | | Direction, see below. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | 2001 |
− | + | | Block break + block break sound | |
− | + | | Block state, as an index into the global palette. | |
− | |||
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | 2002 |
− | | | + | | Splash potion. Particle effect + glass break sound. |
− | | | + | | RGB color as an integer (e.g. 8364543 for #7FA1FF). |
|- | |- | ||
− | | | + | | 2003 |
− | | | + | | Eye of Ender entity break animation — particles and sound |
− | | | + | | |
|- | |- | ||
− | | | + | | 2004 |
− | | | + | | Mob spawn particle effect: smoke + flames |
− | | | + | | |
+ | |- | ||
+ | | 2005 | ||
+ | | Bonemeal particles | ||
+ | | How many particles to spawn (if set to 0, 15 are spawned). | ||
|- | |- | ||
− | | | + | | 2006 |
− | | | + | | Dragon breath |
− | | | + | | |
|- | |- | ||
− | | | + | | 2007 |
− | | | + | | Instant splash potion. Particle effect + glass break sound. |
− | | | + | | RGB color as an integer (e.g. 8364543 for #7FA1FF). |
|- | |- | ||
− | | | + | | 2008 |
− | | | + | | Ender dragon destroys block |
− | | | + | | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | + | | 2009 | |
− | + | | Wet sponge vaporizes in nether | |
+ | | | ||
|- | |- | ||
− | | | + | | 3000 |
− | | | + | | End gateway spawn |
+ | | | ||
|- | |- | ||
− | | | + | | 3001 |
− | | | + | | Enderdragon growl |
+ | | | ||
|- | |- | ||
− | | | + | | 3002 |
− | | | + | | Electric spark |
+ | | | ||
|- | |- | ||
− | | | + | | 3003 |
− | | | + | | Copper apply wax |
+ | | | ||
|- | |- | ||
− | | | + | | 3004 |
− | | | + | | Copper remove wax |
+ | | | ||
+ | |- | ||
+ | | 3005 | ||
+ | | Copper scrape oxidation | ||
+ | | | ||
|} | |} | ||
− | + | Smoke directions: | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{| class="wikitable" | {| class="wikitable" | ||
− | ! | + | ! ID |
− | ! | + | ! Direction |
− | + | |- | |
− | + | | 0 | |
− | + | | Down | |
− | + | |- | |
+ | | 1 | ||
+ | | Up | ||
+ | |- | ||
+ | | 2 | ||
+ | | North | ||
+ | |- | ||
+ | | 3 | ||
+ | | South | ||
|- | |- | ||
− | | | + | | 4 |
− | + | | West | |
− | |||
− | |||
− | |||
− | | | ||
|- | |- | ||
− | | | + | | 5 |
− | | | + | | East |
− | |||
|} | |} | ||
− | + | Play record: This is actually a special case within this packet. You can start/stop a record at a specific location. Use a valid {{Minecraft Wiki|Music Discs|Record ID}} to start a record (or overwrite a currently playing one), any other value will stop the record. See [[Data Generators]] for information on item IDs. | |
− | + | ==== Particle ==== | |
+ | |||
+ | Displays the named particle | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 2,862: | Line 2,814: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="12"| 0x21 |
− | |rowspan=" | + | |rowspan="12"| Play |
− | |rowspan=" | + | |rowspan="12"| Client |
− | | | + | | Particle ID |
| VarInt | | VarInt | ||
− | | | + | | The particle ID listed in [[#Particle|the particle data type]]. |
|- | |- | ||
− | | | + | | Long Distance |
− | | | + | | Boolean |
− | | The | + | | If true, particle distance increases from 256 to 65536. |
+ | |- | ||
+ | | X | ||
+ | | Double | ||
+ | | X position of the particle. | ||
+ | |- | ||
+ | | Y | ||
+ | | Double | ||
+ | | Y position of the particle. | ||
+ | |- | ||
+ | | Z | ||
+ | | Double | ||
+ | | Z position of the particle. | ||
+ | |- | ||
+ | | Offset X | ||
+ | | Float | ||
+ | | This is added to the X position after being multiplied by <code>random.nextGaussian()</code>. | ||
+ | |- | ||
+ | | Offset Y | ||
+ | | Float | ||
+ | | This is added to the Y position after being multiplied by <code>random.nextGaussian()</code>. | ||
+ | |- | ||
+ | | Offset Z | ||
+ | | Float | ||
+ | | This is added to the Z position after being multiplied by <code>random.nextGaussian()</code>. | ||
+ | |- | ||
+ | | Max Speed | ||
+ | | Float | ||
+ | | | ||
+ | |- | ||
+ | | Particle Count | ||
+ | | Int | ||
+ | | The number of particles to create. | ||
+ | |- | ||
+ | | Data | ||
+ | | Varies | ||
+ | | The variable data listed in [[#Particle|the particle data type]]. | ||
|} | |} | ||
− | ==== | + | ==== Update Light ==== |
+ | |||
+ | Updates light levels for a chunk. See {{Minecraft Wiki|Light}} for information on how lighting works in Minecraft. | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 2,880: | Line 2,870: | ||
! State | ! State | ||
! Bound To | ! Bound To | ||
− | ! Field Name | + | !colspan="2"| Field Name |
− | ! Field Type | + | !colspan="2"| Field Type |
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="13"| 0x22 |
− | |rowspan=" | + | |rowspan="13"| Play |
− | |rowspan=" | + | |rowspan="13"| Client |
− | | | + | |colspan="2"| Chunk X |
− | | VarInt | + | |colspan="2"| VarInt |
− | | | + | | Chunk coordinate (block coordinate divided by 16, rounded down) |
|- | |- | ||
− | | | + | |colspan="2"| Chunk Z |
− | | | + | |colspan="2"| VarInt |
− | | | + | | Chunk coordinate (block coordinate divided by 16, rounded down) |
− | | | + | |- |
− | + | |colspan="2"| Trust Edges | |
− | ==== | + | |colspan="2"| Boolean |
− | + | | If edges should be trusted for light updates. | |
− | + | |- | |
− | + | |colspan="2"| Sky Light Mask | |
− | + | |colspan="2"| BitSet | |
− | + | | BitSet containing bits for each section in the world + 2. Each set bit indicates that the corresponding 16×16×16 chunk section has data in the Sky Light array below. The least significant bit is for blocks 16 blocks to 1 block below the min world height (one section below the world), while the most significant bit covers blocks 1 to 16 blocks above the max world height (one section above the world). | |
− | + | |- | |
− | + | |colspan="2"| Block Light Mask | |
− | + | |colspan="2"| BitSet | |
+ | | BitSet containing bits for each section in the world + 2. Each set bit indicates that the corresponding 16×16×16 chunk section has data in the Block Light array below. The order of bits is the same as in Sky Light Mask. | ||
+ | |- | ||
+ | |colspan="2"| Empty Sky Light Mask | ||
+ | |colspan="2"| BitSet | ||
+ | | BitSet containing bits for each section in the world + 2. Each set bit indicates that the corresponding 16×16×16 chunk section has all zeros for its Sky Light data. The order of bits is the same as in Sky Light Mask. | ||
+ | |- | ||
+ | |colspan="2"| Empty Block Light Mask | ||
+ | |colspan="2"| BitSet | ||
+ | | BitSet containing bits for each section in the world + 2. Each set bit indicates that the corresponding 16×16×16 chunk section has all zeros for its Block Light data. The order of bits is the same as in Sky Light Mask. | ||
+ | |- | ||
+ | |colspan="2"| Sky Light array count | ||
+ | |colspan="2"| VarInt | ||
+ | | Number of entries in the following array; should match the number of bits set in Sky Light Mask | ||
+ | |- | ||
+ | |rowspan="2"| Sky Light arrays | ||
+ | | Length | ||
+ | |rowspan="2"| Array | ||
+ | | VarInt | ||
+ | | Length of the following array in bytes (always 2048) | ||
+ | |- | ||
+ | | Sky Light array | ||
+ | | Array of 2048 bytes | ||
+ | | There is 1 array for each bit set to true in the sky light mask, starting with the lowest value. Half a byte per light value. | ||
+ | |- | ||
+ | |colspan="2"| Block Light array count | ||
+ | |colspan="2"| VarInt | ||
+ | | Number of entries in the following array; should match the number of bits set in Block Light Mask | ||
|- | |- | ||
− | |rowspan="2"| | + | |rowspan="2"| Block Light arrays |
− | | | + | | Length |
− | |rowspan="2"| | + | |rowspan="2"| Array |
− | | | + | | VarInt |
− | | | + | | Length of the following array in bytes (always 2048) |
− | |||
|- | |- | ||
− | | | + | | Block Light array |
− | | | + | | Array of 2048 bytes |
− | | | + | | There is 1 array for each bit set to true in the block light mask, starting with the lowest value. Half a byte per light value. |
|} | |} | ||
− | ==== | + | A bit will never be set in both the block light mask and the empty block light mask, though it may be present in neither of them (if the block light does not need to be updated for the corresponding chunk section). The same applies to the sky light mask and the empty sky light mask. |
+ | |||
+ | ==== Login (play) ==== | ||
− | + | See [[Protocol Encryption]] for information on logging in. | |
{| class="wikitable" | {| class="wikitable" | ||
Line 2,930: | Line 2,948: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="20"| 0x23 |
− | |rowspan=" | + | |rowspan="20"| Play |
− | |rowspan=" | + | |rowspan="20"| Client |
− | | | + | | Entity ID |
− | | Int | + | | Int |
− | | | + | | The player's Entity ID (EID). |
|- | |- | ||
− | | | + | | Is hardcore |
− | | | + | | Boolean |
− | | | + | | |
|- | |- | ||
| Gamemode | | Gamemode | ||
| Unsigned Byte | | Unsigned Byte | ||
− | | 0: survival, 1: creative, 2: adventure, 3: spectator. The hardcore flag is not included | + | | 0: Survival, 1: Creative, 2: Adventure, 3: Spectator. |
+ | |- | ||
+ | | Previous Gamemode | ||
+ | | Byte | ||
+ | | 0: survival, 1: creative, 2: adventure, 3: spectator. The hardcore flag is not included. The previous gamemode. Defaults to -1 if there is no previous gamemode. (More information needed) | ||
+ | |- | ||
+ | | Dimension Count | ||
+ | | VarInt | ||
+ | | Size of the following array. | ||
+ | |- | ||
+ | | Dimension Names | ||
+ | | Array of Identifier | ||
+ | | Identifiers for all dimensions on the server. | ||
+ | |- | ||
+ | | Registry Codec | ||
+ | | [[NBT|NBT Tag Compound]] | ||
+ | | Represents certain registries that are sent from the server and are applied on the client. | ||
+ | |- | ||
+ | | Dimension Type | ||
+ | | Identifier | ||
+ | | Name of the dimension type being spawned into. | ||
+ | |- | ||
+ | | Dimension Name | ||
+ | | Identifier | ||
+ | | Name of the dimension being spawned into. | ||
+ | |- | ||
+ | | Hashed seed | ||
+ | | Long | ||
+ | | First 8 bytes of the SHA-256 hash of the world's seed. Used client side for biome noise | ||
+ | |- | ||
+ | | Max Players | ||
+ | | VarInt | ||
+ | | Was once used by the client to draw the player list, but now is ignored. | ||
+ | |- | ||
+ | | View Distance | ||
+ | | VarInt | ||
+ | | Render distance (2-32). | ||
+ | |- | ||
+ | | Simulation Distance | ||
+ | | VarInt | ||
+ | | The distance that the client will process specific things, such as entities. | ||
+ | |- | ||
+ | | Reduced Debug Info | ||
+ | | Boolean | ||
+ | | If true, a Notchian client shows reduced information on the {{Minecraft Wiki|debug screen}}. For servers in development, this should almost always be false. | ||
+ | |- | ||
+ | | Enable respawn screen | ||
+ | | Boolean | ||
+ | | Set to false when the doImmediateRespawn gamerule is true. | ||
+ | |- | ||
+ | | Is Debug | ||
+ | | Boolean | ||
+ | | True if the world is a {{Minecraft Wiki|debug mode}} world; debug mode worlds cannot be modified and have predefined blocks. | ||
+ | |- | ||
+ | | Is Flat | ||
+ | | Boolean | ||
+ | | True if the world is a {{Minecraft Wiki|superflat}} world; flat worlds have different void fog and a horizon at y=0 instead of y=63. | ||
+ | |- | ||
+ | | Has death location | ||
+ | | Boolean | ||
+ | | If true, then the next two fields are present. | ||
+ | |- | ||
+ | | Death dimension name | ||
+ | | Identifier | ||
+ | | Name of the dimension the player died in. | ||
|- | |- | ||
− | | | + | | Death location |
− | | | + | | Position |
− | | | + | | The location that the player died at. |
|} | |} | ||
− | |||
− | + | The '''Registry Codec''' NBT Tag Compound ([https://gist.github.com/rj00a/f2970a8ce4d09477ec8f16003b9dce86 Default value in JSON as of 1.19]) includes three registries: "minecraft:dimension_type", "minecraft:worldgen/biome", and "minecraft:chat_type". | |
− | === | + | {| class="wikitable" |
+ | !Name | ||
+ | !Type | ||
+ | !style="width: 250px;" colspan="2"| Notes | ||
+ | |- | ||
+ | | minecraft:dimension_type | ||
+ | | TAG_Compound | ||
+ | | The dimension type registry (see below). | ||
+ | |- | ||
+ | | minecraft:worldgen/biome | ||
+ | | TAG_Compound | ||
+ | | The biome registry (see below). | ||
+ | |- | ||
+ | | minecraft:chat_type | ||
+ | | TAG_Compound | ||
+ | | The chat type registry (see below). | ||
+ | |} | ||
− | + | Dimension type registry: | |
{| class="wikitable" | {| class="wikitable" | ||
− | ! | + | !Name |
− | + | !Type | |
− | + | !style="width: 250px;" colspan="2"| Notes | |
− | |||
− | ! | ||
− | ! Notes | ||
|- | |- | ||
− | | | + | | type |
− | | | + | | TAG_String |
− | | | + | | The name of the registry. Always "minecraft:dimension_type". |
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | value |
− | | | + | | TAG_List |
− | | | + | | List of dimension types registry entries (see below). |
|} | |} | ||
− | + | Dimension type registry entry: | |
{| class="wikitable" | {| class="wikitable" | ||
− | ! | + | !Name |
− | ! | + | !Type |
− | + | !style="width: 250px;" colspan="2"| Notes | |
− | !colspan="2"| | + | |- |
− | + | | name | |
− | + | | TAG_String | |
+ | | The name of the dimension type (for example, "minecraft:overworld"). | ||
|- | |- | ||
− | | | + | | id |
− | | | + | | TAG_Int |
− | | | + | | The protocol ID of the dimension (matches the index of the element in the registry list). |
− | |||
− | |||
− | |||
|- | |- | ||
− | ! | + | | element |
− | ! | + | | TAG_Compound |
− | ! | + | | The dimension type (see below). |
− | ! | + | |} |
+ | |||
+ | Dimension type: | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Name | ||
+ | ! Type | ||
+ | !style="width: 250px;" colspan="2"| Meaning | ||
+ | ! Values | ||
|- | |- | ||
− | | | + | | piglin_safe |
− | | | + | | TAG_Byte |
− | | | + | |colspan="2"| Whether piglins shake and transform to zombified piglins. |
− | | | + | | 1: true, 0: false. |
|- | |- | ||
− | | | + | | has_raids |
− | | | + | | TAG_Byte |
− | | | + | |colspan="2"| Whether players with the Bad Omen effect can cause a raid. |
− | | | + | | 1: true, 0: false. |
|- | |- | ||
− | | | + | | monster_spawn_light_level |
− | | | + | | TAG_Int |
− | | | + | |colspan="2"| |
+ | | | ||
|- | |- | ||
− | | | + | | monster_spawn_block_light_limit |
− | | | + | | TAG_Int |
− | | | + | |colspan="2"| |
+ | | | ||
|- | |- | ||
− | | | + | | natural |
− | | | + | | TAG_Byte |
− | | | + | |colspan="2"| When false, compasses spin randomly. When true, nether portals can spawn zombified piglins. |
− | | | + | | 1: true, 0: false. |
|- | |- | ||
− | | | + | | ambient_light |
− | | | + | | TAG_Float |
− | | | + | |colspan="2"| How much light the dimension has. |
+ | | 0.0 to 1.0. | ||
|- | |- | ||
− | | | + | | fixed_time |
− | | | + | | Optional TAG_Long |
− | | | + | |colspan="2"| If set, the time of the day is the specified value. |
− | | | + | | If set, 0 to 24000. |
|- | |- | ||
− | | | + | | infiniburn |
− | | | + | | TAG_String |
− | | | + | |colspan="2"| A resource location defining what block tag to use for infiniburn. |
+ | | "#" or minecraft resource "#minecraft:...". | ||
+ | |- | ||
+ | | respawn_anchor_works | ||
+ | | TAG_Byte | ||
+ | |colspan="2"| Whether players can charge and use respawn anchors. | ||
+ | | 1: true, 0: false. | ||
+ | |- | ||
+ | | has_skylight | ||
+ | | TAG_Byte | ||
+ | |colspan="2"| Whether the dimension has skylight access or not. | ||
+ | | 1: true, 0: false. | ||
|- | |- | ||
− | | | + | | bed_works |
− | | | + | | TAG_Byte |
− | | | + | |colspan="2"| Whether players can use a bed to sleep. |
+ | | 1: true, 0: false. | ||
|- | |- | ||
− | | | + | | effects |
− | | | + | | TAG_String |
− | | | + | |colspan="2"| ? |
+ | | "minecraft:overworld", "minecraft:the_nether", "minecraft:the_end" or something else. | ||
|- | |- | ||
− | | | + | | min_y |
− | | | + | | TAG_Int |
− | | | + | |colspan="2"| The minimum Y level. |
+ | | A multiple of 16. Example: -64 | ||
|- | |- | ||
− | | | + | | height |
− | | | + | | TAG_Int |
− | | | + | |colspan="2"| The maximum height. |
+ | | A multiple of 16. Example: 256 | ||
|- | |- | ||
− | | | + | | logical_height |
− | | | + | | TAG_Int |
− | | | + | |colspan="2"| The maximum height to which chorus fruits and nether portals can bring players within this dimension. |
+ | | 0-384. | ||
|- | |- | ||
− | | | + | | coordinate_scale |
− | | | + | | TAG_Double |
− | | | + | |colspan="2"| The multiplier applied to coordinates when traveling to the dimension. |
+ | | 0.00001 - 30000000.0 | ||
|- | |- | ||
− | | | + | | ultrawarm |
− | | | + | | TAG_Byte |
− | | | + | |colspan="2"| Whether the dimensions behaves like the nether (water evaporates and sponges dry) or not. Also causes lava to spread thinner. |
− | | | + | | 1: true, 0: false. |
|- | |- | ||
− | | | + | | has_ceiling |
− | | | + | | TAG_Byte |
− | | | + | |colspan="2"| Whether the dimension has a bedrock ceiling or not. When true, causes lava to spread faster. |
− | | | + | | 1: true, 0: false. |
|} | |} | ||
− | + | Biome registry: | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | === | + | {| class="wikitable" |
+ | !Name | ||
+ | !Type | ||
+ | !style="width: 250px;" colspan="2"| Notes | ||
+ | |- | ||
+ | | type | ||
+ | | TAG_String | ||
+ | | The name of the registry. Always "minecraft:worldgen/biome". | ||
+ | |- | ||
+ | | value | ||
+ | | TAG_List | ||
+ | | List of biome registry entries (see below). | ||
+ | |} | ||
− | + | Biome registry entry: | |
− | The | + | {| class="wikitable" |
+ | !Name | ||
+ | !Type | ||
+ | !style="width: 250px;" colspan="2"| Notes | ||
+ | |- | ||
+ | | name | ||
+ | | TAG_String | ||
+ | | The name of the biome (for example, "minecraft:ocean"). | ||
+ | |- | ||
+ | | id | ||
+ | | TAG_Int | ||
+ | | The protocol ID of the biome (matches the index of the element in the registry list). | ||
+ | |- | ||
+ | | element | ||
+ | | TAG_Compound | ||
+ | | The biome properties (see below). | ||
+ | |} | ||
− | + | Biome properties: | |
− | |||
− | |||
{| class="wikitable" | {| class="wikitable" | ||
− | ! | + | !colspan="3"|Name |
− | ! | + | !colspan="2"|Type |
− | ! | + | !style="width: 250px;" colspan="2"| Meaning |
− | ! | + | !colspan="2"|Values |
− | + | |- | |
− | + | |colspan="3"|precipitation | |
+ | |colspan="2"|TAG_String | ||
+ | |colspan="2"| The type of precipitation in the biome. | ||
+ | |colspan="2"|"rain", "snow", or "none". | ||
+ | |- | ||
+ | |colspan="3"| depth | ||
+ | |colspan="2"| TAG_Float | ||
+ | |colspan="2"| The depth factor of the biome. | ||
+ | |colspan="2"| The default values vary between 1.5 and -1.8. | ||
+ | |- | ||
+ | |colspan="3"| temperature | ||
+ | |colspan="2"| TAG_Float | ||
+ | |colspan="2"| The temperature factor of the biome. | ||
+ | |colspan="2"| The default values vary between 2.0 and -0.5. | ||
+ | |- | ||
+ | |colspan="3"| scale | ||
+ | |colspan="2"| TAG_Float | ||
+ | |colspan="2"| ? | ||
+ | |colspan="2"| The default values vary between 1.225 and 0.0. | ||
+ | |- | ||
+ | |colspan="3"| downfall | ||
+ | |colspan="2"| TAG_Float | ||
+ | |colspan="2"| ? | ||
+ | |colspan="2"| The default values vary between 1.0 and 0.0. | ||
+ | |- | ||
+ | |colspan="3"| category | ||
+ | |colspan="2"| TAG_String | ||
+ | |colspan="2"| The category of the biome. | ||
+ | |colspan="2"| Known values are "ocean", "plains", "desert", "forest", "extreme_hills", "taiga", "swamp", "river", "nether", "the_end", "icy", "mushroom", "beach", "jungle", "mesa", "savanna", and "none". | ||
+ | |- | ||
+ | |colspan="3"| temperature_modifier | ||
+ | |colspan="2"| Optional TAG_String | ||
+ | |colspan="2"| ? | ||
+ | |colspan="2"| The only known value is "frozen". | ||
+ | |- | ||
+ | |rowspan="13"| effects | ||
+ | |colspan="2"| sky_color | ||
+ | |rowspan="11"| TAG_Compound | ||
+ | | TAG_Int | ||
+ | |colspan="2"| The color of the sky. | ||
+ | | Example: 8364543, which is #7FA1FF in RGB. | ||
+ | |- | ||
+ | |colspan="2"| water_fog_color | ||
+ | | TAG_Int | ||
+ | |colspan="2"| Possibly the tint color when swimming. | ||
+ | | Example: 8364543, which is #7FA1FF in RGB. | ||
+ | |- | ||
+ | |colspan="2"| fog_color | ||
+ | | TAG_Int | ||
+ | |colspan="2"| Possibly the color of the fog effect when looking past the view distance. | ||
+ | | Example: 8364543, which is #7FA1FF in RGB. | ||
+ | |- | ||
+ | |colspan="2"| water_color | ||
+ | | TAG_Int | ||
+ | |colspan="2"| The tint color of the water blocks. | ||
+ | | Example: 8364543, which is #7FA1FF in RGB. | ||
+ | |- | ||
+ | |colspan="2"| foliage_color | ||
+ | | Optional TAG_Int | ||
+ | |colspan="2"| The tint color of the grass. | ||
+ | | Example: 8364543, which is #7FA1FF in RGB. | ||
+ | |- | ||
+ | |colspan="2"| grass_color | ||
+ | | Optional TAG_Int | ||
+ | | colspan="2"| ? | ||
+ | | Example: 8364543, which is #7FA1FF in RGB. | ||
+ | |- | ||
+ | |colspan="2"| grass_color_modifier | ||
+ | | Optional TAG_String | ||
+ | |colspan="2"| Unknown, likely affects foliage color. | ||
+ | | If set, known values are "swamp" and "dark_forest". | ||
+ | |- | ||
+ | |colspan="2"| music | ||
+ | | Optional TAG_Compound | ||
+ | |colspan="2"| Music properties for the biome. | ||
+ | | If present, contains the fields: replace_current_music (TAG_Byte), sound (TAG_String), max_delay (TAG_Int), min_delay (TAG_Int). | ||
+ | |- | ||
+ | |colspan="2"| ambient_sound | ||
+ | | Optional TAG_String | ||
+ | |colspan="2"| Ambient soundtrack. | ||
+ | | If present, the ID of a soundtrack. Example: "minecraft:ambient.basalt_deltas.loop". | ||
+ | |- | ||
+ | |colspan="2"| additions_sound | ||
+ | | Optional TAG_Compound | ||
+ | |colspan="2"| Additional ambient sound that plays randomly. | ||
+ | | If present, contains the fields: sound (TAG_String), tick_chance (TAG_Double). | ||
+ | |- | ||
+ | |colspan="2"| mood_sound | ||
+ | | Optional TAG_Compound | ||
+ | |colspan="2"| Additional ambient sound that plays at an interval. | ||
+ | | If present, contains the fields: sound (TAG_String), tick_delay (TAG_Int), offset (TAG_Double), block_search_extent (TAG_Int). | ||
+ | |- | ||
+ | |rowspan="2"| particle | ||
+ | | probability | ||
+ | |rowspan="2"| Optional TAG_Compound | ||
+ | | TAG_FLOAT | ||
+ | |rowspan="2"| Particles that appear randomly in the biome. | ||
+ | | Possibly the probability of spawning the particle. | ||
+ | | ? | ||
|- | |- | ||
− | | | + | | options |
− | | | + | | TAG_COMPOUND |
− | | | + | | The properties of the particle to spawn. |
− | | | + | | Contains the field "type" (TAG_String), which identifies the particle type. |
− | |||
− | |||
|} | |} | ||
− | + | Chat registry: | |
− | + | {| class="wikitable" | |
− | + | !Name | |
− | + | !Type | |
− | + | !style="width: 250px;" colspan="2"| Notes | |
+ | |- | ||
+ | | type | ||
+ | | TAG_String | ||
+ | | The name of the registry. Always "minecraft:chat_type". | ||
+ | |- | ||
+ | | value | ||
+ | | TAG_List | ||
+ | | List of chat registry entries (see below). | ||
+ | |} | ||
− | ==== | + | ==== Map Data ==== |
− | + | Updates a rectangular area on a {{Minecraft Wiki|map}} item. | |
{| class="wikitable" | {| class="wikitable" | ||
Line 3,123: | Line 3,362: | ||
! State | ! State | ||
! Bound To | ! Bound To | ||
− | ! Field Name | + | !colspan="2"| Field Name |
− | ! Field Type | + | !colspan="2"| Field Type |
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="17"| 0x24 |
− | |rowspan=" | + | |rowspan="17"| Play |
− | |rowspan="1"| | + | |rowspan="17"| Client |
− | | | + | |colspan="2"| Map ID |
+ | |colspan="2"| VarInt | ||
+ | | Map ID of the map being modified | ||
+ | |- | ||
+ | |colspan="2"| Scale | ||
+ | |colspan="2"| Byte | ||
+ | | From 0 for a fully zoomed-in map (1 block per pixel) to 4 for a fully zoomed-out map (16 blocks per pixel) | ||
+ | |- | ||
+ | |colspan="2"| Locked | ||
+ | |colspan="2"| Boolean | ||
+ | | True if the map has been locked in a cartography table | ||
+ | |- | ||
+ | |colspan="2"| Tracking Position | ||
+ | |colspan="2"| Boolean | ||
+ | | Specifies whether player and item frame icons are shown | ||
+ | |- | ||
+ | |colspan="2"| Icon Count | ||
+ | |colspan="2"| VarInt | ||
+ | | Number of elements in the following array. Only present if "Tracking Position" is true. | ||
+ | |- | ||
+ | |rowspan="6"| Icon | ||
+ | | Type | ||
+ | |rowspan="6"| Array | ||
+ | | VarInt enum | ||
+ | | See below | ||
+ | |- | ||
+ | | X | ||
+ | | Byte | ||
+ | | Map coordinates: -128 for furthest left, +127 for furthest right | ||
+ | |- | ||
+ | | Z | ||
| Byte | | Byte | ||
− | | | + | | Map coordinates: -128 for highest, +127 for lowest |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | Direction |
− | |||
− | |||
− | |||
| Byte | | Byte | ||
− | | | + | | 0-15 |
|- | |- | ||
− | | | + | | Has Display Name |
− | | | + | | Boolean |
− | | | + | | |
− | | | + | |- |
− | + | | Display Name | |
− | ==== | + | | Optional [[Chat]] |
− | + | | Only present if previous Boolean is true | |
− | + | |- | |
− | + | |colspan="2"| Columns | |
− | + | |colspan="2"| Unsigned Byte | |
− | + | | Number of columns updated | |
− | + | |- | |
− | + | |colspan="2"| Rows | |
− | + | |colspan="2"| Optional Unsigned Byte | |
− | + | | Only if Columns is more than 0; number of rows updated | |
− | + | |- | |
+ | |colspan="2"| X | ||
+ | |colspan="2"| Optional Byte | ||
+ | | Only if Columns is more than 0; x offset of the westernmost column | ||
+ | |- | ||
+ | |colspan="2"| Z | ||
+ | |colspan="2"| Optional Byte | ||
+ | | Only if Columns is more than 0; z offset of the northernmost row | ||
|- | |- | ||
− | | | + | |colspan="2"| Length |
− | | | + | |colspan="2"| Optional VarInt |
− | + | | Only if Columns is more than 0; length of the following array | |
− | |||
− | |||
− | | | ||
|- | |- | ||
− | | | + | |colspan="2"| Data |
− | | | + | |colspan="2"| Optional Array of Unsigned Byte |
− | | | + | | Only if Columns is more than 0; see {{Minecraft Wiki|Map item format}} |
|} | |} | ||
− | + | For icons, a direction of 0 is a vertical icon and increments by 22.5° (360/16). | |
− | + | Types are based off of rows and columns in <code>map_icons.png</code>: | |
{| class="wikitable" | {| class="wikitable" | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | ! Icon type |
− | | | + | ! Result |
− | | | + | |- |
− | | | + | | 0 |
− | | | + | | White arrow (players) |
− | | | + | |- |
+ | | 1 | ||
+ | | Green arrow (item frames) | ||
|- | |- | ||
− | | | + | | 2 |
− | | | + | | Red arrow |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | 3 |
− | + | | Blue arrow | |
− | |||
− | |||
− | |||
− | | | ||
|- | |- | ||
− | | | + | | 4 |
− | | | + | | White cross |
− | |||
|- | |- | ||
− | | | + | | 5 |
− | | | + | | Red pointer |
− | |||
|- | |- | ||
− | | | + | | 6 |
− | | | + | | White circle (off-map players) |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | 7 |
− | + | | Small white circle (far-off-map players) | |
− | |||
− | |||
− | |||
− | | | ||
|- | |- | ||
− | | | + | | 8 |
− | | | + | | Mansion |
− | |||
|- | |- | ||
− | | | + | | 9 |
− | | | + | | Temple |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | 10 |
− | + | | White Banner | |
− | |||
− | |||
− | |||
− | | | ||
|- | |- | ||
− | | | + | | 11 |
− | + | | Orange Banner | |
− | | | ||
|- | |- | ||
− | | | + | | 12 |
− | | | + | | Magenta Banner |
− | | | + | |- |
+ | | 13 | ||
+ | | Light Blue Banner | ||
+ | |- | ||
+ | | 14 | ||
+ | | Yellow Banner | ||
+ | |- | ||
+ | | 15 | ||
+ | | Lime Banner | ||
+ | |- | ||
+ | | 16 | ||
+ | | Pink Banner | ||
+ | |- | ||
+ | | 17 | ||
+ | | Gray Banner | ||
+ | |- | ||
+ | | 18 | ||
+ | | Light Gray Banner | ||
+ | |- | ||
+ | | 19 | ||
+ | | Cyan Banner | ||
+ | |- | ||
+ | | 20 | ||
+ | | Purple Banner | ||
+ | |- | ||
+ | | 21 | ||
+ | | Blue Banner | ||
+ | |- | ||
+ | | 22 | ||
+ | | Brown Banner | ||
+ | |- | ||
+ | | 23 | ||
+ | | Green Banner | ||
+ | |- | ||
+ | | 24 | ||
+ | | Red Banner | ||
+ | |- | ||
+ | | 25 | ||
+ | | Black Banner | ||
+ | |- | ||
+ | | 26 | ||
+ | | Treasure marker | ||
|} | |} | ||
− | ==== | + | ==== Merchant Offers ==== |
− | |||
− | |||
− | + | The list of trades a villager NPC is offering. | |
{| class="wikitable" | {| class="wikitable" | ||
Line 3,303: | Line 3,539: | ||
! State | ! State | ||
! Bound To | ! Bound To | ||
− | ! Field Name | + | !colspan="2"| Field Name |
− | ! Field Type | + | !colspan="2"| Field Type |
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="18"| 0x25 |
− | |rowspan=" | + | |rowspan="18"| Play |
− | |rowspan=" | + | |rowspan="18"| Client |
− | | | + | |- |
− | | | + | | colspan="2" | Window ID |
− | | | + | | colspan="2" | VarInt |
+ | | The ID of the window that is open; this is an int rather than a byte. | ||
+ | |- | ||
+ | | colspan="2" | Size | ||
+ | | colspan="2" | Byte | ||
+ | | The number of trades in the following array. | ||
+ | |- | ||
+ | | rowspan="11" | Trades | ||
+ | | Input item 1 | ||
+ | | rowspan="11" | Array | ||
+ | | [[Slot]] | ||
+ | | The first item the player has to supply for this villager trade. The count of the item stack is the default "price" of this trade. | ||
|- | |- | ||
− | | | + | | Output item |
− | | | + | | [[Slot]] |
− | | | + | | The item the player will receive from this villager trade. |
− | |- | + | |- |
− | | | + | | Has second item |
+ | | Boolean | ||
+ | | Whether there is a second item. | ||
+ | |- | ||
+ | | Input item 2 | ||
+ | | Optional [[Slot]] | ||
+ | | The second item the player has to supply for this villager trade; only present if has a second item is true. | ||
+ | |- | ||
+ | | Trade disabled | ||
+ | | Boolean | ||
+ | | True if the trade is disabled; false if the trade is enabled. | ||
+ | |- | ||
+ | | Number of trade uses | ||
+ | | Integer | ||
+ | | Number of times the trade has been used so far. If equal to the maximum number of trades, the client will display a red X. | ||
+ | |- | ||
+ | | Maximum number of trade uses | ||
+ | | Integer | ||
+ | | Number of times this trade can be used before it's exhausted. | ||
+ | |- | ||
+ | | XP | ||
+ | | Integer | ||
+ | | Amount of XP the villager will earn each time the trade is used. | ||
+ | |- | ||
+ | | Special Price | ||
+ | | Integer | ||
+ | | Can be zero or negative. The number is added to the price when an item is discounted due to player reputation or other effects. | ||
+ | |- | ||
+ | | Price Multiplier | ||
| Float | | Float | ||
− | | | + | | Can be low (0.05) or high (0.2). Determines how much demand, player reputation, and temporary effects will adjust the price. |
+ | |- | ||
+ | | Demand | ||
+ | | Integer | ||
+ | | If positive, causes the price to increase. Negative values seem to be treated the same as zero. | ||
+ | |- | ||
+ | |colspan="2"| Villager level | ||
+ | |colspan="2"| VarInt | ||
+ | | Appears on the trade GUI; meaning comes from the translation key <code>merchant.level.</code> + level. | ||
+ | 1: Novice, 2: Apprentice, 3: Journeyman, 4: Expert, 5: Master. | ||
+ | |- | ||
+ | |colspan="2"| Experience | ||
+ | |colspan="2"| VarInt | ||
+ | | Total experience for this villager (always 0 for the wandering trader). | ||
+ | |- | ||
+ | |colspan="2"| Is regular villager | ||
+ | |colspan="2"| Boolean | ||
+ | | True if this is a regular villager; false for the wandering trader. When false, hides the villager level and some other GUI elements. | ||
+ | |- | ||
+ | |colspan="2"| Can restock | ||
+ | |colspan="2"| Boolean | ||
+ | | True for regular villagers and false for the wandering trader. If true, the "Villagers restock up to two times per day." message is displayed when hovering over disabled trades. | ||
|} | |} | ||
− | ==== | + | Modifiers can increase or decrease the number of items for the first input slot. The second input slot and the output slot never change the nubmer of items. The number of items may never be less than 1, and never more than the stack size. If special price and demand are both zero, only the default price is displayed. If either is non-zero, then the adjusted price is displayed next to the crossed-out default price. The adjusted prices is calculated as follows: |
+ | |||
+ | Adjusted price = default price + floor(default price x multiplier x demand) + special price | ||
+ | |||
+ | [[File:1.14-merchant-slots.png|thumb|The merchant UI, for reference]] | ||
+ | {{-}} | ||
+ | |||
+ | ==== Update Entity Position ==== | ||
+ | |||
+ | This packet is sent by the server when an entity moves less then 8 blocks; if an entity moves more than 8 blocks [[#Teleport Entity|Teleport Entity]] should be sent instead. | ||
− | This is | + | This packet allows at most 8 blocks movement in any direction, because short range is from -32768 to 32767. And <code>32768 / (128 * 32)</code> = 8. |
{| class="wikitable" | {| class="wikitable" | ||
Line 3,335: | Line 3,640: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="5"| 0x26 |
− | |rowspan=" | + | |rowspan="5"| Play |
− | |rowspan=" | + | |rowspan="5"| Client |
− | | | + | | Entity ID |
− | | | + | | VarInt |
− | | | + | | |
|- | |- | ||
− | | | + | | Delta X |
− | | | + | | Short |
− | | | + | | Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>. |
|- | |- | ||
− | | | + | | Delta Y |
− | | | + | | Short |
− | + | | Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>. | |
|- | |- | ||
− | | | + | | Delta Z |
− | | | + | | Short |
− | | | + | | Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>. |
− | |} | + | |- |
− | + | | On Ground | |
− | ==== | + | | Boolean |
+ | | | ||
+ | |} | ||
+ | |||
+ | ==== Update Entity Position and Rotation ==== | ||
+ | |||
+ | This packet is sent by the server when an entity rotates and moves. Since a short range is limited from -32768 to 32767, and movement is offset of fixed-point numbers, this packet allows at most 8 blocks movement in any direction. (<code>-32768 / (32 * 128) == -8</code>) | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 3,365: | Line 3,676: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="7"| 0x27 |
− | |rowspan=" | + | |rowspan="7"| Play |
− | |rowspan=" | + | |rowspan="7"| Client |
| Entity ID | | Entity ID | ||
| VarInt | | VarInt | ||
− | | | + | | |
+ | |- | ||
+ | | Delta X | ||
+ | | Short | ||
+ | | Change in X position as <code>(currentX * 32 - prevX * 32) * 128</code>. | ||
+ | |- | ||
+ | | Delta Y | ||
+ | | Short | ||
+ | | Change in Y position as <code>(currentY * 32 - prevY * 32) * 128</code>. | ||
+ | |- | ||
+ | | Delta Z | ||
+ | | Short | ||
+ | | Change in Z position as <code>(currentZ * 32 - prevZ * 32) * 128</code>. | ||
+ | |- | ||
+ | | Yaw | ||
+ | | Angle | ||
+ | | New angle, not a delta. | ||
|- | |- | ||
− | | | + | | Pitch |
− | | | + | | Angle |
− | | | + | | New angle, not a delta. |
|- | |- | ||
− | | | + | | On Ground |
− | | | + | | Boolean |
− | | | + | | |
|} | |} | ||
− | ==== | + | ==== Update Entity Rotation ==== |
− | + | This packet is sent by the server when an entity rotates. | |
{| class="wikitable" | {| class="wikitable" | ||
Line 3,389: | Line 3,716: | ||
! State | ! State | ||
! Bound To | ! Bound To | ||
− | ! | + | ! Field Name |
! Field Type | ! Field Type | ||
! Notes | ! Notes | ||
|- | |- | ||
− | |rowspan=" | + | |rowspan="4"| 0x28 |
− | |rowspan=" | + | |rowspan="4"| Play |
− | |rowspan=" | + | |rowspan="4"| Client |
− | | | + | | Entity ID |
− | | | + | | VarInt |
− | | | + | | |
|- | |- | ||
− | | | + | | Yaw |
− | | | + | | Angle |
− | | | + | | New angle, not a delta. |
|- | |- | ||
− | | | + | | Pitch |
− | + | | Angle | |
− | | | + | | New angle, not a delta. |
− | | | ||
|- | |- | ||
− | | | + | | On Ground |
− | | | + | | Boolean |
− | + | | | |
+ | |} | ||
+ | |||
+ | ==== Move Vehicle (clientbound) ==== | ||
+ | |||
+ | Note that all fields use absolute positioning and do not allow for relative positioning. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
|- | |- | ||
− | | | + | |rowspan="5"| 0x29 |
− | | | + | |rowspan="5"| Play |
− | | | + | |rowspan="5"| Client |
+ | | X | ||
+ | | Double | ||
+ | | Absolute position (X coordinate). | ||
|- | |- | ||
− | | | + | | Y |
− | | | + | | Double |
− | | | + | | Absolute position (Y coordinate). |
|- | |- | ||
− | | | + | | Z |
− | | | + | | Double |
− | | | + | | Absolute position (Z coordinate). |
|- | |- | ||
− | | | + | | Yaw |
− | | | + | | Float |
− | | | + | | Absolute rotation on the vertical axis, in degrees. |
+ | |- | ||
+ | | Pitch | ||
+ | | Float | ||
+ | | Absolute rotation on the horizontal axis, in degrees. | ||
+ | |} | ||
+ | |||
+ | ==== Open Book ==== | ||
+ | |||
+ | Sent when a player right clicks with a signed book. This tells the client to open the book GUI. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
|- | |- | ||
− | | | + | | 0x2A |
− | | | + | | Play |
− | | For | + | | Client |
+ | | Hand | ||
+ | | VarInt enum | ||
+ | | 0: Main hand, 1: Off hand . | ||
+ | |} | ||
+ | |||
+ | ==== Open Screen ==== | ||
+ | |||
+ | This is sent to the client when it should open an inventory, such as a chest, workbench, or furnace. This message is not sent anywhere for clients opening their own inventory. Resending this packet with already existing window id, will update the window title and window type without closing the window. | ||
+ | For horses, use [[#Open Horse Screen|Open Horse Screen]]. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Packet ID | ||
+ | ! State | ||
+ | ! Bound To | ||
+ | ! Field Name | ||
+ | ! Field Type | ||
+ | ! Notes | ||
|- | |- | ||
− | | | + | |rowspan="3"| 0x2B |
+ | |rowspan="3"| Play | ||
+ | |rowspan="3"| Client | ||
+ | | Window ID | ||
| VarInt | | VarInt | ||
− | | | + | | A unique id number for the window to be displayed. Notchian server implementation is a counter, starting at 1. |
|- | |- | ||
− | | | + | | Window Type |
− | | | + | | VarInt |
− | | | + | | The window type to use for display. Contained in the <code>minecraft:menu</code> registry; see [[Inventory]] for the different values. |
|- | |- | ||
− | | | + | | Window Title |
− | | | + | | [[Chat]] |
− | + | | The title of the window. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
− | ==== | + | ==== Open Sign Editor ==== |
− | + | Sent when the client has placed a sign and is allowed to send [[#Update Sign|Update Sign]]. There must already be a sign at the given location (which the client does not do automatically) - send a [[#Block Update|Block Update]] first. | |
{| class="wikitable" | {| class="wikitable" | ||
Line 3,506: | Line 3,837: | ||
! Notes | ! Notes | ||
|- | |- | ||
− | | | + | | 0x2C |
− | + | | Play | |
− | + | | Client | |
− | | | + | | Location |
− | + | | Position | |
− | + | | | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | | ||
− | | | ||
|} | |} | ||
− | ==== | + | ==== Ping (play) ==== |
− |