-
-
Notifications
You must be signed in to change notification settings - Fork 37
Client Server Mod Protocol
VeinMiner takes advantage of Minecraft's custom payload packet to send messages to and from the client to interact with an optional cient sided mod. To do this, VeinMiner makes use of a specific sequence of bytes to identify specific messages and the data they contain. The following outlines the communications between client and server for VeinMiner's payloads.
VeinMiner does take advantage of types similar to that of Minecraft's default protocol which you may read about here.
Every message is prefixed with a series of bytes representing a VarInt (as per Minecraft's protocol specification) identifying the message's id, followed by the data displayed in the tables below.
Index | Type | Details |
---|---|---|
0 | VarInt | The message's id (see protocol documentation below) |
1 | Content | The contents of the message. Varies from message to message |
-
Channel:
veinminer:veinminer
-
Version:
1
These are messages sent from the client to the server.
Sent by the client when logging in to inform the server that the client has the VeinMiner client-sided mod installed. The server is expected to respond promptly with a Handshake Response. Upon receiving this message, the server will automatically set the player's activation mode to CLIENT.
Packet ID | Bound To | Field Name | Field Type | Notes |
---|---|---|---|---|
0x0 | Server | Protocol Version | VarInt | The client's protocol version |
Sent by the client to inform the server that it has activated or deactivated its vein miner keybind.
Packet ID | Bound To | Field Name | Field Type | Notes |
---|---|---|---|---|
0x1 | Server | State | Boolean | The new state of the vein miner activation |
Sent by the client to request the server to perform a no-op vein mine on the block at which the player is currently looking. The player's active tool category, and all other vein miner required information is calculated on the server, not by the client, exception to the provided origin position.
Note that if the player's target block is also calculated on the server but the server will make use of the position sent by the client such that it is within 2 blocks of the server calculated block position. If the position sent to the server exceeds the 2 block distance limit, the server will respond with an empty vein mine result.
Packet ID | Bound To | Field Name | Field Type | Notes |
---|---|---|---|---|
0x2 | Server | Origin | BlockPosition | The position at which to initiate vein miner |
Sent by the client when it wants to change vein mining patterns as a result of a key press. The server is expected to respond with a Set Pattern message to confirm that the requested pattern is to be set on the client, however the server is not guaranteed to respond in the event that the request was unsuccessful.
Packet ID | Bound To | Field Name | Field Type | Notes |
---|---|---|---|---|
0x3 | Server | Pattern Key | NamespacedKey | The key of the pattern to request to be set |
These are messages sent by the server to the client.
Sent in response to a client's Handshake. This message contains no additional data (yet) and acts primarily as a server acknowledgement of the client mod.
Packet ID | Bound To |
---|---|
0x0 | Client |
Sent by the server after the client has successfully shaken hands and has been sent the handshake response. Synchronizes the server's registered pattern keys with the client so that it may switch between patterns using a key bind.
Packet ID | Bound To | Field Name | Field Type | Notes |
---|---|---|---|---|
0x1 | Client | Size | VarInt | The amount of patterns being sent to the client |
Pattern Keys | Array of NamespacedKey | An array containing the namespaced keys of all vein mining patterns registered on the server |
Sent by the server after the client's handshake, or when the server reloads its configuration, to set the client's capabilities. The client is expected to respect these values to avoid network overhead, but the server performs additional checks and will not respond to incoming messages if a specific feature is disabled by the server.
Packet ID | Bound To | Field Name | Field Type | Notes | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
0x2 | Client | Config Bitmask |
|
A bitmask of configured values |
Sent in response to a client's Request Vein Mine including all block positions as a result of a vein mine at the client's target block and currently active tool category (according to the tool in the player's hand at the time the message was received by the server).
Packet ID | Bound To | Field Name | Field Type | Notes |
---|---|---|---|---|
0x3 | Client | Size | VarInt | The amount of block positions that were included in the resulting vein mine |
Positions | Array of BlockPosition | An array containing all block positions that would be vein mined by the server |
Sets the selected pattern on the client. Sent in response to a server-bound Select Pattern message from the client, or when set by the server manually. If the client does not recognize this pattern key, the client should fall back to the pattern at index 0 of the patterns that were sent by the Sync Registered Patterns message.
Packet ID | Bound To | Field Name | Field Type | Notes |
---|---|---|---|---|
0x4 | Client | Pattern Key | NamespacedKey | The pattern key to set on the client |
-
Channel:
veinminer:activation
-
Version:
1
The legacy protocol is supported ONLY by VeinMiner 1.x and 2.0.0. VeinMiner 2.1.0 DOES NOT SUPPORT THIS PROTOCOL. This protocol should be avoided at all costs.
These are messages sent from the client to the server.
Sent by the client when logging in to inform the server that the client has the VeinMiner client-sided mod installed. The server is expected to respond promptly with a Handshake Response. Upon receiving this message, the server will automatically set the player's activation mode to CLIENT.
Packet ID | Bound To | Field Name | Field Type | Notes |
---|---|---|---|---|
0x0 | Server | Protocol Version | VarInt | The client's protocol version |
Sent by the client to inform the server that it has activated or deactivated its vein miner keybind.
Packet ID | Bound To | Field Name | Field Type | Notes |
---|---|---|---|---|
0x1 | Server | State | Boolean | The new state of the vein miner activation |
There are no client-bound messages in the legacy protocol.