Node plays modded

Hacking the Minecraft protocol

by in Dev
Tagged: minecraft | node.js

I've written an implementation of the Minecraft protocol in Nodejs.

It resembles the node-minecraft-protocol project, but it supports defining plugin channel protocols as well, so it supports modded clients / servers.

I intend to use it as a proxy, to be able to switch servers in real time and maybe gather some more profiling for the dashboard.

Test run:

Let's create a 1.7.10 client with Forge support.

var client = new mc.Client({
    version: '1.7.10',
    ext: ['forge-1.7.10']

Prepare the endpoints:

var ep = client.endpoint;
var fmlHS ='FML|HS');

Log in:

ep.on('connect', () => {
    ep.send('handshake', {
        protocolVersion: 5,
        serverAddress: 'localhost',
        serverPort: 25565,
        nextState: 2

    ep.send('loginStart', { name: playerName });

Maintain the keep alive:

ep.on('keepAlive', (data) => {
    ep.send('keepAlive', { id: });

And move when we join the game:

ep.on('joinGame', () => {
    var myPos;

    ep.on('playerPosLook', (d) => {
        myPos = d;

    setInterval(() => {
        myPos.stance = Math.round(myPos.y - 1.62);
        ep.send('playerPosition', myPos);
        myPos.z -= 0.01;
    }, 50);


Here's a test run with about 20 bots running left to right.

Sadly, I need to do some more optimizations, as at around 50 clients, the cpu load jumps at around 15~20%, which is unnacceptable for a proxy. Or I might disable packet inspection and just pass data through until some interesting event is triggered.