feat: add palettes and version constants for MC 1.21.2 (protocol 768)

Add item, entity, block, and metadata palettes for Minecraft 1.21.2:
- ItemPalette1212: 1375 items (42 new: pale oak set, colored bundles,
  creaking heart/spawn egg, banner patterns)
- EntityPalette1212: 150 entity types (boats split into per-wood-type
  entries, generic boat/chest_boat removed; added creaking,
  creaking_transient, pale oak boats)
- Palette1212 (blocks): 1084 block types with state IDs generated from
  official 1.21.2 data reports (24 new pale oak blocks, creaking heart,
  pale moss variants)
- EntityMetadataPalette: reuses 1206 (serializers unchanged in 1.21.2)

Updated version infrastructure:
- Protocol18.cs: MC_1_21_2_Version = 768, palette switch routing
- ProtocolHandler.cs: version mapping 1.21.2 <-> 768
- Program.cs: MCHighestVersion bumped to 1.21.2
- ItemType.cs, EntityType.cs, Material.cs: new enum entries

Note: packet palette, structured components, and protocol handler
changes for 1.21.2 are not yet implemented — this commit covers
palette/registry groundwork only.

Made-with: Cursor
This commit is contained in:
BruceChen 2026-03-20 03:02:43 +08:00
parent 896263acc8
commit df833ae2a8
10 changed files with 3476 additions and 9 deletions

File diff suppressed because it is too large Load diff

View file

@ -121,6 +121,7 @@ namespace MinecraftClient.Inventory
BlackStainedGlassPane, BlackStainedGlassPane,
BlackTerracotta, BlackTerracotta,
BlackWool, BlackWool,
BlackBundle,
Blackstone, Blackstone,
BlackstoneSlab, BlackstoneSlab,
BlackstoneStairs, BlackstoneStairs,
@ -145,6 +146,7 @@ namespace MinecraftClient.Inventory
BlueStainedGlassPane, BlueStainedGlassPane,
BlueTerracotta, BlueTerracotta,
BlueWool, BlueWool,
BlueBundle,
BoggedSpawnEgg, BoggedSpawnEgg,
BoltArmorTrimSmithingTemplate, BoltArmorTrimSmithingTemplate,
Bone, Bone,
@ -152,6 +154,7 @@ namespace MinecraftClient.Inventory
BoneMeal, BoneMeal,
Book, Book,
Bookshelf, Bookshelf,
BordureIndentedBannerPattern,
Bow, Bow,
Bowl, Bowl,
BrainCoral, BrainCoral,
@ -182,6 +185,7 @@ namespace MinecraftClient.Inventory
BrownStainedGlassPane, BrownStainedGlassPane,
BrownTerracotta, BrownTerracotta,
BrownWool, BrownWool,
BrownBundle,
Brush, Brush,
BubbleCoral, BubbleCoral,
BubbleCoralBlock, BubbleCoralBlock,
@ -298,6 +302,8 @@ namespace MinecraftClient.Inventory
CrackedStoneBricks, CrackedStoneBricks,
Crafter, Crafter,
CraftingTable, CraftingTable,
CreakingHeart,
CreakingSpawnEgg,
CreeperBannerPattern, CreeperBannerPattern,
CreeperHead, CreeperHead,
CreeperSpawnEgg, CreeperSpawnEgg,
@ -339,6 +345,7 @@ namespace MinecraftClient.Inventory
CyanStainedGlassPane, CyanStainedGlassPane,
CyanTerracotta, CyanTerracotta,
CyanWool, CyanWool,
CyanBundle,
DamagedAnvil, DamagedAnvil,
Dandelion, Dandelion,
DangerPotterySherd, DangerPotterySherd,
@ -472,6 +479,7 @@ namespace MinecraftClient.Inventory
Feather, Feather,
FermentedSpiderEye, FermentedSpiderEye,
Fern, Fern,
FieldMasonedBannerPattern,
FilledMap, FilledMap,
FireCharge, FireCharge,
FireCoral, FireCoral,
@ -548,6 +556,7 @@ namespace MinecraftClient.Inventory
GrayStainedGlassPane, GrayStainedGlassPane,
GrayTerracotta, GrayTerracotta,
GrayWool, GrayWool,
GrayBundle,
GreenBanner, GreenBanner,
GreenBed, GreenBed,
GreenCandle, GreenCandle,
@ -561,6 +570,7 @@ namespace MinecraftClient.Inventory
GreenStainedGlassPane, GreenStainedGlassPane,
GreenTerracotta, GreenTerracotta,
GreenWool, GreenWool,
GreenBundle,
Grindstone, Grindstone,
GuardianSpawnEgg, GuardianSpawnEgg,
Gunpowder, Gunpowder,
@ -668,6 +678,7 @@ namespace MinecraftClient.Inventory
LightBlueStainedGlassPane, LightBlueStainedGlassPane,
LightBlueTerracotta, LightBlueTerracotta,
LightBlueWool, LightBlueWool,
LightBlueBundle,
LightGrayBanner, LightGrayBanner,
LightGrayBed, LightGrayBed,
LightGrayCandle, LightGrayCandle,
@ -681,6 +692,7 @@ namespace MinecraftClient.Inventory
LightGrayStainedGlassPane, LightGrayStainedGlassPane,
LightGrayTerracotta, LightGrayTerracotta,
LightGrayWool, LightGrayWool,
LightGrayBundle,
LightWeightedPressurePlate, LightWeightedPressurePlate,
LightningRod, LightningRod,
Lilac, Lilac,
@ -699,6 +711,7 @@ namespace MinecraftClient.Inventory
LimeStainedGlassPane, LimeStainedGlassPane,
LimeTerracotta, LimeTerracotta,
LimeWool, LimeWool,
LimeBundle,
LingeringPotion, LingeringPotion,
LlamaSpawnEgg, LlamaSpawnEgg,
Lodestone, Lodestone,
@ -717,6 +730,7 @@ namespace MinecraftClient.Inventory
MagentaStainedGlassPane, MagentaStainedGlassPane,
MagentaTerracotta, MagentaTerracotta,
MagentaWool, MagentaWool,
MagentaBundle,
MagmaBlock, MagmaBlock,
MagmaCream, MagmaCream,
MagmaCubeSpawnEgg, MagmaCubeSpawnEgg,
@ -855,6 +869,7 @@ namespace MinecraftClient.Inventory
OrangeTerracotta, OrangeTerracotta,
OrangeTulip, OrangeTulip,
OrangeWool, OrangeWool,
OrangeBundle,
OxeyeDaisy, OxeyeDaisy,
OxidizedChiseledCopper, OxidizedChiseledCopper,
OxidizedCopper, OxidizedCopper,
@ -868,6 +883,26 @@ namespace MinecraftClient.Inventory
PackedIce, PackedIce,
PackedMud, PackedMud,
Painting, Painting,
PaleHangingMoss,
PaleMossBlock,
PaleMossCarpet,
PaleOakBoat,
PaleOakButton,
PaleOakChestBoat,
PaleOakDoor,
PaleOakFence,
PaleOakFenceGate,
PaleOakHangingSign,
PaleOakLeaves,
PaleOakLog,
PaleOakPlanks,
PaleOakPressurePlate,
PaleOakSapling,
PaleOakSign,
PaleOakSlab,
PaleOakStairs,
PaleOakTrapdoor,
PaleOakWood,
PandaSpawnEgg, PandaSpawnEgg,
Paper, Paper,
ParrotSpawnEgg, ParrotSpawnEgg,
@ -897,6 +932,7 @@ namespace MinecraftClient.Inventory
PinkTerracotta, PinkTerracotta,
PinkTulip, PinkTulip,
PinkWool, PinkWool,
PinkBundle,
Piston, Piston,
PitcherPlant, PitcherPlant,
PitcherPod, PitcherPod,
@ -970,6 +1006,7 @@ namespace MinecraftClient.Inventory
PurpleStainedGlassPane, PurpleStainedGlassPane,
PurpleTerracotta, PurpleTerracotta,
PurpleWool, PurpleWool,
PurpleBundle,
PurpurBlock, PurpurBlock,
PurpurPillar, PurpurPillar,
PurpurSlab, PurpurSlab,
@ -1020,6 +1057,7 @@ namespace MinecraftClient.Inventory
RedTerracotta, RedTerracotta,
RedTulip, RedTulip,
RedWool, RedWool,
RedBundle,
Redstone, Redstone,
RedstoneBlock, RedstoneBlock,
RedstoneLamp, RedstoneLamp,
@ -1167,6 +1205,8 @@ namespace MinecraftClient.Inventory
StrippedMangroveWood, StrippedMangroveWood,
StrippedOakLog, StrippedOakLog,
StrippedOakWood, StrippedOakWood,
StrippedPaleOakLog,
StrippedPaleOakWood,
StrippedSpruceLog, StrippedSpruceLog,
StrippedSpruceWood, StrippedSpruceWood,
StrippedWarpedHyphae, StrippedWarpedHyphae,
@ -1312,6 +1352,7 @@ namespace MinecraftClient.Inventory
WhiteTerracotta, WhiteTerracotta,
WhiteTulip, WhiteTulip,
WhiteWool, WhiteWool,
WhiteBundle,
WildArmorTrimSmithingTemplate, WildArmorTrimSmithingTemplate,
WindCharge, WindCharge,
WitchSpawnEgg, WitchSpawnEgg,
@ -1341,6 +1382,7 @@ namespace MinecraftClient.Inventory
YellowStainedGlassPane, YellowStainedGlassPane,
YellowTerracotta, YellowTerracotta,
YellowWool, YellowWool,
YellowBundle,
ZoglinSpawnEgg, ZoglinSpawnEgg,
ZombieHead, ZombieHead,
ZombieHorseSpawnEgg, ZombieHorseSpawnEgg,

File diff suppressed because it is too large Load diff

View file

@ -23,7 +23,7 @@ public abstract class EntityMetadataPalette
<= Protocol18Handler.MC_1_19_2_Version => new EntityMetadataPalette1191(), // 1.13 - 1.19.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_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_20_6_Version => new EntityMetadataPalette1194(), // 1.19.4 - 1.20.4
<= Protocol18Handler.MC_1_21_Version => new EntityMetadataPalette1206(), // 1.20.6 - 1.21 <= Protocol18Handler.MC_1_21_2_Version => new EntityMetadataPalette1206(), // 1.20.6 - 1.21.2
_ => throw new NotImplementedException() _ => throw new NotImplementedException()
}; };
} }

View file

@ -0,0 +1,168 @@
using System.Collections.Generic;
namespace MinecraftClient.Mapping.EntityPalettes
{
public class EntityPalette1212 : EntityPalette
{
private static readonly Dictionary<int, EntityType> mappings = new();
static EntityPalette1212()
{
mappings[0] = EntityType.AcaciaBoat;
mappings[1] = EntityType.AcaciaChestBoat;
mappings[2] = EntityType.Allay;
mappings[3] = EntityType.AreaEffectCloud;
mappings[4] = EntityType.Armadillo;
mappings[5] = EntityType.ArmorStand;
mappings[6] = EntityType.Arrow;
mappings[7] = EntityType.Axolotl;
mappings[8] = EntityType.BambooChestRaft;
mappings[9] = EntityType.BambooRaft;
mappings[10] = EntityType.Bat;
mappings[11] = EntityType.Bee;
mappings[12] = EntityType.BirchBoat;
mappings[13] = EntityType.BirchChestBoat;
mappings[14] = EntityType.Blaze;
mappings[15] = EntityType.BlockDisplay;
mappings[16] = EntityType.Bogged;
mappings[17] = EntityType.Breeze;
mappings[18] = EntityType.BreezeWindCharge;
mappings[19] = EntityType.Camel;
mappings[20] = EntityType.Cat;
mappings[21] = EntityType.CaveSpider;
mappings[22] = EntityType.CherryBoat;
mappings[23] = EntityType.CherryChestBoat;
mappings[24] = EntityType.ChestMinecart;
mappings[25] = EntityType.Chicken;
mappings[26] = EntityType.Cod;
mappings[27] = EntityType.CommandBlockMinecart;
mappings[28] = EntityType.Cow;
mappings[29] = EntityType.Creaking;
mappings[30] = EntityType.CreakingTransient;
mappings[31] = EntityType.Creeper;
mappings[32] = EntityType.DarkOakBoat;
mappings[33] = EntityType.DarkOakChestBoat;
mappings[34] = EntityType.Dolphin;
mappings[35] = EntityType.Donkey;
mappings[36] = EntityType.DragonFireball;
mappings[37] = EntityType.Drowned;
mappings[38] = EntityType.Egg;
mappings[39] = EntityType.ElderGuardian;
mappings[40] = EntityType.Enderman;
mappings[41] = EntityType.Endermite;
mappings[42] = EntityType.EnderDragon;
mappings[43] = EntityType.EnderPearl;
mappings[44] = EntityType.EndCrystal;
mappings[45] = EntityType.Evoker;
mappings[46] = EntityType.EvokerFangs;
mappings[47] = EntityType.ExperienceBottle;
mappings[48] = EntityType.ExperienceOrb;
mappings[49] = EntityType.EyeOfEnder;
mappings[50] = EntityType.FallingBlock;
mappings[51] = EntityType.Fireball;
mappings[52] = EntityType.FireworkRocket;
mappings[53] = EntityType.Fox;
mappings[54] = EntityType.Frog;
mappings[55] = EntityType.FurnaceMinecart;
mappings[56] = EntityType.Ghast;
mappings[57] = EntityType.Giant;
mappings[58] = EntityType.GlowItemFrame;
mappings[59] = EntityType.GlowSquid;
mappings[60] = EntityType.Goat;
mappings[61] = EntityType.Guardian;
mappings[62] = EntityType.Hoglin;
mappings[63] = EntityType.HopperMinecart;
mappings[64] = EntityType.Horse;
mappings[65] = EntityType.Husk;
mappings[66] = EntityType.Illusioner;
mappings[67] = EntityType.Interaction;
mappings[68] = EntityType.IronGolem;
mappings[69] = EntityType.Item;
mappings[70] = EntityType.ItemDisplay;
mappings[71] = EntityType.ItemFrame;
mappings[72] = EntityType.JungleBoat;
mappings[73] = EntityType.JungleChestBoat;
mappings[74] = EntityType.LeashKnot;
mappings[75] = EntityType.LightningBolt;
mappings[76] = EntityType.Llama;
mappings[77] = EntityType.LlamaSpit;
mappings[78] = EntityType.MagmaCube;
mappings[79] = EntityType.MangroveBoat;
mappings[80] = EntityType.MangroveChestBoat;
mappings[81] = EntityType.Marker;
mappings[82] = EntityType.Minecart;
mappings[83] = EntityType.Mooshroom;
mappings[84] = EntityType.Mule;
mappings[85] = EntityType.OakBoat;
mappings[86] = EntityType.OakChestBoat;
mappings[87] = EntityType.Ocelot;
mappings[88] = EntityType.OminousItemSpawner;
mappings[89] = EntityType.Painting;
mappings[90] = EntityType.PaleOakBoat;
mappings[91] = EntityType.PaleOakChestBoat;
mappings[92] = EntityType.Panda;
mappings[93] = EntityType.Parrot;
mappings[94] = EntityType.Phantom;
mappings[95] = EntityType.Pig;
mappings[96] = EntityType.Piglin;
mappings[97] = EntityType.PiglinBrute;
mappings[98] = EntityType.Pillager;
mappings[99] = EntityType.PolarBear;
mappings[100] = EntityType.Potion;
mappings[101] = EntityType.Pufferfish;
mappings[102] = EntityType.Rabbit;
mappings[103] = EntityType.Ravager;
mappings[104] = EntityType.Salmon;
mappings[105] = EntityType.Sheep;
mappings[106] = EntityType.Shulker;
mappings[107] = EntityType.ShulkerBullet;
mappings[108] = EntityType.Silverfish;
mappings[109] = EntityType.Skeleton;
mappings[110] = EntityType.SkeletonHorse;
mappings[111] = EntityType.Slime;
mappings[112] = EntityType.SmallFireball;
mappings[113] = EntityType.Sniffer;
mappings[114] = EntityType.Snowball;
mappings[115] = EntityType.SnowGolem;
mappings[116] = EntityType.SpawnerMinecart;
mappings[117] = EntityType.SpectralArrow;
mappings[118] = EntityType.Spider;
mappings[119] = EntityType.SpruceBoat;
mappings[120] = EntityType.SpruceChestBoat;
mappings[121] = EntityType.Squid;
mappings[122] = EntityType.Stray;
mappings[123] = EntityType.Strider;
mappings[124] = EntityType.Tadpole;
mappings[125] = EntityType.TextDisplay;
mappings[126] = EntityType.Tnt;
mappings[127] = EntityType.TntMinecart;
mappings[128] = EntityType.TraderLlama;
mappings[129] = EntityType.Trident;
mappings[130] = EntityType.TropicalFish;
mappings[131] = EntityType.Turtle;
mappings[132] = EntityType.Vex;
mappings[133] = EntityType.Villager;
mappings[134] = EntityType.Vindicator;
mappings[135] = EntityType.WanderingTrader;
mappings[136] = EntityType.Warden;
mappings[137] = EntityType.WindCharge;
mappings[138] = EntityType.Witch;
mappings[139] = EntityType.Wither;
mappings[140] = EntityType.WitherSkeleton;
mappings[141] = EntityType.WitherSkull;
mappings[142] = EntityType.Wolf;
mappings[143] = EntityType.Zoglin;
mappings[144] = EntityType.Zombie;
mappings[145] = EntityType.ZombieHorse;
mappings[146] = EntityType.ZombieVillager;
mappings[147] = EntityType.ZombifiedPiglin;
mappings[148] = EntityType.Player;
mappings[149] = EntityType.FishingBobber;
}
protected override Dictionary<int, EntityType> GetDict()
{
return mappings;
}
}
}

View file

@ -1,4 +1,4 @@
namespace MinecraftClient.Mapping namespace MinecraftClient.Mapping
{ {
/// <summary> /// <summary>
/// Represents Minecraft Entity Types /// Represents Minecraft Entity Types
@ -14,14 +14,20 @@
/// </remarks> /// </remarks>
public enum EntityType public enum EntityType
{ {
AcaciaBoat,
AcaciaChestBoat,
Allay, Allay,
AreaEffectCloud, AreaEffectCloud,
Armadillo, Armadillo,
ArmorStand, ArmorStand,
Arrow, Arrow,
Axolotl, Axolotl,
BambooChestRaft,
BambooRaft,
Bat, Bat,
Bee, Bee,
BirchBoat,
BirchChestBoat,
Blaze, Blaze,
BlockDisplay, BlockDisplay,
Boat, Boat,
@ -31,13 +37,19 @@
Camel, Camel,
Cat, Cat,
CaveSpider, CaveSpider,
CherryBoat,
CherryChestBoat,
ChestBoat, ChestBoat,
ChestMinecart, ChestMinecart,
Chicken, Chicken,
Cod, Cod,
CommandBlockMinecart, CommandBlockMinecart,
Cow, Cow,
Creaking,
CreakingTransient,
Creeper, Creeper,
DarkOakBoat,
DarkOakChestBoat,
Dolphin, Dolphin,
Donkey, Donkey,
DragonFireball, DragonFireball,
@ -77,18 +89,26 @@
Item, Item,
ItemDisplay, ItemDisplay,
ItemFrame, ItemFrame,
JungleBoat,
JungleChestBoat,
LeashKnot, LeashKnot,
LightningBolt, LightningBolt,
Llama, Llama,
LlamaSpit, LlamaSpit,
MagmaCube, MagmaCube,
MangroveBoat,
MangroveChestBoat,
Marker, Marker,
Minecart, Minecart,
Mooshroom, Mooshroom,
Mule, Mule,
OakBoat,
OakChestBoat,
Ocelot, Ocelot,
OminousItemSpawner, OminousItemSpawner,
Painting, Painting,
PaleOakBoat,
PaleOakChestBoat,
Panda, Panda,
Parrot, Parrot,
Phantom, Phantom,
@ -117,6 +137,8 @@
SpawnerMinecart, SpawnerMinecart,
SpectralArrow, SpectralArrow,
Spider, Spider,
SpruceBoat,
SpruceChestBoat,
Squid, Squid,
Stray, Stray,
Strider, Strider,

View file

@ -1,4 +1,4 @@
namespace MinecraftClient.Mapping namespace MinecraftClient.Mapping
{ {
/// <summary> /// <summary>
/// Represents Minecraft Materials /// Represents Minecraft Materials
@ -242,6 +242,7 @@
CrackedStoneBricks, CrackedStoneBricks,
Crafter, Crafter,
CraftingTable, CraftingTable,
CreakingHeart,
CreeperHead, CreeperHead,
CreeperWallHead, CreeperWallHead,
CrimsonButton, CrimsonButton,
@ -662,6 +663,26 @@
OxidizedCutCopperStairs, OxidizedCutCopperStairs,
PackedIce, PackedIce,
PackedMud, PackedMud,
PaleHangingMoss,
PaleMossBlock,
PaleMossCarpet,
PaleOakButton,
PaleOakDoor,
PaleOakFence,
PaleOakFenceGate,
PaleOakHangingSign,
PaleOakLeaves,
PaleOakLog,
PaleOakPlanks,
PaleOakPressurePlate,
PaleOakSapling,
PaleOakSign,
PaleOakSlab,
PaleOakStairs,
PaleOakTrapdoor,
PaleOakWallHangingSign,
PaleOakWallSign,
PaleOakWood,
PearlescentFroglight, PearlescentFroglight,
Peony, Peony,
PetrifiedOakSlab, PetrifiedOakSlab,
@ -745,6 +766,7 @@
PottedOakSapling, PottedOakSapling,
PottedOrangeTulip, PottedOrangeTulip,
PottedOxeyeDaisy, PottedOxeyeDaisy,
PottedPaleOakSapling,
PottedPinkTulip, PottedPinkTulip,
PottedPoppy, PottedPoppy,
PottedRedMushroom, PottedRedMushroom,
@ -926,6 +948,8 @@
StrippedMangroveWood, StrippedMangroveWood,
StrippedOakLog, StrippedOakLog,
StrippedOakWood, StrippedOakWood,
StrippedPaleOakLog,
StrippedPaleOakWood,
StrippedSpruceLog, StrippedSpruceLog,
StrippedSpruceWood, StrippedSpruceWood,
StrippedWarpedHyphae, StrippedWarpedHyphae,

View file

@ -46,7 +46,7 @@ namespace MinecraftClient
public const string Version = MCHighestVersion; public const string Version = MCHighestVersion;
public const string MCLowestVersion = "1.4.6"; public const string MCLowestVersion = "1.4.6";
public const string MCHighestVersion = "1.21"; public const string MCHighestVersion = "1.21.2";
public static readonly string? BuildInfo = null; public static readonly string? BuildInfo = null;
private static Tuple<Thread, CancellationTokenSource>? offlinePrompt = null; private static Tuple<Thread, CancellationTokenSource>? offlinePrompt = null;

View file

@ -73,6 +73,7 @@ namespace MinecraftClient.Protocol.Handlers
internal const int MC_1_20_4_Version = 765; internal const int MC_1_20_4_Version = 765;
internal const int MC_1_20_6_Version = 766; internal const int MC_1_20_6_Version = 766;
internal const int MC_1_21_Version = 767; internal const int MC_1_21_Version = 767;
internal const int MC_1_21_2_Version = 768;
private int compression_treshold = -1; private int compression_treshold = -1;
private int autocomplete_transaction_id = 0; private int autocomplete_transaction_id = 0;
@ -147,8 +148,9 @@ namespace MinecraftClient.Protocol.Handlers
Block.Palette = protocolVersion switch Block.Palette = protocolVersion switch
{ {
// Block palette // Block palette
> MC_1_21_Version when handler.GetTerrainEnabled() => > MC_1_21_2_Version when handler.GetTerrainEnabled() =>
throw new NotImplementedException(Translations.exception_palette_block), throw new NotImplementedException(Translations.exception_palette_block),
>= MC_1_21_2_Version => new Palette1212(),
>= MC_1_20_6_Version => new Palette1206(), >= MC_1_20_6_Version => new Palette1206(),
>= MC_1_20_4_Version => new Palette1204(), >= MC_1_20_4_Version => new Palette1204(),
>= MC_1_20_Version => new Palette120(), >= MC_1_20_Version => new Palette120(),
@ -166,8 +168,9 @@ namespace MinecraftClient.Protocol.Handlers
entityPalette = protocolVersion switch entityPalette = protocolVersion switch
{ {
// Entity palette // Entity palette
> MC_1_21_Version when handler.GetEntityHandlingEnabled() => > MC_1_21_2_Version when handler.GetEntityHandlingEnabled() =>
throw new NotImplementedException(Translations.exception_palette_entity), throw new NotImplementedException(Translations.exception_palette_entity),
>= MC_1_21_2_Version => new EntityPalette1212(),
>= MC_1_20_6_Version => new EntityPalette1206(), >= MC_1_20_6_Version => new EntityPalette1206(),
>= MC_1_20_4_Version => new EntityPalette1204(), >= MC_1_20_4_Version => new EntityPalette1204(),
>= MC_1_20_Version => new EntityPalette120(), >= MC_1_20_Version => new EntityPalette120(),
@ -189,8 +192,9 @@ namespace MinecraftClient.Protocol.Handlers
itemPalette = protocolVersion switch itemPalette = protocolVersion switch
{ {
// Item palette // Item palette
> MC_1_21_Version when handler.GetInventoryEnabled() => > MC_1_21_2_Version when handler.GetInventoryEnabled() =>
throw new NotImplementedException(Translations.exception_palette_item), throw new NotImplementedException(Translations.exception_palette_item),
>= MC_1_21_2_Version => new ItemPalette1212(),
>= MC_1_21_Version => new ItemPalette121(), >= MC_1_21_Version => new ItemPalette121(),
>= MC_1_20_6_Version => new ItemPalette1206(), >= MC_1_20_6_Version => new ItemPalette1206(),
>= MC_1_20_4_Version => new ItemPalette1204(), >= MC_1_20_4_Version => new ItemPalette1204(),

View file

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data.Odbc; using System.Data.Odbc;
using System.Globalization; using System.Globalization;
@ -153,7 +153,7 @@ namespace MinecraftClient.Protocol
int[] suppoertedVersionsProtocol18 = int[] suppoertedVersionsProtocol18 =
{ {
4, 5, 47, 107, 108, 109, 110, 210, 315, 316, 335, 338, 340, 393, 401, 404, 477, 480, 485, 490, 498, 573, 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 575, 578, 735, 736, 751, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768
}; };
if (Array.IndexOf(suppoertedVersionsProtocol18, protocolVersion) > -1) if (Array.IndexOf(suppoertedVersionsProtocol18, protocolVersion) > -1)
@ -351,6 +351,8 @@ namespace MinecraftClient.Protocol
case "1.21": case "1.21":
case "1.21.1": case "1.21.1":
return 767; return 767;
case "1.21.2":
return 768;
default: default:
return 0; return 0;
} }
@ -432,6 +434,7 @@ namespace MinecraftClient.Protocol
765 => "1.20.4", 765 => "1.20.4",
766 => "1.20.6", 766 => "1.20.6",
767 => "1.21", 767 => "1.21",
768 => "1.21.2",
_ => "0.0" _ => "0.0"
}; };
} }