feat: add MC 1.21.6 (protocol 771) version constants and enum values

- Add protocol 771 constant MC_1_21_6_Version in Protocol18.cs
- Register 1.21.6 in ProtocolHandler (version map, supported list)
- Extend upper-bound checks from MC_1_21_5 to MC_1_21_6
- Add 19 new ItemType entries (16 colored Harnesses, DriedGhast,
  HappyGhastSpawnEgg, MusicDiscTears)
- Add HappyGhast to EntityType enum
- Add DriedGhast to Material enum
- Add new packet types: Waypoint, ClearDialog, ShowDialog (clientbound),
  ChangeGameMode, CustomClickAction (serverbound),
  ClearDialog, ShowDialog (config clientbound),
  CustomClickAction (config serverbound)

Made-with: Cursor
This commit is contained in:
BruceChen 2026-03-21 11:34:20 +08:00
parent 26bee79a5d
commit 96a7e4a659
9 changed files with 41 additions and 8 deletions

View file

@ -122,6 +122,7 @@ namespace MinecraftClient.Inventory
BlackTerracotta,
BlackWool,
BlackBundle,
BlackHarness,
Blackstone,
BlackstoneSlab,
BlackstoneStairs,
@ -148,6 +149,7 @@ namespace MinecraftClient.Inventory
BlueTerracotta,
BlueWool,
BlueBundle,
BlueHarness,
BoggedSpawnEgg,
BoltArmorTrimSmithingTemplate,
Bone,
@ -188,6 +190,7 @@ namespace MinecraftClient.Inventory
BrownTerracotta,
BrownWool,
BrownBundle,
BrownHarness,
Brush,
BubbleCoral,
BubbleCoralBlock,
@ -352,6 +355,7 @@ namespace MinecraftClient.Inventory
CyanTerracotta,
CyanWool,
CyanBundle,
CyanHarness,
DamagedAnvil,
Dandelion,
DangerPotterySherd,
@ -438,6 +442,7 @@ namespace MinecraftClient.Inventory
DragonBreath,
DragonEgg,
DragonHead,
DriedGhast,
DriedKelp,
DriedKelpBlock,
DripstoneBlock,
@ -566,6 +571,7 @@ namespace MinecraftClient.Inventory
GrayTerracotta,
GrayWool,
GrayBundle,
GrayHarness,
GreenBanner,
GreenBed,
GreenCandle,
@ -580,12 +586,14 @@ namespace MinecraftClient.Inventory
GreenTerracotta,
GreenWool,
GreenBundle,
GreenHarness,
Grindstone,
GuardianSpawnEgg,
Gunpowder,
GusterBannerPattern,
GusterPotterySherd,
HangingRoots,
HappyGhastSpawnEgg,
HayBlock,
HeartOfTheSea,
HeartPotterySherd,
@ -689,6 +697,7 @@ namespace MinecraftClient.Inventory
LightBlueTerracotta,
LightBlueWool,
LightBlueBundle,
LightBlueHarness,
LightGrayBanner,
LightGrayBed,
LightGrayCandle,
@ -703,6 +712,7 @@ namespace MinecraftClient.Inventory
LightGrayTerracotta,
LightGrayWool,
LightGrayBundle,
LightGrayHarness,
LightWeightedPressurePlate,
LightningRod,
Lilac,
@ -722,6 +732,7 @@ namespace MinecraftClient.Inventory
LimeTerracotta,
LimeWool,
LimeBundle,
LimeHarness,
LingeringPotion,
LlamaSpawnEgg,
Lodestone,
@ -741,6 +752,7 @@ namespace MinecraftClient.Inventory
MagentaTerracotta,
MagentaWool,
MagentaBundle,
MagentaHarness,
MagmaBlock,
MagmaCream,
MagmaCubeSpawnEgg,
@ -809,6 +821,7 @@ namespace MinecraftClient.Inventory
MusicDiscRelic,
MusicDiscStal,
MusicDiscStrad,
MusicDiscTears,
MusicDiscWait,
MusicDiscWard,
Mutton,
@ -881,6 +894,7 @@ namespace MinecraftClient.Inventory
OrangeTulip,
OrangeWool,
OrangeBundle,
OrangeHarness,
OxeyeDaisy,
OxidizedChiseledCopper,
OxidizedCopper,
@ -944,6 +958,7 @@ namespace MinecraftClient.Inventory
PinkTulip,
PinkWool,
PinkBundle,
PinkHarness,
Piston,
PitcherPlant,
PitcherPod,
@ -1018,6 +1033,7 @@ namespace MinecraftClient.Inventory
PurpleTerracotta,
PurpleWool,
PurpleBundle,
PurpleHarness,
PurpurBlock,
PurpurPillar,
PurpurSlab,
@ -1069,6 +1085,7 @@ namespace MinecraftClient.Inventory
RedTulip,
RedWool,
RedBundle,
RedHarness,
Redstone,
RedstoneBlock,
RedstoneLamp,
@ -1373,6 +1390,7 @@ namespace MinecraftClient.Inventory
WhiteTulip,
WhiteWool,
WhiteBundle,
WhiteHarness,
WildArmorTrimSmithingTemplate,
Wildflowers, // wildflowers
WindCharge,
@ -1404,6 +1422,7 @@ namespace MinecraftClient.Inventory
YellowTerracotta,
YellowWool,
YellowBundle,
YellowHarness,
ZoglinSpawnEgg,
ZombieHead,
ZombieHorseSpawnEgg,

View file

@ -79,6 +79,7 @@ namespace MinecraftClient.Mapping
GlowSquid,
Goat,
Guardian,
HappyGhast,
Hoglin,
HopperMinecart,
Horse,

View file

@ -364,6 +364,7 @@ namespace MinecraftClient.Mapping
DragonEgg,
DragonHead,
DragonWallHead,
DriedGhast,
DriedKelpBlock,
DripstoneBlock,
Dropper,

View file

@ -19,6 +19,8 @@ public enum ConfigurationPacketTypesIn
StoreCookie,
Transfer,
UpdateTags,
ClearDialog, // Added in 1.21.6
ShowDialog, // Added in 1.21.6
Unknown
}

View file

@ -10,6 +10,7 @@ public enum ConfigurationPacketTypesOut
ResourcePackResponse,
CookieResponse,
KnownDataPacks,
CustomClickAction, // Added in 1.21.6
Unknown
}

View file

@ -161,5 +161,8 @@ namespace MinecraftClient.Protocol.Handlers
WorldBorderSize, //
WorldBorderWarningDelay, //
WorldBorderWarningReach, //
Waypoint, // Added in 1.21.6
ClearDialog, // Added in 1.21.6
ShowDialog, // Added in 1.21.6
}
}

View file

@ -76,5 +76,7 @@ namespace MinecraftClient.Protocol.Handlers
UseItem, //
VehicleMove, //
WindowConfirmation, //
ChangeGameMode, // Added in 1.21.6
CustomClickAction, // Added in 1.21.6
}
}

View file

@ -76,6 +76,7 @@ namespace MinecraftClient.Protocol.Handlers
internal const int MC_1_21_2_Version = 768;
internal const int MC_1_21_4_Version = 769;
internal const int MC_1_21_5_Version = 770;
internal const int MC_1_21_6_Version = 771;
private int compression_treshold = -1;
private int autocomplete_transaction_id = 0;
@ -127,21 +128,21 @@ namespace MinecraftClient.Protocol.Handlers
lastSeenMessagesCollector = protocolVersion >= MC_1_19_3_Version ? new(20) : new(5);
chunkBatchStartTime = GetNanos();
if (handler.GetTerrainEnabled() && protocolVersion > MC_1_21_5_Version)
if (handler.GetTerrainEnabled() && protocolVersion > MC_1_21_6_Version)
{
log.Error($"§c{Translations.extra_terrainandmovement_disabled}");
handler.SetTerrainEnabled(false);
}
if (handler.GetInventoryEnabled() &&
protocolVersion is < MC_1_8_Version or > MC_1_21_5_Version)
protocolVersion is < MC_1_8_Version or > MC_1_21_6_Version)
{
log.Error($"§c{Translations.extra_inventory_disabled}");
handler.SetInventoryEnabled(false);
}
if (handler.GetEntityHandlingEnabled() &&
protocolVersion is < MC_1_8_Version or > MC_1_21_5_Version)
protocolVersion is < MC_1_8_Version or > MC_1_21_6_Version)
{
log.Error($"§c{Translations.extra_entity_disabled}");
handler.SetEntityHandlingEnabled(false);
@ -150,7 +151,7 @@ namespace MinecraftClient.Protocol.Handlers
Block.Palette = protocolVersion switch
{
// Block palette
> MC_1_21_5_Version when handler.GetTerrainEnabled() =>
> MC_1_21_6_Version when handler.GetTerrainEnabled() =>
throw new NotImplementedException(Translations.exception_palette_block),
>= MC_1_21_5_Version => new Palette1215(),
>= MC_1_21_4_Version => new Palette1214(),
@ -172,7 +173,7 @@ namespace MinecraftClient.Protocol.Handlers
entityPalette = protocolVersion switch
{
// Entity palette
> MC_1_21_5_Version when handler.GetEntityHandlingEnabled() =>
> MC_1_21_6_Version when handler.GetEntityHandlingEnabled() =>
throw new NotImplementedException(Translations.exception_palette_entity),
>= MC_1_21_5_Version => new EntityPalette1215(),
>= MC_1_21_4_Version => new EntityPalette1214(),
@ -198,7 +199,7 @@ namespace MinecraftClient.Protocol.Handlers
itemPalette = protocolVersion switch
{
// Item palette
> MC_1_21_5_Version when handler.GetInventoryEnabled() =>
> MC_1_21_6_Version when handler.GetInventoryEnabled() =>
throw new NotImplementedException(Translations.exception_palette_item),
>= MC_1_21_5_Version => new ItemPalette1215(),
>= MC_1_21_4_Version => new ItemPalette1214(),
@ -2655,7 +2656,7 @@ namespace MinecraftClient.Protocol.Handlers
// Also make a palette for field? Will be a lot of work
var healthField = protocolVersion switch
{
> MC_1_21_5_Version => throw new NotImplementedException(Translations
> MC_1_21_6_Version => throw new NotImplementedException(Translations
.exception_palette_healthfield),
// 1.17 and above
>= MC_1_17_Version => 9,

View file

@ -154,7 +154,7 @@ namespace MinecraftClient.Protocol
{
4, 5, 47, 107, 108, 109, 110, 210, 315, 316, 335, 338, 340, 393, 401, 404, 477, 480, 485, 490, 498, 573,
575, 578, 735, 736, 751, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768,
769, 770
769, 770, 771
};
if (Array.IndexOf(suppoertedVersionsProtocol18, protocolVersion) > -1)
@ -360,6 +360,8 @@ namespace MinecraftClient.Protocol
return 769;
case "1.21.5":
return 770;
case "1.21.6":
return 771;
default:
return 0;
}
@ -444,6 +446,7 @@ namespace MinecraftClient.Protocol
768 => "1.21.2",
769 => "1.21.4",
770 => "1.21.5",
771 => "1.21.6",
_ => "0.0"
};
}