PrismarineJS / PrismarineJS/node-minecraft-protocol

How to make player enters my prismarine world???

Open
#1,446 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I have this code:

const mc = require('minecraft-protocol');

const server = mc.createServer({
  'online-mode': false, // para pruebas
  encryption: true,
  host: '0.0.0.0',
  port: 25565,
  version: '1.16.4'
});










server.on('login', (client) => {
  console.log('Jugador conectado:', client.username);

  // Mandar un paquete de posición inicial
  client.write('position', {
    x: 0,
    y: 5,
    z: 0,
    yaw: 0,
    pitch: 0,
    flags: 0x00
  });

  // Mandar el chunk que generaste
  const chunkData = chunk.dump(); // convierte tu chunk en datos binarios
  client.write('map_chunk', {
    x: 0,
    z: 0,
    groundUp: true,
    bitMap: chunkData.bitMap,
    chunkData: chunkData.buffer,
    blockEntities: []
  });
});

And the console says this:

C:\Users\usuario\Pictures\server.mc.js>node server2.js
Bloque en (0,0,0): granite | stateId: 2 | displayName: Granite
Jugador conectado: CCCPMadDrFrank
Disconnecting client because error TypeError: SizeOf error for undefined : Cannot read properties of undefined (reading 'type')
at Object.nbt (eval at compile (C:\Users\usuario\Pictures\server.mc.js\node_modules\protodef\src\compiler.js:262:12), :63:24)
at Object.packet_map_chunk (eval at compile (C:\Users\usuario\Pictures\server.mc.js\node_modules\protodef\src\compiler.js:262:12), :1116:24)
at eval (eval at compile (C:\Users\usuario\Pictures\server.mc.js\node_modules\protodef\src\compiler.js:262:12), :2405:58)
at packet (eval at compile (C:\Users\usuario\Pictures\server.mc.js\node_modules\protodef\src\compiler.js:262:12), :2463:9)
at CompiledProtodef.sizeOf (C:\Users\usuario\Pictures\server.mc.js\node_modules\protodef\src\compiler.js:89:14)
at e.message (C:\Users\usuario\Pictures\server.mc.js\node_modules\protodef\src\compiler.js:96:40)
at tryCatch (C:\Users\usuario\Pictures\server.mc.js\node_modules\protodef\src\utils.js:50:16)
at CompiledProtodef.createPacketBuffer (C:\Users\usuario\Pictures\server.mc.js\node_modules\protodef\src\compiler.js:96:20)
at Serializer.createPacketBuffer (C:\Users\usuario\Pictures\server.mc.js\node_modules\protodef\src\serializer.js:12:23)
at Serializer._transform (C:\Users\usuario\Pictures\server.mc.js\node_modules\protodef\src\serializer.js:18:18) {
field: 'play.toClient'
}

How to solve this and make player enters the world?

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

Start by reproducing the provided server code and follow the map_chunk serialization path shown in the protodef stack trace. Inspect the packet fields passed to client.write('map_chunk'), especially the data reaching the NBT serializer. Done means the packet serializes without the TypeError and a client can enter the world.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.