Difference between revisions of "Plugin channels"

From wiki.vg
Jump to navigation Jump to search
(→‎MC|TrList: Document packet structure)
Line 51: Line 51:
  
 
depending on the ''mode''
 
depending on the ''mode''
 +
 +
=== <code>MC|AutoCmd</code> ===
 +
''Client to server''
 +
 +
Sets command block data; this seems to be a newer version of <code>MC|AdvCmd</code> but the older version still works.
 +
 +
{| class="wikitable"
 +
! Field Name !! Field Type !! Notes
 +
|-
 +
| X || Int ||
 +
|-
 +
| Y || Int ||
 +
|-
 +
| Z || Int ||
 +
|-
 +
| Command || String ||
 +
|-
 +
| Track output || Boolean || If false, the output of the previous command will not be stored within the command block.
 +
|-
 +
| Mode || String enum || One of "SEQUENCE", "AUTO", and "REDSTONE"
 +
|-
 +
| Is conditional || Boolean ||
 +
|-
 +
| Automatic || Boolean ||
 +
|}
  
 
=== <code>MC|Beacon</code> ===
 
=== <code>MC|Beacon</code> ===
Line 110: Line 135:
 
When a player uses an anvil to name an item. The payload is just a string: the item's new name.
 
When a player uses an anvil to name an item. The payload is just a string: the item's new name.
  
=== <code>MC|RPack</code> ===
+
=== <code>MC|Struct</code> ===
''Server to client''
+
''Client to server''
 +
 
 +
Does something with the (inaccessible) {{Minecraft Wiki|Structure block}}.
 +
 
 +
{| class="wikitable"
 +
! Field Name
 +
! Field Type
 +
! Notes
 +
|-
 +
| X || Int || Tile entity location
 +
|-
 +
| Y || Int || Tile entity location
 +
|-
 +
| Z || Int || Tile entity location
 +
|-
 +
| Action
 +
| Byte
 +
| See below
 +
|-
 +
| Mode
 +
| String enum
 +
| One of "SAVE", "LOAD", "CORNER", "DATA".
 +
|-
 +
| Name
 +
| String
 +
|
 +
|-
 +
| Position X || Int || ?
 +
|-
 +
| Position Y || Int || ?
 +
|-
 +
| Position Z || Int || ?
 +
|-
 +
| Size X || Int || ?
 +
|-
 +
| Size Y || Int || ?
 +
|-
 +
| Size Z || Int || ?x
 +
|-
 +
| Mirror
 +
| String enum
 +
| One of "NONE", "LEFT_RIGHT", "FRONT_BACK".
 +
|-
 +
| Rotation
 +
| String enum
 +
| One of "NONE", "CLOCKWISE_90", "CLOCKWISE_180", "COUNTERCLOCKWISE_90".
 +
|-
 +
| Metadata
 +
| String
 +
| ?
 +
|-
 +
| Ignore entities
 +
| Boolean
 +
|
 +
|}
 +
 
 +
Possible modes:
 +
 
 +
* 2 - Save the structure
 +
* 3 - Load the structure
 +
* 4 - Detect size
 +
 
 +
=== <code>MC|PickItem</code> ===
 +
''Client to server''
 +
 
 +
Swaps out an item at the given inventory index(?) with an item on the hotbar.  The server sends back several packets.  TODO: Document them.
  
Remote resource packs. This contains a string representing the url to get the resource pack from. This channel has been replaced by the [[Protocol#Resource Pack Send|Resource Pack Send]] ([[Protocol#Play|Play]], 0x48, clientbound) and [[Protocol#Resource Pack Status|Resource Pack Status]] ([[Protocol#Play|Play]], 0x19, serverbound) packets.
+
Payload is a single varint.
  
=== <code>MC|TrList</code> ===
+
=== <code>MC|TrList</code> ===
 
''Server to client''
 
''Server to client''
  
Line 179: Line 269:
  
 
Announces the server and client implementation name right after a player has logged in. For Minecraft and the standard Minecraft server, this is "vanilla" (encoded as a UTF-8 string).
 
Announces the server and client implementation name right after a player has logged in. For Minecraft and the standard Minecraft server, this is "vanilla" (encoded as a UTF-8 string).
 +
 +
=== <code>MC|DebugPath</code> ===
 +
''Server to client''
 +
 +
Never sent, but does something with pathfinding debugging.
  
 
== Notable community plugin channels ==
 
== Notable community plugin channels ==

Revision as of 05:25, 6 March 2016

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

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.

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.

Channels internal to Minecraft

As of 1.3, Minecraft itself started using 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.

MC|AdvCdm

Client to Server

Adventure mode command block.

The first byte is type which is followed by either:

Type Field Name Field Type Notes
0x00 X Int
Y Int
Z Int
Command String
Track Output Boolean

or

Type Field Name Field Type Notes
0x01 Entity ID Int
Command String
Track Output Boolean

depending on the mode

MC|AutoCmd

Client to server

Sets command block data; this seems to be a newer version of MC|AdvCmd but the older version still works.

Field Name Field Type Notes
X Int
Y Int
Z Int
Command String
Track output Boolean If false, the output of the previous command will not be stored within the command block.
Mode String enum One of "SEQUENCE", "AUTO", and "REDSTONE"
Is conditional Boolean
Automatic Boolean

MC|Beacon

Client to server

Two integers corresponding to the 2 effects a user wishes to have active.

MC|BEdit

Client to server

When a player edits an unsigned book.

This payload is simply a set of bytes corresponding to a Slot.

The NBT section of the Slot contains

 TAG_Compound(''): 1 entry
 {
   TAG_List('pages'): 2 entries
   {
     TAG_String(0): 'Something on Page 1'
     TAG_String(1): 'Something on Page 2'
   }
 }

MC|BSign

Client to server

When a player signs a book.

This payload is simply a set of bytes corresponding to a Slot.

The Item ID in the Slot should be a Written Book

The NBT section of the Slot contains

 TAG_Compound(''): 3 entires
 {
   TAG_String('author'): 'Steve'
   TAG_String('title'): 'A Wonderful Book'
   TAG_List('pages'): 2 entries
   {
     TAG_String(0): 'Something on Page 1'
     TAG_String(1): 'Something on Page 2'
   }
 }

MC|BOpen

Server to client

When a player right clicks with a signed book. This tells the client to open the book GUI. This payload is empty.

MC|ItemName

Client to server

When a player uses an anvil to name an item. The payload is just a string: the item's new name.

MC|Struct

Client to server

Does something with the (inaccessible) Structure block.

Field Name Field Type Notes
X Int Tile entity location
Y Int Tile entity location
Z Int Tile entity location
Action Byte See below
Mode String enum One of "SAVE", "LOAD", "CORNER", "DATA".
Name String
Position X Int ?
Position Y Int ?
Position Z Int ?
Size X Int ?
Size Y Int ?
Size Z Int ?x
Mirror String enum One of "NONE", "LEFT_RIGHT", "FRONT_BACK".
Rotation String enum One of "NONE", "CLOCKWISE_90", "CLOCKWISE_180", "COUNTERCLOCKWISE_90".
Metadata String ?
Ignore entities Boolean

Possible modes:

  • 2 - Save the structure
  • 3 - Load the structure
  • 4 - Detect size

MC|PickItem

Client to server

Swaps out an item at the given inventory index(?) with an item on the hotbar. The server sends back several packets. TODO: Document them.

Payload is a single varint.

MC|TrList

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 tool uses Int May actually be the number of times this trade has been used; MCP may be misleading me
Maximum number of trade uses Int Number of times this trade can be used

MC|TrSel

Client to server

When a player selects a specific trade offered by a villager NPC. It contains a single int id corresponding to the selected slot int the players current (trading) inventory.

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.

MC|Brand

Two-way

Announces the server and client implementation name right after a player has logged in. For Minecraft and the standard Minecraft server, this is "vanilla" (encoded as a UTF-8 string).

MC|DebugPath

Server to client

Never sent, but does something with pathfinding debugging.

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

See here

FML|HS, FML

Two-way

Used by Minecraft Forge to negotiate required mods, among other things. FML|HS FML

For more information, see Minecraft Forge Handshake.

ML|OpenTE

Server to client

Used by ModLoader to support custom GUI windows. Does not use the REGISTER channel.

WECUI

Two-way

Used by the server-side WorldEdit and the client-side WorldEditCUI to coordinate selections.