Minecraft-Console-Client/MinecraftClient/Mapping
BruceChen 99ac3d028a Dynamically parse minecraft:attribute registry from server RegistryData
In 1.20.6+, EntityProperties packets reference attributes by VarInt registry
IDs instead of string names. Previously, a hardcoded dictionary of 22 attribute
entries (matching the vanilla 1.20.6 registry) was used to map these IDs back
to names. This works for vanilla servers but would fail silently for modded
servers that add custom attributes — any unknown ID would be reported as
"unknown".

This commit replaces the hardcoded attribute dictionary with dynamic registry
parsing, following the same pattern already used for dimension_type and
chat_type registries:

- World.cs: Add static `attributeIdMap` field, `SetAttributeIdMap()` and
  `GetAttributeNameById()` methods for storing/querying attribute names by
  their VarInt registry IDs.

- Protocol18.cs (RegistryData handler): When the server sends a
  `minecraft:attribute` registry during the Configuration phase, parse all
  entries and store the ID→name mapping. The `minecraft:` prefix is stripped
  from entry names to match the format used in EntityProperties packets
  (e.g. "minecraft:generic.armor" → "generic.armor").

- Protocol18.cs (EntityProperties handler): Remove the hardcoded 22-entry
  `attributeDictionary` and use `World.GetAttributeNameById()` instead.
  Unknown IDs still fall back to "unknown" for safety.

Also closes issue #4 (Disconnect packet extra boolean) — verified that both
Play and Configuration phase Disconnect handlers already use `ReadNextChat()`
(NBT format since 1.20.4+), matching the 1.20.6 protocol spec. No code
changes needed; updated tracking document to mark as closed.

Made-with: Cursor
2026-03-19 01:12:18 +08:00
..
BlockPalettes Inventory, Terrain and Entity handling 2024-07-02 11:08:46 +02:00
EntityMetadataPalettes Implement 1.8 Entity MetaData 2023-03-27 18:22:50 +08:00
EntityPalettes Inventory, Terrain and Entity handling 2024-07-02 11:08:46 +02:00
Block.cs Implement command completion suggestions. 2022-12-06 15:50:17 +08:00
BlockExtension.cs Added slab handling for 1.20/.1 2023-06-23 16:25:18 +02:00
Chunk.cs Fix all warnings & Trim (#2226) 2022-10-02 18:31:08 +08:00
ChunkColumn.cs Fix all warnings & Trim (#2226) 2022-10-02 18:31:08 +08:00
CombatEventType.cs Added Player Killed event (Combat and CombatDeath packets). 2022-10-26 20:53:09 +02:00
CommandBlockFlags.cs [skip ci] Update Minecraft wiki links to new domain (#2593) 2023-10-07 17:59:08 +08:00
CommandBlockMode.cs [skip ci] Update Minecraft wiki links to new domain (#2593) 2023-10-07 17:59:08 +08:00
Dimension.cs Implement command completion suggestions. 2022-12-06 15:50:17 +08:00
Direction.cs [skip ci] Update Minecraft wiki links to new domain (#2593) 2023-10-07 17:59:08 +08:00
DirectionExtensions.cs Done auxiliary methods for Direction 2024-03-05 21:49:29 +05:00
Entity.cs merge brigadier-dev into milutinke:1.19.3 2023-01-14 20:42:15 +08:00
EntityMetadataPalette.cs Preliminary 1.21 Support 2024-12-06 16:45:48 +01:00
EntityMetaDataType.cs Implement 1.8 Entity MetaData 2023-03-27 18:22:50 +08:00
EntityPose.cs [SKIP_BUILD] Change file encoding to UTF-8 with BOM 2022-11-28 13:55:05 +08:00
EntityType.cs Inventory, Terrain and Entity handling 2024-07-02 11:08:46 +02:00
EntityTypeExtensions.cs Fix all warnings & Trim (#2226) 2022-10-02 18:31:08 +08:00
InteractType.cs Fix all warnings & Trim (#2226) 2022-10-02 18:31:08 +08:00
Location.cs Implement command completion suggestions. 2022-12-06 15:50:17 +08:00
MapIcon.cs Fix all warnings & Trim (#2226) 2022-10-02 18:31:08 +08:00
MapIconType.cs Fix all warnings & Trim (#2226) 2022-10-02 18:31:08 +08:00
Material.cs Inventory, Terrain and Entity handling 2024-07-02 11:08:46 +02:00
Material2Tool.cs Inventory, Terrain and Entity handling 2024-07-02 11:08:46 +02:00
MaterialExtensions.cs Added slab handling 1.13-1.19.4 2023-05-16 23:19:31 +02:00
MessageFilterType.cs Trim 2023-01-14 21:07:09 +08:00
Movement.cs Added slab handling 1.13-1.19.4 2023-05-16 23:19:31 +02:00
RaycastHelper.cs Implement command completion suggestions. 2022-12-06 15:50:17 +08:00
VillagerInfo.cs Adds support for villager trading (#1316) 2020-11-08 23:39:07 +01:00
World.cs Dynamically parse minecraft:attribute registry from server RegistryData 2026-03-19 01:12:18 +08:00