Skip to content

Instantly share code, notes, and snippets.

@navarr
Created July 5, 2013 01:41
Show Gist options
  • Save navarr/5931158 to your computer and use it in GitHub Desktop.
Save navarr/5931158 to your computer and use it in GitHub Desktop.
Minecraft Server Hello World
var mc = require('minecraft-protocol');
var server = mc.createServer({
'online-mode': true,
host: '0.0.0.0',
port: 25565,
});
server.on('login', function(client) {
client.write(0x01, {
entityId: client.id,
levelType: 'default',
gameMode: 0,
dimension: 0,
difficulty: 2,
maxPlayers: server.maxPlayers
});
client.write(0x0d, {
x: 0,
y: 1.62,
stance: 0,
z: 0,
yaw: 0,
pitch: 0,
onGround: true
});
client.write(0x03, { message: 'Hello, ' + client.username });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment