PrismarineJS / PrismarineJS/node-minecraft-protocol

Failed to decode packet cookie_request

Open
#1,389 28 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

possible bug
Dominant language
JavaScript
Stars
1.4k
Forks
290
Avg merge
4d 8h
Merged PRs (30d)
7

Description

[x] The FAQ doesn't contain a resolution to my issue

Versions

  • minecraft-protocol: 1.55.0
  • server: vanilla/spigot/paper 1.21.4
  • node: 22.14.0

Detailed description of a problem

I'm trying to set up a simple offline-mode server that (currently) only spawns the player in a void world. The following code works for other versions (tested for 1.8 with slight adaptations to the login packet, 1.18, 1.19 and 1.20 with the same code, different data versions). Attempting to run the same code with 1.21 results in the connection being lost and the following error being shown:

Internal Exception: io.netty.handler.codec.DecoderException: Failed to decode packet 'clientbound/minecraft:cookie_request'.

Current code

const mc = require("minecraft-protocol")
const mcData = require("minecraft-data")("1.21")

const server = mc.createServer({
  host: "127.0.0.1",
  port: 25565,
  version: "1.21",
  "online-mode": false,
})

server.on("login", (client) => {
  const p = mcData.loginPacket
  console.log(p)
  client.write("login", {
    ...p,
  })
  client.write("position", {
    x: 0,
    y: 0,
    z: 0,
    yaw: 0,
    pitch: 0,
  })
})

Expected behavior

The client should spawn in an empty world at the coordinates 0/0/0 immediately upon joining the server.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure using the supplied createServer setup and the 1.21 login and position writes. Inspect how the 1.21 protocol handles the clientbound minecraft:cookie_request packet and compare it with the provided login packet data; done means a 1.21 client joins the offline-mode server and spawns at 0/0/0 without the decoder error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.