Difference between revisions of "Plugin channels"

From wiki.vg
Jump to navigation Jump to search
(→‎MC|AdvCdm: Add Track Output field)
Line 16: Line 16:
  
 
=== <code>MC|AdvCdm</code> ===
 
=== <code>MC|AdvCdm</code> ===
''Client -> Server''
+
''Client to Server''
  
 
Adventure mode command block.  
 
Adventure mode command block.  
Line 62: Line 62:
 
When a player edits an unsigned book.
 
When a player edits an unsigned book.
  
This payload is simply a set of bytes corresponding to an ItemStack. It is serialized / deserialized exactly the same as itemstacks in packets.
+
This payload is simply a set of bytes corresponding to an [[Slot Data|Slot]].
 +
 
 +
The [[NBT]] section of the Slot contains
 +
<code>
 +
  TAG_Compound(<nowiki>''</nowiki>): 1 entry
 +
  {
 +
    TAG_List('pages'): 2 entries
 +
    {
 +
      TAG_String(0): 'Something on Page 1'
 +
      TAG_String(1): 'Something on Page 2'
 +
    }
 +
  }
 +
</code>
  
 
=== <code>MC|BSign</code> ===
 
=== <code>MC|BSign</code> ===
Line 68: Line 80:
  
 
When a player signs a book.
 
When a player signs a book.
This payload is simply a set of bytes corresponding to an ItemStack. It is serialized / deserialized exactly the same as itemstacks in packets.
+
 
 +
This payload is simply a set of bytes corresponding to an [[Slot Data|Slot]].
 +
 
 +
The Item ID in the Slot should be a Written Book
 +
 
 +
The [[NBT]] section of the Slot contains
 +
<code>
 +
  TAG_Compound(<nowiki>''</nowiki>): 1 entry
 +
  {
 +
    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'
 +
    }
 +
  }
 +
</code>
  
 
=== <code>MC|BOpen</code> ===
 
=== <code>MC|BOpen</code> ===

Revision as of 08:20, 5 October 2015

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|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 an 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 an Slot.

The Item ID in the Slot should be a Written Book

The NBT section of the Slot contains

 TAG_Compound(''): 1 entry
 {
   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

Two-way

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

MC|RPack

Server to client

Remote resource packs. This contains a string representing the url to get the resource pack from. This channel has been replaced by the Resource Pack Send (Play, 0x48, clientbound) and Resource Pack Status (Play, 0x19, serverbound) packets.

MC|TrList

Server to client

The list of trades a villager NPC is offering.

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).

Notable community plugin channels

Channels listed in this section are not Mojang-sanctioned. This is just a likely-incomplete list of channels used by mods/plugins popular within the Minecraft community.

BungeeCord

See here

FML

Two-way

Used by Forge ModLoader to negotiate required mods, among other things. [1]

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.