PrismarineJS / PrismarineJS/node-minecraft-protocol

example proxy is producing packet serialize/deserialize errors

Open
#786 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

non-vanilla waiting for info
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.25.0 but also a clone from master as a version supporting 1.16.5 has not been released
  • server: 1.16.5, vanilla
  • node: 14.16.1

Detailed description of a problem

When I run the example proxy and connect through it to a server, I'm getting errors like this:

client<-server: Error in packet play.entity_equipment
received buffer 47a9080001be04010a000003000644616d616765000000000002018105010a000003000644616d616765000000000003018005010a000003000644616d61676500000
000000401ff04010a000003000644616d61676500000000000501fe04010a000003000644616d6167650000000009000c456e6368616e746d656e74730a000000020200036c766c000208
0002696400146d696e6563726166743a70726f74656374696f6e000200036c766c0002080002696400146d696e6563726166743a756e627265616b696e670000
produced buffer 47a9080001be04010a000003000644616d6167650000000000
received length 205
produced length 25

They are all "server to client" packets, and all are getting truncated at 25.

Current code

  const bufferEqual = require('buffer-equal')
  proxyClient.on('raw', function (buffer, meta) {
    if (client.state !== states.PLAY || meta.state !== states.PLAY) { return }
    const packetData = proxyClient.deserializer.parsePacketBuffer(buffer).data.params
    const packetBuff = client.serializer.createPacketBuffer({ name: meta.name, params: packetData })
    if (!bufferEqual(buffer, packetBuff)) {
      console.log('client<-server: Error in packet ' + meta.state + '.' + meta.name)
      console.log('received buffer', buffer.toString('hex'))
      console.log('produced buffer', packetBuff.toString('hex'))
      console.log('received length', buffer.length)
      console.log('produced length', packetBuff.length)
    }

Expected behavior

Packets get passed without being changed.

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 at the example proxy's proxyClient.on('raw') handler and compare the received packet buffer with the buffer produced by client.serializer.createPacketBuffer. Use the reported play.entity_equipment example and the FAQ as context; done means server-to-client packets pass through without being truncated or changed.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.