-
-
Notifications
You must be signed in to change notification settings - Fork 238
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
custom_payload packet won't encode properly. #1256
Comments
What is schema for your custom_payload ? |
Everything you need is in the code above, node-mc-protocol should be able to re-encode packets generated by itself |
@extremeheat https://github.com/PrismarineJS/minecraft-data/blob/master/data/pc/1.17/protocol.json#L4949
|
|
|
So you cant just send custom_payloads with node-protocol? Direction: SERVERBOUND (does not matter, both ways) {"name":"custom_payload","params":{"channel":"minecraft:brand","data":{"type":"Buffer","data":[1,2,3,4,5,6,7,8,9,10]}}} And it can't even encode that, lemme remind you that chunk packets that are full of buffers are encoding correctly without problems, only that custom_payload is throwing some weird errors. is there something that i am missing? |
Did you try this example? https://github.com/PrismarineJS/node-minecraft-protocol/blob/master/examples%2Fclient_custom_channel%2Fclient_custom_channel.js Custom payload is a protodef protocol encoded payload. After registration, node minecraft protocol will try to parse registered custom channel messages. But you can just keep the protocol as a string like in the example. And parse the payload as json. I dont think Node minecraft protocol can parse json by itself. |
so if i wanted to make a proxy where i handle all that connecting stuff and just use protocol to decode/encode packets, is there any way i can register that channel? without using client/server, decoding works so i would be able to register it before i send anything. All that to make it work in the example code in the issue. |
[ ] The FAQ doesn't contain a resolution to my issue
Versions
Detailed description of a problem
A clear and concise description of what the problem is.
node-protocol cannot convert json -> byte from generated json
custom_payload packet cannot be encoded back from json.
Current code
Expected behavior
custom_payload should be converted back to Buffer
Behavior i got
Throws error when encoding custom_payload
Testing Payload
{"name":"custom_payload","params":{"channel":"minecraft:brand","data":{"type":"Buffer","data":[7,118,97,110,105,108,108,97]}}}
node:buffer:404
throw new ERR_INVALID_ARG_VALUE.RangeError('size', size);
^
RangeError [ERR_INVALID_ARG_VALUE]: The argument 'size' is invalid. Received NaN
Additional Context
All other packets including chunk/declare command/positions works, only custom_payload is affected.
The text was updated successfully, but these errors were encountered: