Minecraft-Console-Client/MinecraftClient/Protocol/Handlers/StructuredComponents/Components/1_20_6/EnchantmentGlintOverrideComponent.cs
BruceChen c689343371 fix: StructuredComponents batch 3 audit — EnchantmentGlintOverrideComponent type correction
Audited all 14 simple binary components (batch 3): max_stack_size,
max_damage, damage, unbreakable, rarity, custom_model_data, repair_cost,
enchantment_glint_override, ominous_bottle_amplifier, dyed_color,
map_color, map_id, map_post_processing, base_color.

Found and fixed 1 bug:
- EnchantmentGlintOverrideComponent: was reading/writing VarInt but the
  official STREAM_CODEC uses ByteBufCodecs.BOOL (single byte boolean).
  Changed property type from int to bool, Parse from ReadNextVarInt to
  ReadNextBool, and Serialize from GetVarInt to GetBool.

All other 13 components matched the official 1.20.6 STREAM_CODEC
definitions exactly.

Verified in-game: connected to 1.20.6 vanilla server, received items
with enchantment_glint_override=true/false, dyed_color, map_color,
map_id, base_color, unbreakable, rarity, custom_model_data, repair_cost,
damage, max_damage. All parsed and serialized correctly with no errors.

Made-with: Cursor
2026-03-20 00:25:28 +08:00

23 lines
No EOL
783 B
C#

using System.Collections.Generic;
using MinecraftClient.Inventory.ItemPalettes;
using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
public class EnchantmentGlintOverrideComponent(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
: StructuredComponent(dataTypes, itemPalette, subComponentRegistry)
{
public bool HasGlint { get; set; }
public override void Parse(Queue<byte> data)
{
HasGlint = dataTypes.ReadNextBool(data);
}
public override Queue<byte> Serialize()
{
var data = new List<byte>();
data.AddRange(DataTypes.GetBool(HasGlint));
return new Queue<byte>(data);
}
}