Coder Social home page Coder Social logo

Comments (9)

Pandapip1 avatar Pandapip1 commented on August 24, 2024 1

the error is saying you're sending the packet with data that does not make sense

This was when running the example verbatim (except changing the version, obviously). This is definitely a bug.

Update: the login packet data has changed. The following code now produces some new errors, but the old ones are gone and I'm able to pass login:

import { createServer } from "minecraft-protocol";
import fs from 'fs/promises';
import sharp from "sharp";

const mcVersion = "1.20.2";

const mcData = require("minecraft-data")(mcVersion);

const server = createServer({
    // Host settings
    host: "0.0.0.0",
    port: 25565,
    socketType: "tcp",
    // Server settings
    kickTimeout: 10000,
    checkTimeoutInterval: 1000,
    "online-mode": true,
    keepAlive: true,
    version: false,
    hideErrors: false,
    validateChannelProtocol: true,
    enforceSecureProfile: false,
    enableChatPreview: false,
    // Configuration options
    motd: "A Minecraft Server TESTING",
    favicon: (await sharp(await fs.readFile("./assets/favicon.png")).resize({ width: 64, height: 64, fit: 'fill' }).png().toBuffer()).toString("base64"),
});


server.on('login', function(client) {
    const loginPacket = mcData.loginPacket
  
    console.log(`TEST 0`)
    client.write('login', {
        entityId: client.id,
        isHardcore: false,
        worldNames: loginPacket.worldNames,
        maxPlayers: server.maxPlayers,
        viewDistance: 10,
        simulationDistance: 10,
        reducedDebugInfo: false,
        enableRespawnScreen: true,
        doLimitedCrafting: false,
        worldType: loginPacket.worldType,
        worldName: 'minecraft:overworld',
        hashedSeed: [0, 0],
        gameMode: 0,
        previousGameMode: 255,
        isDebug: false,
        isFlat: false,
        death: {
            dimensionName: 'minecraft:overworld',
            location: {
                x: 0,
                y: 255,
                z: 0
            },
        },
        portalCooldown: 0,
    });
  
    console.log(`TEST 1`)
    client.write('position', {
        x: 0,
        y: 255,
        z: 0,
        yaw: 0,
        pitch: 0,
        flags: 0x00
    });
  
    const msg = {
        translate: 'chat.type.announcement',
        "with": [
            'Server',
            'Hello, world!'
        ]
    };
    
    console.log(`TEST 2`)
    client.write("chat", { message: JSON.stringify(msg), position: 0, sender: '0' });

    console.log(`TEST 3`)
});

There needs to be WAY better documentation and compatibility here!

from node-minecraft-protocol.

IceBrick01 avatar IceBrick01 commented on August 24, 2024

笑死

from node-minecraft-protocol.

LmanTW avatar LmanTW commented on August 24, 2024

thank you that help a lot

from node-minecraft-protocol.

Ice-Brick avatar Ice-Brick commented on August 24, 2024

笑死

from node-minecraft-protocol.

IceBrick01 avatar IceBrick01 commented on August 24, 2024

“log”

from node-minecraft-protocol.

Ice-Brick avatar Ice-Brick commented on August 24, 2024

有沒有總可能她不識來開MC SERVER嗎

from node-minecraft-protocol.

BasToTheMax avatar BasToTheMax commented on August 24, 2024

Any updates? Having the same issue

from node-minecraft-protocol.

Pandapip1 avatar Pandapip1 commented on August 24, 2024

Can repro for minecraft versions >=1.19 and was not able to repro for <=1.18.2

from node-minecraft-protocol.

rom1504 avatar rom1504 commented on August 24, 2024

the error is saying you're sending the packet with data that does not make sense

from node-minecraft-protocol.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.