LambdaControls Networking - LambdAurora/LambdaControls GitHub Wiki

Yes, this mod has some networking.

Why?

Well, it all started with the feature front_block_placement (#8), the problem with this feature is it can be considered cheating on some servers (and honestly shouldn't and I would love to see that feature in Vanilla).

The goal was simple: let servers disable the feature (and not ban everyone for no reasons).

Packets and sequence

There is 3 plugin messaging channels:

  • lambdacontrols:hello
  • lambdacontrols:controls_mode
  • lambdacontrols:feature

When the client connects, the following sequence should happen:

  • C -> S | lambdacontrols:hello
  • C <- S | lambdacontrols:feature
  • C -> S | lambdacontrols:controls_mode

lambdacontrols:hello

Sent by the client and tell the server to send the features settings.

Here's the content of the packet:

Type Size Description
String 16 Client mod version.
String 32 Client current controls mode.

lambdacontrols:controls_mode

Client -> Server

Sent by the client and tells the server the player's current controls mode. Should be sent when requested by the server or changed by the player.

Here's the content of the packet:

Type Size Description
String 32 Client current controls mode.

Client <- Server

Sent by the server and requests the client to send the player's current controls mode.

This packet is empty. The client is expected to answer.

lambdacontrols:feature

Sent by the server and tell the client if a feature is allowed or not. Should be sent by the server when the player connects or the configuration changes.

Type Size Description
VarInt Number of features.
Feature[] The features.

Feature object:

Type Size Description
String 64 Feature name.
bool Allow the client to use the feature.