Minecraft-Console-Client/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6
BruceChen a36ba23ba6 fix: StructuredComponents batch 1 audit — TrimComponent, ProfileComponent, WrittenBookContent, and NBT serialization
Audited all 8 high-complexity structured components against official 1.20.6
decompiled STREAM_CODEC definitions. Found and fixed bugs in 3 components
plus a systemic NBT serialization issue:

TrimComponent (ID 35):
- Serialize had TrimPatternType and ShowInTooltip incorrectly nested inside
  the TrimMaterialType==0 branch; moved them outside to match Parse logic
- Description fields (TrimMaterial.description, TrimPattern.description) were
  read/written as String but official codec uses ComponentSerialization
  (NBT Tag format); changed to ReadNextNbt/GetNbt

ProfileComponent (ID 46):
- Serialize was missing the HasUniqueId Bool prefix before UUID
- Serialize only wrote properties when count > 0 but omitted the VarInt count
  prefix entirely when empty; now always writes VarInt count

WrittenBookContentComponent (ID 34):
- Page content uses Filterable<Component> where Component is NBT-encoded via
  ComponentSerialization.STREAM_CODEC, not plain String; changed Parse to use
  ReadNextNbt and Serialize to use GetNbt
- Added RawContentNbt/FilteredContentNbt fields to BookPage record for
  round-trip NBT preservation
- Removed unnecessary ChatParser.ParseText on title (it's a plain string)

DataTypes.GetNbt:
- Added TAG_String root support for 1.20.4+ (chat components like "Page 1"
  are encoded as TAG_String, not TAG_Compound)
- Fixed root name handling: versions >= 1.20.2 omit the root compound name,
  but GetNbt was unconditionally writing it

Components confirmed correct (no changes needed):
- FoodComponentComponent (ID 20), ToolComponent (ID 22),
  InstrumentComponent (ID 40), PotionContentsComponent (ID 31),
  AttributeModifiersComponent (ID 12)

Made-with: Cursor
2026-03-20 00:09:05 +08:00
..
AttributeModifiersComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
BannerPatternsComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
BaseColorComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
BeesComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
BlockStateComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
BundleContentsComponent.cs Fix StructuredComponent serialization correctness for 1.20.6 2026-03-19 01:37:56 +08:00
CanBreakComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
CanPlaceOnComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
ChargedProjectilesComponent.cs Fix StructuredComponent serialization correctness for 1.20.6 2026-03-19 01:37:56 +08:00
ContainerComponent.cs Fix StructuredComponent serialization correctness for 1.20.6 2026-03-19 01:37:56 +08:00
ContainerLootComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
CreativeSlotLockComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
CustomDataComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
CustomModelDataComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
CustomNameComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
DamageComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
DebugStickStateComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
DyeColorComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
EnchantmentGlintOverrideComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
EnchantmentsComponent.cs Fix enchantment name display for 1.20.6 structured components 2026-03-19 02:01:15 +08:00
EntityDataComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
FireResistantComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
FireworkExplosionComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
FireworksComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
FoodComponentComponent.cs Fix StructuredComponent serialization correctness for 1.20.6 2026-03-19 01:37:56 +08:00
HideAdditionalTooltipComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
HideTooltipComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
InstrumentComponent.cs Fix PotionContentsComponent and InstrumentComponent serialization for 1.20.6 2026-03-19 01:44:23 +08:00
IntangibleProjectileComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
ItemNameComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
LockComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
LodestoneTrackerComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
LoreComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
MapColorComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
MapDecorationsComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
MapIdComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
MapPostProcessingComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
MaxDamageComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
MaxStackSizeComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
NoteBlockSoundComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
OmniousBottleAmplifierComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
PotDecorationsComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
PotionContentsComponent.cs Fix PotionContentsComponent and InstrumentComponent serialization for 1.20.6 2026-03-19 01:44:23 +08:00
ProfileComponent.cs fix: StructuredComponents batch 1 audit — TrimComponent, ProfileComponent, WrittenBookContent, and NBT serialization 2026-03-20 00:09:05 +08:00
RarityComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
RecipesComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
RepairCostComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
StoredEnchantmentsComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
SuspiciousStewEffectsComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
ToolComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
TrimComponent.cs fix: StructuredComponents batch 1 audit — TrimComponent, ProfileComponent, WrittenBookContent, and NBT serialization 2026-03-20 00:09:05 +08:00
UnbreakableComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
WritableBlookContentComponent.cs Implemented all structured components, renamed them all to a better format 2024-10-05 13:37:52 +02:00
WrittenBlookContentComponent.cs fix: StructuredComponents batch 1 audit — TrimComponent, ProfileComponent, WrittenBookContent, and NBT serialization 2026-03-20 00:09:05 +08:00