Skip to content

Olafcio1/ProtocolExtension

Repository files navigation

ProtocolExtension

Minecraft protocol additions

GitHub Downloads (all assets, all releases) Modrinth Downloads
GitHub last commit

🤔 What is ProtocolExtension

PX* adds more packets to the game so servers can further customize gameplay without making their own client-side mod for the clients to install.

This makes it easier for both the servers, and the players, as it is a universal solution for potentially lots of servers, without degrading user experience - you can still play servers without PX with PX installed client-side, and on servers with PX without it installed client-side.

[1]: ProtocolExtension

🪶 Packets

Name Brief Version
[Serverbound]
ActivatePayload Sent first when the client supports PX. v3
KeyPressedC2SPayload Sent when the client presses a key in-game. v1
MouseMoveC2SPayload Sent when the client moves the mouse in a screen. v1
[Clientbound]
ActivatePayload Sent back when the server supports PX too. v2
HUDClearS2CPayload Clears all previously created HUD elements by the server. v2
HUDDeleteElementS2CPayload Deletes a HUD element previously created by the server. v1
HUDPutElementS2CPayload Adds or modifies a HUD element previously created by the server. v1
HUDSettingHotbarS2CPayload Toggle the hotbar visibility. v3
HUDToggleS2CPayload Toggles HUD visibility. v1
MoveToggleS2CPayload Toggles movement ticking logic. v3
ServerCommandS2CPayload Sets the player's sneaking and sprinting states. v2
SetWindowTitleS2CPayload Changes the player's window title. v2
SetPerspectiveS2CPayload Changes the player's camera perspective. v6

🎐 Quickstart

To start developing with ProtocolExtension, first you need to have a Java IDE installed. I provide support only for IntelliJ IDEA.

  1. Create a Paper plugin project:

    the easiest method is using the Minecraft Development IDE plugin.

  2. Embed ProtocolExtension into your project:

    the recommended method is embedding its implementation JAR file in your project structure and adding it as a compile-only dependency in your package manager.

    • download the latest jar file for your specific version, e.g. here for 1.21.11, and add it to the libs/ directory
    • add the following code to your maven.pom
      <dependency>
            <groupId>pl.olafcio</groupId>
            <artifactId>protocolextension</artifactId>
            <version>10</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/libs/protocolextension-10.jar</systemPath>
            <optional>true</optional>
      </dependency>
  3. Sync the project

    you should see a button appear with your package manager and a refresh icon in the top-right corner of IntelliJ. click it, and your project dependencies should update.

  4. Try ProtocolExtension's API

    when PX is ready to use, go to your plugin's main class (typically named after your project's name) and add this code:

    import net.kyori.adventure.text.Component;
    import org.bukkit.event.EventHandler;
    import pl.olafcio.ProtocolExtension;
    
    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        ProtocolExtension.getAPI().playerManager().putHUD(event.getPlayer(), 1, 0d, 0d, Component.text("Hello, guy!"));
    }

An online documentation covering all topics related to ProtocolExtension will be available soon. For those wanting to help, please comment on this issue.

⚙️ Version compatibility

Name State Download Link
1.21.11 Supported ./versions/1.21.11/bin/protocolextension
1.21.10 Supported ./versions/1.21.10/bin/protocolextension
1.21.9 Supported ./versions/1.21.9/bin/protocolextension
1.21.8 Supported ./versions/1.21.8/bin/protocolextension
1.21.7 Supported ./versions/1.21.7/bin/protocolextension
1.21.6 Supported ./versions/1.21.6/bin/protocolextension
1.21.5 Supported ./versions/1.21.5/bin/protocolextension
1.21.4 Supported ./versions/1.21.4/bin/protocolextension
1.21.3 Supported ./versions/1.21.3/bin/protocolextension
1.21.2 Supported ./versions/1.21.2/bin/protocolextension
1.21.1 Supported ./versions/1.21.1/bin/protocolextension
1.21 Supported ./versions/1.21/bin/protocolextension
1.20.6 Supported ./versions/1.20.6/bin/protocolextension

Languages