PrismarineJS / PrismarineJS/node-minecraft-protocol
Error: Read error for params.advancements.advancementMapping.3.value.displayData.icon.unknown.default.nbtData.type : 109 is not in the mappings value
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.4k
- Forks
- 290
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 7
Description
Hello, I'm using node-minecraft-protocol to help debug packet parsing for another program since it (along with minecraft-data) appears to be the most complete repository of protocol data, but there's one packet I encountered which it cannot parse:
This is an advancement packet for 1.12.2. Script to try to parse it:
const mc=require('minecraft-protocol');
const d=mc.createDeserializer({version:"1.12.2", state:mc.states.PLAY});
d.on('data',(parsed)=>{
console.log(JSON.stringify(parsed, null, ''));
console.log(parsed.data.params);
});
d.write(require('fs').readFileSync('last-packet'));
Run with DEBUG=minecraft-protocol node try5.js, crashes with "params.advancements.advancementMapping.3.value.displayData.icon.unknown.default.nbtData.type : 109 is not in the mappings value", full stack trace:
events.js:183
throw er; // Unhandled 'error' event
^
Error: Read error for params.advancements.advancementMapping.3.value.displayData.icon.unknown.default.nbtData.type : 109 is not in the mappings value
at ProtoDef.readMapper (node-minecraft-protocol/node_modules/protodef/src/datatypes/utils.js:30:34)
at ProtoDef.read (node-minecraft-protocol/node_modules/protodef/src/protodef.js:36:25)
at ProtoDef.read (node-minecraft-protocol/node_modules/protodef/src/protodef.js:110:29)
at tryDoc (node-minecraft-protocol/node_modules/protodef/src/datatypes/structures.js:45:32)
at tryCatch (node-minecraft-protocol/node_modules/protodef/src/utils.js:50:16)
at tryDoc (node-minecraft-protocol/node_modules/protodef/src/utils.js:54:10)
at typeArgs.forEach (node-minecraft-protocol/node_modules/protodef/src/datatypes/structures.js:44:5)
at Array.forEach (<anonymous>)
at ProtoDef.readContainer (node-minecraft-protocol/node_modules/protodef/src/datatypes/structures.js:43:12)
at ProtoDef.read (node-minecraft-protocol/node_modules/protodef/src/protodef.js:36:25)
Looking at the code, it appears the "mappings value" it refers to is the NBT types, which 109 isn't valid for, so this suggests a problem earlier in the parsing.
If it matters, this packet was captured from SevTech: Ages 3.11 server (currently top #3 modpack on Curseforge with 1,945,358 downloads. No packet parsing discrepancies found in the top 1st and 2nd packs but they are both for 1.7.10.). This server is modded with Forge so it is possible it or another mod changed the advancement packet structure, I don't think node-minecraft-protocol/minecraft-data is inaccurate vs vanilla, but would be great if it could support this likely modded packet somehow. I'll attach my notes on attempting to decode it below.
partial decode
about to parse id=18, dir=Clientbound state=Play packet = Some(PluginMessageClientbound(PluginMessageClientbound { channel: "thebetweenlands", data: [17, 0, 0, 0, 12, 0, 0, 0, 26, 10, 0, 0, 0] })) Decompressed threshold=256 len=2360 uncompressed_size=14986 to 14986 bytes about to parse id=4d, dir=Clientbound state=Play reading Advancement id=triumph:stage0/mat has_parent? 1 parent_id triumph:stage0/leather parent_id=Some("triumph:stage0/leather") has_display 1 reading AdvancementDisplay title {"translate":"advancements.stage0.mat.title"} description {"translate":"advancements.stage0.mat.description"} icon Some(Stack { id: 9477, count: 1, damage: Some(0), tag: None }) frame_type 0 flags 10 background_texture None x_coord 7.0 y_coord 10.3125 display_data Some(AdvancementDisplay { title: "{"translate":"advancements.stage0.mat.title"}", description: "{"translate":"advancements.stage0.mat.description"}", icon: Some(Stack { id: 9477, count: 1, damage: Some(0), tag: None }), frame_type: 0, flags: 10, background_texture: None, x_coord: 7.0, y_coord: 10.3125 })so far so good...but then lots of empty data:
criteria []
requirements []
reading Advancement
id=
has_parent? 0
parent_id=None
has_display 0
display_data None
criteria []
requirements []
reading Advancement
id=
has_parent? 0
parent_id=None
has_display 0
display_data None
criteria []
requirements []
reading Advancement
id=
has_parent? 0
parent_id=None
has_display 2
^ this doesn't make any sense, has_display is supposed to be a bool (0 or 1) not 2
reading AdvancementDisplay
title completedParent
description hasRock
thread '' panicked at 'called Result::unwrap() on an Err value: FromUtf8Error { bytes: [101, 116, 101, 100, 80,
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided deserializer script with the attached last-packet capture for version 1.12.2 in the PLAY state. Trace the advancement packet (id 4d) through the Protodef stack locations shown in node_modules/protodef and compare it with the partial decode, especially the advancement display and NBT type fields. Done means the capture no longer produces the reported mapping error, with tests or reproduction notes covering the result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100