node-minecraft-protocol: 1.20.4 Login event never triggered on Node 18

Versions

  • minecraft-protocol: 1.47.0
  • node: 18.19.1

Detailed description of a problem

The protocol is broken on Node 18. Works fine on Node 20. The simplest way to reproduce it is to simply listen for a login event.

Current code

import { createServer } from "minecraft-protocol";

const options = {
   host: "127.0.0.1",
   motd: "test",
   port: 25565,
   maxPlayers: 20,
   version: "1.20.4"
}

const srv = createServer(options);

srv.on("login", client => {
   console.log("join");
});

Expected behavior

“join” is printed on the console when a client tries to join the server.

Actual behavior

Nothing is printed and one of the following happens

  • Client sees “Disconnected”
  • Client sees “IndexOutOfBounds”
  • Client sees “codecCorruptedFrameException”

Furthermore, the server may receive the following error (does not always happen either):

Disconnecting client because error Error: read ECONNRESET at TCP.onStreamRead (node:internal/stream_base_commons:217:20) {
  errno: -104,
  code: 'ECONNRESET',
  syscall: 'read'
}

Additional context

I’d like to ask you to adjust the supported engine value for this library to disclude older versions of Node, if this issue can’t be fixed easily.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 24 (9 by maintainers)

Most upvoted comments

I was trying to make a proxy and suddenly could not join any Minecraft-Protocol Server so I tested multiple versions of Minecraft such as 1.12.2, 1.16.5, and 1.19.2 and none of them worked.

When I join the server from the client it says:

  • Logging In
  • Encrypting
  • Disconnected

After I found this GitHub issue I tried v20.10.0 and it worked.

Node v18.0.0: Yes Node v18.20.2: No Node v19.0.0: Yes Node v19.9.0: No Node v20.0.0: Yes Node v20.10.0: Yes Node v20.12.2: No Node v21.0.0: Yes Node v21.7.3: No (Error) DeprecationWarning: The 'punycode' module is deprecated.

Internal Exception: io.netty.handler.codec.DecoderException:
java.lang.IndexOutOfBoundsException: Index: 94, Size: 5

Node v22.0.0: No