2018-05-13 16:50:16 -04:00
|
|
|
const mc = require('minecraft-protocol')
|
2016-08-10 12:54:06 -04:00
|
|
|
|
2017-07-13 08:03:52 -04:00
|
|
|
const server = mc.createServer({
|
2018-05-13 16:50:16 -04:00
|
|
|
'online-mode': false, // optional
|
|
|
|
encryption: false, // optional
|
|
|
|
host: '0.0.0.0', // optional
|
|
|
|
port: 25565, // optional
|
2016-08-10 12:54:06 -04:00
|
|
|
version: '1.10'
|
2018-05-13 16:50:16 -04:00
|
|
|
})
|
2016-08-10 12:54:06 -04:00
|
|
|
|
2018-05-13 16:50:16 -04:00
|
|
|
server.on('login', function (client) {
|
|
|
|
client.registerChannel('MC|Brand', ['string', []])
|
|
|
|
client.on('MC|Brand', console.log)
|
2016-08-10 12:54:06 -04:00
|
|
|
client.write('login', {
|
|
|
|
entityId: client.id,
|
|
|
|
levelType: 'default',
|
|
|
|
gameMode: 0,
|
|
|
|
dimension: 0,
|
|
|
|
difficulty: 2,
|
|
|
|
maxPlayers: server.maxPlayers,
|
|
|
|
reducedDebugInfo: false
|
2018-05-13 16:50:16 -04:00
|
|
|
})
|
2016-08-10 12:54:06 -04:00
|
|
|
client.write('position', {
|
|
|
|
x: 0,
|
|
|
|
y: 1.62,
|
|
|
|
z: 0,
|
|
|
|
yaw: 0,
|
|
|
|
pitch: 0,
|
|
|
|
flags: 0x00
|
2018-05-13 16:50:16 -04:00
|
|
|
})
|
|
|
|
client.writeChannel('MC|Brand', 'vanilla')
|
|
|
|
})
|