Difference between revisions of "Plugin channels"
(Merge 1.13 information) |
(→minecraft:trader_list: not tool uses) |
||
Line 77: | Line 77: | ||
| True if the trade is disabled; false if the trade is enabled. | | True if the trade is disabled; false if the trade is enabled. | ||
|- | |- | ||
− | | Number of | + | | Number of trade uses |
| Int | | Int | ||
− | | | + | | Number of times the trade has been used so far |
|- | |- | ||
| Maximum number of trade uses | | Maximum number of trade uses |
Revision as of 05:21, 11 January 2019
Plugin channels allow client mods and server plugins to communicate without cluttering up chat. This post by Dinnerbone is a good introduction and basic documentation.
Reserved channels
minecraft:register
Two-way
Allows the client or server to register for one or more custom channels, indicating that data should be sent on those channels if the receiving end supports it too. Payload is a null (0x00
) separated list of strings.
This channel was renamed from REGISTER
in 1.13.
minecraft:unregister
Two-way
Allows the client or server to unregister from one or more custom channels, indicating that the receiving end should stop sending data on those channels. Payload is a null-separated list of strings. This is only useful if plugins are disabled/unloaded while the client is connected.
This channel was renamed from UNREGISTER
in 1.13.
Channels internal to Minecraft
Since 1.3, Minecraft itself uses several plugin channels to implement new features. These internal channel names are prefixed by MC|
. They are not formally registered using the register channel. The vanilla Minecraft server will send these packets regardless, and the vanilla client will accept them.
Note that there were originally more channels included, but most of these were removed in 1.13. See this revision of the article for the original list.
minecraft:brand
Two-way
Announces the server and client implementation name right after a player has logged in. For the Notchian client and server server, this is "vanilla" (which is chosen using the Function net.minecraft.client.ClientBrandRetriever.getClientModName()
) (encoded as a protocol string: a UTF-8 string with the length prefixed as a VarInt).
These brands are used in crash reports and a few other locations; it's recommended that custom clients and servers use changed brands for the purpose of identification (for the Notchian client, the class used to get the brand is one of the few non-obfuscated classes). The brand is not processed in any other way, and Notchian clients will connect to servers with changed brands with no issue (the brand is not used to validate).
The Notchian server sends a MC|Brand
packet right after it sends a Join Game packet, and the Notchian client sends it right after receiving a Join Game packet. However, some modified clients and servers will not send this packet (or will take longer to send it than normal), so it is important to not crash if the brand has not been sent. Additionally, the brand may change at any time (for instance, if connected through a BungeeCord instance, you may switch from a server with one brand to a server with another brand without receiving a Join Game packet).
minecraft:book_open
Server to client
When a player right clicks with a signed book. This tells the client to open the book GUI.
The payload is a VarInt enum for the selected hand: 0 for the main hand, 1 for the offhand.
minecraft:trader_list
Server to client
The list of trades a villager NPC is offering.
Field Name | Field Type | Notes | ||
---|---|---|---|---|
Window ID | Int | The ID of the window that is open; this is an int rather than a byte. | ||
Size | Byte | The number of trades in the following array | ||
Trades | Input item 1 | Array | Slot | The first item the villager is buying |
Output item | Slot | The item the villager is selling | ||
Has second item | Boolean | Whether there is a second item | ||
Input item 2 | Optional slot | The second item the villager is buying; only present if they have a second item. | ||
Trade disabled | Boolean | True if the trade is disabled; false if the trade is enabled. | ||
Number of trade uses | Int | Number of times the trade has been used so far | ||
Maximum number of trade uses | Int | Number of times this trade can be used |
minecraft:debug/paths
Server to client
Never sent, but does something with pathfinding debugging. The client reads the data and stores it, but its renderer cannot be enabled without modifications.
Name | Type | Notes |
---|---|---|
Unknown 1 | Int | Used as a key in the mapping that stores this data; might be an entity ID? |
Unknown 2 | Float | Appears to be the "radius" of the squares for each pathpoint |
Entity | PathEntity | See below |
PathEntity structure:
Name | Type | Notes |
---|---|---|
Current path index | Int | Index in the points array that the entity is currently targeting. That point is rendered red; the others are rendered blue. |
Target | PathPoint | Rendered as a green cube |
Number of points | Int | Number of elements in the following array |
Points array | Array of PathPoint | The actual points on the path |
Open set length | Int | Number of elements in the following array |
Open set | Array of PathPoint | Displayed in blue |
Closed set length | Int | Number of elements in the following array |
Closed set | Array of PathPoint | Displayed in red |
PathPoint structure:
Name | Type | Notes |
---|---|---|
X | Int | |
Y | Int | |
Z | Int | |
Distance from origin | Float | |
Cost | Float | |
Cost malus | Float | Number that is rendered |
Has been visited | Boolean | |
Node type | Int enum | See below |
Distance to target | Float |
Values for node type:
- 0: BLOCKED
- 1: OPEN
- 2: WALKABLE
- 3: TRAPDOOR
- 4: FENCE
- 5: LAVA
- 6: WATER
- 7: RAIL
- 8: DANGER_FIRE
- 9: DAMAGE_FIRE
- 10: DANGER_CACTUS
- 11: DAMAGE_CACTUS
- 12: DANGER_OTHER
- 13: DAMAGE_OTHER
- 14: DOOR_OPEN
- 15: DOOR_WOOD_CLOSED
- 16: DOOR_IRON_CLOSED
minecraft:debug/neighbors_update
Server to client
Never sent, but used to debug block updates. Does not render without modifying the client.
This channel is invalid, as its name is longer than the max length (23 > 20).
Name | Type | Notes |
---|---|---|
Time | VarLong | World timestamp at which the update occurred. 200 ticks after this timestamp, the given update stops rendering. |
Location | Position | Location of the block that updated. |
minecraft:debug/caves
Never sent, but (presumably) used to debug caves. Does not render without modifying the client.
Field name | Field type | Notes | ||
---|---|---|---|---|
Cave position | Position | Rendered as a white cube; also used to determine the color of the other parts. | ||
Count | Int | Number of elements in the following array | ||
Data | Sub position | Array | Position | |
Radius | Float | Size of the area, as half of the side-length |
minecraft:debug/structures
Never sent, but (presumably) used to debug structures. Does not render without modifying the client.
Adds a single new structure, which will always be rendered if the player is in the same dimension.
Field name | Field type | Notes | ||
---|---|---|---|---|
Dimension | Int | The dimension the structure is in. | ||
Bounding box minX | Int | Main box for the structure (rendered in white). min must be less than max | ||
Bounding box minY | Int | |||
Bounding box minZ | Int | |||
Bounding box maxX | Int | |||
Bounding box maxY | Int | |||
Bounding box maxZ | Int | |||
Count | Int | Number of elements in the following array | ||
Sub-boxes | Bounding box minX | Array | Int | min must be less than max |
Bounding box minY | Int | |||
Bounding box minZ | Int | |||
Bounding box maxX | Int | |||
Bounding box maxY | Int | |||
Bounding box maxZ | Int | |||
Flag | Boolean | If true, the sub-box is rendered in green, otherwise in blue. |
minecraft:debug/worldgen_attempt
Never sent, but (presumably) used to debug something with world generation. Does not render without modifying the client.
Adds a colored cube of the list of things to render. This cube is never removed.
This channel is invalid, as its name is longer than the max length (23 > 20).
Field name | Field type | Notes |
---|---|---|
Location | Position | The center of the location to render. |
Size | Float | Diameter/side length of a cube to render. |
Red | Float | Red value to render, from 0.0 to 1.0. |
Green | Float | Green value to render, from 0.0 to 1.0. |
Blue | Float | Blue value to render, from 0.0 to 1.0. |
Alpha | Float | Alpha value to render, from 0.0 to 1.0. |
MC|PingHost
Client to server
Sent after a Server list ping in Minecraft 1.6. More information on Server List Ping#1.6. In 1.7 and above, the Request (Status, 0x00, serverbound) packet is instead sent before the ping.
Since this plugin channel is only sent for the legacy server list ping, it uses the older packet structure.
Notable community plugin channels
Channels listed in this section are not used by the vanilla Minecraft client or server. This is just a likely-incomplete list of channels used by mods/plugins popular within the Minecraft community.
bungeecord:main
Formerly BungeeCord
; additionally, note that the channel name is remapped by spigot so that the old name can still be used in plugins.
FML|HS
, FML
- Main article: Minecraft Forge Handshake
Used by Minecraft Forge to negotiate required mods, among other things.
FML|HS
FML
ML|OpenTE
Server to client
Used by ModLoader to support custom GUI windows. Does not use the REGISTER channel.
WECUI
- Main article: /WorldEditCUI
Used by the server-side WorldEdit and the client-side WorldEditCUI to coordinate selections.
wdl:init
, wdl:control
, wdl:request
- Main article: /World downloader
Used by the client-side World Downloader mod to get permission information and perform permission requests.