H
H
heito2020-05-22 22:07:12
JavaScript
heito, 2020-05-22 22:07:12

How to generate world for node-minecraft-protocol?

When I run the node index.js file and go to the server, there is nothing on it. I write to the chat the message is not sent, I hold TAB there is nothing there, but there is nothing there and that's it. How to make it so that it was like a normal server?
Here is the code I have

var mc = require('minecraft-protocol');
var server = mc.createServer({
    'online-mode': true,
    encryption: true,   
    host: '0.0.0.0',   
    port: 25566, 
    version: '1.15.2',
    motd: 'TEST SERVER',
    maxPlayers: 100
});
server.on('login', function(client) {
    client.write('login', {
        entityId: client.id,
        levelType: 'default',
        gameMode: 1,
        dimension: 0,
        difficulty: 2,
        hashedSeed: [0, 0],
        maxPlayers: server.maxPlayers,
        reducedDebugInfo: false,
        enableRespawnScreen: true
    });
    client.write('position', {
        x: 0,
        y: 1.62,
        z: 0,
        yaw: 0,
        pitch: 0,
        flags: 0x00
    });
    var msg = {
        translate: 'chat.type.announcement',
        "with": [
        'Server',
        'Hello, world!'
        ]
    };
    client.write("chat", { message: JSON.stringify(msg), position: 0 });
});

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
nitrojs, 2020-05-22
@nitrojs

99% reason is that Node.js just can't actually pull the minecraft server. We tested it with a friend about six months or a year ago, broke blocks or sent messages - they were sent in ~ 15 seconds , and sometimes blocks even returned to their place in half a minute.

P
profesor08, 2020-05-22
@profesor08

node-minecraft-protocol - Parse and serialize minecraft packets, plus authentication and encryption.
This is not a node.js minecraft server. This is a layer that can be used to monitor the transmitted data between the client and the server in order to perform any action on certain packets.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question