Skip to content

Instantly share code, notes, and snippets.

@deathcap
Created January 31, 2016 07:07
Show Gist options
  • Save deathcap/7c9b94452b0d6f3d9429 to your computer and use it in GitHub Desktop.
Save deathcap/7c9b94452b0d6f3d9429 to your computer and use it in GitHub Desktop.
minecraft-data legacy ping decoding testing
+++ b/data/1.8/protocol.json
@@ -150,7 +150,14 @@
before:
"legacy_server_list_ping": {
"id": "0xfe",
"fields": [
{
"name": "payload",
"type": "ubyte"
}
]
}
trying to make the 'payload' field optional:
"legacy_server_list_ping": {
"id": "0xfe",
"fields": [
{
"name": "payload",
"type": ["switch",
{
"fields": {
"0": "ubyte"
},
"default": "void"
}
]
}
]
}
but testing with https://github.com/PrismarineJS/node-minecraft-protocol/pull/334, when a ping is received:
node-minecraft-protocol $ NODE_DEBUG=mc-proto node examples/server/server.js
Server listening on port 25565
events.js:141
throw er; // Unhandled 'error' event
^
TypeError: Deserialization error for handshaking.toServer.legacy_server_list_ping.payload : Read error for params.legacy_server_list_ping.payload : Cannot read property 'split' of undefined
at getField (/Users/admin/games/voxeljs/ProtoDef/dist/utils.js:12:33)
at ProtoDef.readSwitch (/Users/admin/games/voxeljs/ProtoDef/dist/datatypes/conditional.js:24:15)
at ProtoDef.read (/Users/admin/games/voxeljs/ProtoDef/dist/protodef.js:107:42)
at /Users/admin/games/voxeljs/ProtoDef/dist/datatypes/structures.js:114:32
at tryCatch (/Users/admin/games/voxeljs/ProtoDef/dist/utils.js:33:12)
at tryDoc (/Users/admin/games/voxeljs/ProtoDef/dist/utils.js:40:10)
at /Users/admin/games/voxeljs/ProtoDef/dist/datatypes/structures.js:113:5
at Array.forEach (native)
at ProtoDef.readContainer (/Users/admin/games/voxeljs/ProtoDef/dist/datatypes/structures.js:108:12)
at ProtoDef.read (/Users/admin/games/voxeljs/ProtoDef/dist/protodef.js:46:25)
https://github.com/PrismarineJS/minecraft-data/issues/95
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment