Minecraft-Console-Client/MinecraftClient/Mapping/EntityMetadataPalette.cs
BruceChen 1b0e27fde7 feat: add palettes and version routing for MC 1.21.6
- ItemPalette1216: 1415 items (generated from decompiled Items.java)
- EntityPalette1216: 151 entities (HappyGhast at index 56, all after +1)
- Palette1216: block states (DriedGhast 32 states at 13826-13857, all after +32)
- PacketPalette1216: clientbound +3 (Waypoint, ClearDialog, ShowDialog),
  serverbound +2 (ChangeGameMode at 0x04 shifting all after, CustomClickAction at end),
  config clientbound +2 (ClearDialog, ShowDialog),
  config serverbound +1 (CustomClickAction)
- Version routing in Protocol18.cs, PacketType18Handler.cs, EntityMetadataPalette.cs
  updated to select 1216 palettes for protocol >= 771
- EntityMetadataPalette reuses 1215 (EntityDataSerializers unchanged)

Made-with: Cursor
2026-03-21 11:44:12 +08:00

31 lines
No EOL
1.3 KiB
C#

using MinecraftClient.Mapping.EntityMetadataPalettes;
using MinecraftClient.Protocol.Handlers;
using System;
using System.Collections.Generic;
namespace MinecraftClient.Mapping;
public abstract class EntityMetadataPalette
{
public abstract Dictionary<int, EntityMetaDataType> GetEntityMetadataMappingsList();
public EntityMetaDataType GetDataType(int typeId)
{
return GetEntityMetadataMappingsList()[typeId];
}
public static EntityMetadataPalette GetPalette(int protocolVersion)
{
return protocolVersion switch
{
<= Protocol18Handler.MC_1_8_Version => new EntityMetadataPalette18(), // 1.8
<= Protocol18Handler.MC_1_12_2_Version => new EntityMetadataPalette1122(), // 1.9 - 1.12.2
<= Protocol18Handler.MC_1_19_2_Version => new EntityMetadataPalette1191(), // 1.13 - 1.19.2
<= Protocol18Handler.MC_1_19_3_Version => new EntityMetadataPalette1193(), // 1.19.3
< Protocol18Handler.MC_1_20_6_Version => new EntityMetadataPalette1194(), // 1.19.4 - 1.20.4
<= Protocol18Handler.MC_1_21_4_Version => new EntityMetadataPalette1206(), // 1.20.6 - 1.21.4
<= Protocol18Handler.MC_1_21_6_Version => new EntityMetadataPalette1215(), // 1.21.5 - 1.21.6
_ => throw new NotImplementedException()
};
}
}