Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with Deserializer #1308

Closed
XaviscoB opened this issue Jun 24, 2024 · 3 comments
Closed

Problems with Deserializer #1308

XaviscoB opened this issue Jun 24, 2024 · 3 comments

Comments

@XaviscoB
Copy link

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

Versions

  • minecraft-protocol: 1.47.0
  • server: Paper 1.8.9
  • node: 20.15.0

Detailed description of a problem

I'm trying to read the raw packets sent by the connection socket using the Deserializer provided by the lib following the example but it's not going according to plan, I'm not sure if my application is correct or if it's a problem with the Deserializer itself

Current code

const { createDeserializer, states } = require('minecraft-protocol')
const deserializer = createDeserializer({ state: states.STATUS, version: '1.8.9', isServer: false})

function convertBufferToObject (buffer) {
  return deserializer.parsePacketBuffer(buffer)
}

// ...
clientSocket.on('data', (data) => {
        console.log(convertBufferToObject(data))
        serverSocket.write(data)
 });

Expected behavior

I expected to receive the packet decoded and already partitioned, as is expected when we pull the event packet when creating a Client using the Minecraft Protocol

Additional context

image

In this specific context, I'm redirecting traffic to a proxy inside a client that's running externally, I tried using createClient to make the connection but it makes a connection to the server itself, I need only the packets to be decoded and partitioned

@rom1504
Copy link
Member

rom1504 commented Jun 24, 2024

You need all the transforms not only the serialization one

@XaviscoB
Copy link
Author

You need all the transforms not only the serialization one

Can you explain it better? I'm not sure I understand

@XaviscoB
Copy link
Author

You need all the transforms not only the serialization one

I took a look at the code and saw that it was right in front of me

I passed the received buffer through the socket in the following order

serializer -> framer -> socket -> splitter -> deserializer

it was literally written as a comment in the code, thank you very much for your attention, now I was able to read the packets correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants