fix: correct bitfield decoder using mask extraction, fix command_node

- Switch bitfield decoder from shift-based to mask-based extraction (var>>pos & mask)
  fixes non-power-of-2 bitfields like 6-bit command_node flags
- Fix MultiTypeFix to handle CaseExprTypeOnlyNumber/OnlyBool variants
- Update minecraft-data command_node bitfield order for all 1.21.8+ versions
  to LSB-first convention (matches reverse encoder/decoder)
- Implement SwitchDecoder for extraNodeData via compareTo visitor
- DeclareCommands now decodes successfully (was EOF)
- Add 6 regression tests (entity_equipment, metadata, recipes, commands)
This commit is contained in:
OpenCode
2026-08-05 22:29:08 +02:00
parent f4c2762881
commit e58499ed09
17 changed files with 8532 additions and 263 deletions
@@ -4120,11 +4120,6 @@
"type": [
"bitfield",
[
{
"name": "unused",
"size": 2,
"signed": false
},
{
"name": "allows_restricted",
"size": 1,
@@ -11697,4 +11692,4 @@
}
}
}
}
}
@@ -2803,11 +2803,6 @@
"type": [
"bitfield",
[
{
"name": "unused",
"size": 2,
"signed": false
},
{
"name": "allows_restricted",
"size": 1,
@@ -10259,4 +10254,4 @@
}
}
}
}
}
@@ -3822,11 +3822,6 @@
"type": [
"bitfield",
[
{
"name": "unused",
"size": 2,
"signed": false
},
{
"name": "allows_restricted",
"size": 1,
@@ -11399,4 +11394,4 @@
}
}
}
}
}
@@ -4112,11 +4112,6 @@
"type": [
"bitfield",
[
{
"name": "unused",
"size": 2,
"signed": false
},
{
"name": "allows_restricted",
"size": 1,
+45 -12
View File
@@ -4112,11 +4112,6 @@
"type": [
"bitfield",
[
{
"name": "unused",
"size": 2,
"signed": false
},
{
"name": "allows_restricted",
"size": 1,
@@ -5726,12 +5721,15 @@
"mappings": {
"0": "empty",
"1": "any_fuel",
"2": "item",
"3": "item_stack",
"4": "tag",
"5": "smithing_trim",
"6": "with_remainder",
"7": "composite"
"2": "with_any_potion",
"3": "only_with_component",
"4": "item",
"5": "item_stack",
"6": "tag",
"7": "dyed",
"8": "smithing_trim",
"9": "with_remainder",
"10": "composite"
}
}
]
@@ -5745,9 +5743,44 @@
"fields": {
"empty": "void",
"any_fuel": "void",
"with_any_potion": [
"container",
[
{
"name": "display",
"type": "SlotDisplay"
}
]
],
"only_with_component": [
"container",
[
{
"name": "source",
"type": "SlotDisplay"
},
{
"name": "component",
"type": "IDSet"
}
]
],
"item": "varint",
"item_stack": "Slot",
"tag": "string",
"dyed": [
"container",
[
{
"name": "dye",
"type": "SlotDisplay"
},
{
"name": "target",
"type": "SlotDisplay"
}
]
],
"smithing_trim": [
"container",
[
@@ -11779,4 +11812,4 @@
}
}
}
}
}