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

@ -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"
};
}