PrismarineJS / node-minecraft-protocol

Parse and serialize minecraft packets, plus authentication and encryption.
https://prismarinejs.github.io/node-minecraft-protocol/
BSD 3-Clause "New" or "Revised" License
1.23k stars 239 forks source link

Error: Deserialization error for play.toClient : Read error for name : 97 is not in the mappings value #358

Closed deathcap closed 8 years ago

deathcap commented 8 years ago

https://github.com/PrismarineJS/node-minecraft-protocol/commit/b2b8ad2372fe68dc414064630f98b18451e5c76c seems to have introduced serialization issues. Testing with latest master https://github.com/PrismarineJS/node-minecraft-protocol/commit/51a5e2c6d0569537ee67e86be8959db8bcbac33e, and with node-minecraft-data 0.20.1:

node-minecraft-protocol $ node examples/client_auto/client_auto.js localhost 17100
connected
/Users/admin/games/voxeljs/node-minecraft-protocol/dist/transforms/framing.js:114
          } else throw e;
                 ^

Error: Deserialization error for play.toClient : Read error for name : 97 is not in the mappings value
    at ProtoDef.readMapper (/Users/admin/games/voxeljs/node-minecraft-protocol/node_modules/protodef/dist/datatypes/utils.js:37:41)
    at ProtoDef.read (/Users/admin/games/voxeljs/node-minecraft-protocol/node_modules/protodef/dist/protodef.js:103:31)
    at /Users/admin/games/voxeljs/node-minecraft-protocol/node_modules/protodef/dist/datatypes/structures.js:114:32
    at tryCatch (/Users/admin/games/voxeljs/node-minecraft-protocol/node_modules/protodef/dist/utils.js:31:12)
    at tryDoc (/Users/admin/games/voxeljs/node-minecraft-protocol/node_modules/protodef/dist/utils.js:38:10)
    at /Users/admin/games/voxeljs/node-minecraft-protocol/node_modules/protodef/dist/datatypes/structures.js:113:5
    at Array.forEach (native)
    at ProtoDef.readContainer (/Users/admin/games/voxeljs/node-minecraft-protocol/node_modules/protodef/dist/datatypes/structures.js:108:12)
    at ProtoDef.read (/Users/admin/games/voxeljs/node-minecraft-protocol/node_modules/protodef/dist/protodef.js:46:25)
    at ProtoDef.read (/Users/admin/games/voxeljs/node-minecraft-protocol/node_modules/protodef/dist/protodef.js:103:31)

but if I only rollback to the commit right before the protodef update from 0.2.5 to 0.3.0, and keep the same minecraft-data, then no error occurs (and the client_auto example works as expected against a 1.7.10 server):

node-minecraft-protocol $ git checkout 4806e48aff94f8b4209bc9ef75a047cff71a4d4e
node-minecraft-protocol $ npm install
node-minecraft-protocol $ node examples/client_auto/client_auto.js localhost 17100
connected
[no errors]
rom1504 commented 8 years ago

Yeah what's weird is that 1.8 seems to work fine with it, it's the other versions that don't. There's probably some datatype that don't throw PartialReadError properly.

rom1504 commented 8 years ago

Anyway yeah I know there's something that doesn't work with that, I'll figure that out.

rom1504 commented 8 years ago

I believe this is fixed, tell me if you have this again.

deathcap commented 8 years ago

1.7 works great on b23947db49264b81abd8235414c18fc6a9d0a8ec (at least offline mode, https://github.com/PrismarineJS/node-minecraft-protocol/pull/355#issuecomment-185917055), no longer seeing this error