Merge pull request #2938: Add Minecraft 1.21.6 (Protocol 771) Support

Add Minecraft 1.21.6 (Protocol 771) Support
This commit is contained in:
BruceChen 2026-03-21 13:22:14 +08:00 committed by GitHub
commit 7e26542055
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 3747 additions and 11 deletions

File diff suppressed because it is too large Load diff

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,

File diff suppressed because it is too large Load diff

View file

@ -24,7 +24,7 @@ public abstract class EntityMetadataPalette
<= 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_5_Version => new EntityMetadataPalette1215(), // 1.21.5
<= Protocol18Handler.MC_1_21_6_Version => new EntityMetadataPalette1215(), // 1.21.5 - 1.21.6
_ => throw new NotImplementedException()
};
}

View file

@ -0,0 +1,169 @@
using System.Collections.Generic;
namespace MinecraftClient.Mapping.EntityPalettes
{
public class EntityPalette1216 : EntityPalette
{
private static readonly Dictionary<int, EntityType> mappings = new();
static EntityPalette1216()
{
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.Creeper;
mappings[31] = EntityType.DarkOakBoat;
mappings[32] = EntityType.DarkOakChestBoat;
mappings[33] = EntityType.Dolphin;
mappings[34] = EntityType.Donkey;
mappings[35] = EntityType.DragonFireball;
mappings[36] = EntityType.Drowned;
mappings[37] = EntityType.Egg;
mappings[38] = EntityType.ElderGuardian;
mappings[39] = EntityType.Enderman;
mappings[40] = EntityType.Endermite;
mappings[41] = EntityType.EnderDragon;
mappings[42] = EntityType.EnderPearl;
mappings[43] = EntityType.EndCrystal;
mappings[44] = EntityType.Evoker;
mappings[45] = EntityType.EvokerFangs;
mappings[46] = EntityType.ExperienceBottle;
mappings[47] = EntityType.ExperienceOrb;
mappings[48] = EntityType.EyeOfEnder;
mappings[49] = EntityType.FallingBlock;
mappings[50] = EntityType.Fireball;
mappings[51] = EntityType.FireworkRocket;
mappings[52] = EntityType.Fox;
mappings[53] = EntityType.Frog;
mappings[54] = EntityType.FurnaceMinecart;
mappings[55] = EntityType.Ghast;
mappings[56] = EntityType.HappyGhast;
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.SplashPotion;
mappings[101] = EntityType.LingeringPotion;
mappings[102] = EntityType.Pufferfish;
mappings[103] = EntityType.Rabbit;
mappings[104] = EntityType.Ravager;
mappings[105] = EntityType.Salmon;
mappings[106] = EntityType.Sheep;
mappings[107] = EntityType.Shulker;
mappings[108] = EntityType.ShulkerBullet;
mappings[109] = EntityType.Silverfish;
mappings[110] = EntityType.Skeleton;
mappings[111] = EntityType.SkeletonHorse;
mappings[112] = EntityType.Slime;
mappings[113] = EntityType.SmallFireball;
mappings[114] = EntityType.Sniffer;
mappings[115] = EntityType.Snowball;
mappings[116] = EntityType.SnowGolem;
mappings[117] = EntityType.SpawnerMinecart;
mappings[118] = EntityType.SpectralArrow;
mappings[119] = EntityType.Spider;
mappings[120] = EntityType.SpruceBoat;
mappings[121] = EntityType.SpruceChestBoat;
mappings[122] = EntityType.Squid;
mappings[123] = EntityType.Stray;
mappings[124] = EntityType.Strider;
mappings[125] = EntityType.Tadpole;
mappings[126] = EntityType.TextDisplay;
mappings[127] = EntityType.Tnt;
mappings[128] = EntityType.TntMinecart;
mappings[129] = EntityType.TraderLlama;
mappings[130] = EntityType.Trident;
mappings[131] = EntityType.TropicalFish;
mappings[132] = EntityType.Turtle;
mappings[133] = EntityType.Vex;
mappings[134] = EntityType.Villager;
mappings[135] = EntityType.Vindicator;
mappings[136] = EntityType.WanderingTrader;
mappings[137] = EntityType.Warden;
mappings[138] = EntityType.WindCharge;
mappings[139] = EntityType.Witch;
mappings[140] = EntityType.Wither;
mappings[141] = EntityType.WitherSkeleton;
mappings[142] = EntityType.WitherSkull;
mappings[143] = EntityType.Wolf;
mappings[144] = EntityType.Zoglin;
mappings[145] = EntityType.Zombie;
mappings[146] = EntityType.ZombieHorse;
mappings[147] = EntityType.ZombieVillager;
mappings[148] = EntityType.ZombifiedPiglin;
mappings[149] = EntityType.Player;
mappings[150] = EntityType.FishingBobber;
}
protected override Dictionary<int, EntityType> GetDict()
{
return mappings;
}
}
}

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

@ -0,0 +1,255 @@
using System.Collections.Generic;
namespace MinecraftClient.Protocol.Handlers.PacketPalettes;
public class PacketPalette1216 : PacketTypePalette
{
private readonly Dictionary<int, PacketTypesIn> typeIn = new()
{
{ 0x00, PacketTypesIn.Bundle }, // Bundle delimiter
{ 0x01, PacketTypesIn.SpawnEntity }, // Add Entity
{ 0x02, PacketTypesIn.EntityAnimation }, // Animate
{ 0x03, PacketTypesIn.Statistics }, // Award Stats
{ 0x04, PacketTypesIn.BlockChangedAck }, // Block Changed Ack
{ 0x05, PacketTypesIn.BlockBreakAnimation }, // Block Destruction
{ 0x06, PacketTypesIn.BlockEntityData }, // Block Entity Data
{ 0x07, PacketTypesIn.BlockAction }, // Block Event
{ 0x08, PacketTypesIn.BlockChange }, // Block Update
{ 0x09, PacketTypesIn.BossBar }, // Boss Event
{ 0x0A, PacketTypesIn.ServerDifficulty }, // Change Difficulty
{ 0x0B, PacketTypesIn.ChunkBatchFinished }, // Chunk Batch Finished
{ 0x0C, PacketTypesIn.ChunkBatchStarted }, // Chunk Batch Start
{ 0x0D, PacketTypesIn.ChunksBiomes }, // Chunks Biomes
{ 0x0E, PacketTypesIn.ClearTiles }, // Clear Titles
{ 0x0F, PacketTypesIn.TabComplete }, // Command Suggestions
{ 0x10, PacketTypesIn.DeclareCommands }, // Commands
{ 0x11, PacketTypesIn.CloseWindow }, // Container Close
{ 0x12, PacketTypesIn.WindowItems }, // Container Set Content
{ 0x13, PacketTypesIn.WindowProperty }, // Container Set Data
{ 0x14, PacketTypesIn.SetSlot }, // Container Set Slot
{ 0x15, PacketTypesIn.CookieRequest }, // Cookie Request
{ 0x16, PacketTypesIn.SetCooldown }, // Cooldown
{ 0x17, PacketTypesIn.ChatSuggestions }, // Custom Chat Completions
{ 0x18, PacketTypesIn.PluginMessage }, // Custom Payload
{ 0x19, PacketTypesIn.DamageEvent }, // Damage Event
{ 0x1A, PacketTypesIn.DebugSample }, // Debug Sample
{ 0x1B, PacketTypesIn.HideMessage }, // Delete Chat
{ 0x1C, PacketTypesIn.Disconnect }, // Disconnect
{ 0x1D, PacketTypesIn.ProfilelessChatMessage }, // Disguised Chat
{ 0x1E, PacketTypesIn.EntityStatus }, // Entity Event
{ 0x1F, PacketTypesIn.EntityPositionSync }, // Entity Position Sync
{ 0x20, PacketTypesIn.Explosion }, // Explode
{ 0x21, PacketTypesIn.UnloadChunk }, // Forget Level Chunk
{ 0x22, PacketTypesIn.ChangeGameState }, // Game Event
{ 0x23, PacketTypesIn.OpenHorseWindow }, // Horse Screen Open
{ 0x24, PacketTypesIn.HurtAnimation }, // Hurt Animation
{ 0x25, PacketTypesIn.InitializeWorldBorder }, // Initialize Border
{ 0x26, PacketTypesIn.KeepAlive }, // Keep Alive
{ 0x27, PacketTypesIn.ChunkData }, // Level Chunk With Light
{ 0x28, PacketTypesIn.Effect }, // Level Event
{ 0x29, PacketTypesIn.Particle }, // Level Particles
{ 0x2A, PacketTypesIn.UpdateLight }, // Light Update
{ 0x2B, PacketTypesIn.JoinGame }, // Login
{ 0x2C, PacketTypesIn.MapData }, // Map Item Data
{ 0x2D, PacketTypesIn.TradeList }, // Merchant Offers
{ 0x2E, PacketTypesIn.EntityPosition }, // Move Entity Pos
{ 0x2F, PacketTypesIn.EntityPositionAndRotation }, // Move Entity Pos Rot
{ 0x30, PacketTypesIn.MoveMinecartAlongTrack }, // Move Minecart Along Track
{ 0x31, PacketTypesIn.EntityRotation }, // Move Entity Rot
{ 0x32, PacketTypesIn.VehicleMove }, // Move Vehicle
{ 0x33, PacketTypesIn.OpenBook }, // Open Book
{ 0x34, PacketTypesIn.OpenWindow }, // Open Screen
{ 0x35, PacketTypesIn.OpenSignEditor }, // Open Sign Editor
{ 0x36, PacketTypesIn.Ping }, // Ping
{ 0x37, PacketTypesIn.PingResponse }, // Pong Response
{ 0x38, PacketTypesIn.CraftRecipeResponse }, // Place Ghost Recipe
{ 0x39, PacketTypesIn.PlayerAbilities }, // Player Abilities
{ 0x3A, PacketTypesIn.ChatMessage }, // Player Chat
{ 0x3B, PacketTypesIn.EndCombatEvent }, // Player Combat End
{ 0x3C, PacketTypesIn.EnterCombatEvent }, // Player Combat Enter
{ 0x3D, PacketTypesIn.DeathCombatEvent }, // Player Combat Kill
{ 0x3E, PacketTypesIn.PlayerRemove }, // Player Info Remove
{ 0x3F, PacketTypesIn.PlayerInfo }, // Player Info Update
{ 0x40, PacketTypesIn.FacePlayer }, // Player Look At
{ 0x41, PacketTypesIn.PlayerPositionAndLook }, // Player Position
{ 0x42, PacketTypesIn.PlayerRotation }, // Player Rotation
{ 0x43, PacketTypesIn.RecipeBookAdd }, // Recipe Book Add
{ 0x44, PacketTypesIn.RecipeBookRemove }, // Recipe Book Remove
{ 0x45, PacketTypesIn.RecipeBookSettings }, // Recipe Book Settings
{ 0x46, PacketTypesIn.DestroyEntities }, // Remove Entities
{ 0x47, PacketTypesIn.RemoveEntityEffect }, // Remove Mob Effect
{ 0x48, PacketTypesIn.ResetScore }, // Reset Score
{ 0x49, PacketTypesIn.RemoveResourcePack }, // Resource Pack Pop
{ 0x4A, PacketTypesIn.ResourcePackSend }, // Resource Pack Push
{ 0x4B, PacketTypesIn.Respawn }, // Respawn
{ 0x4C, PacketTypesIn.EntityHeadLook }, // Rotate Head
{ 0x4D, PacketTypesIn.MultiBlockChange }, // Section Blocks Update
{ 0x4E, PacketTypesIn.SelectAdvancementTab }, // Select Advancements Tab
{ 0x4F, PacketTypesIn.ServerData }, // Server Data
{ 0x50, PacketTypesIn.ActionBar }, // Set Action Bar Text
{ 0x51, PacketTypesIn.WorldBorderCenter }, // Set Border Center
{ 0x52, PacketTypesIn.WorldBorderLerpSize }, // Set Border Lerp Size
{ 0x53, PacketTypesIn.WorldBorderSize }, // Set Border Size
{ 0x54, PacketTypesIn.WorldBorderWarningDelay }, // Set Border Warning Delay
{ 0x55, PacketTypesIn.WorldBorderWarningReach }, // Set Border Warning Distance
{ 0x56, PacketTypesIn.Camera }, // Set Camera
{ 0x57, PacketTypesIn.UpdateViewPosition }, // Set Chunk Cache Center
{ 0x58, PacketTypesIn.UpdateViewDistance }, // Set Chunk Cache Radius
{ 0x59, PacketTypesIn.SetCursorItem }, // Set Cursor Item
{ 0x5A, PacketTypesIn.SpawnPosition }, // Set Default Spawn Position
{ 0x5B, PacketTypesIn.DisplayScoreboard }, // Set Display Objective
{ 0x5C, PacketTypesIn.EntityMetadata }, // Set Entity Data
{ 0x5D, PacketTypesIn.AttachEntity }, // Set Entity Link
{ 0x5E, PacketTypesIn.EntityVelocity }, // Set Entity Motion
{ 0x5F, PacketTypesIn.EntityEquipment }, // Set Equipment
{ 0x60, PacketTypesIn.SetExperience }, // Set Experience
{ 0x61, PacketTypesIn.UpdateHealth }, // Set Health
{ 0x62, PacketTypesIn.SetHeldSlot }, // Set Held Slot
{ 0x63, PacketTypesIn.ScoreboardObjective }, // Set Objective
{ 0x64, PacketTypesIn.SetPassengers }, // Set Passengers
{ 0x65, PacketTypesIn.SetPlayerInventory }, // Set Player Inventory
{ 0x66, PacketTypesIn.Teams }, // Set Player Team
{ 0x67, PacketTypesIn.UpdateScore }, // Set Score
{ 0x68, PacketTypesIn.UpdateSimulationDistance }, // Set Simulation Distance
{ 0x69, PacketTypesIn.SetTitleSubTitle }, // Set Subtitle Text
{ 0x6A, PacketTypesIn.TimeUpdate }, // Set Time
{ 0x6B, PacketTypesIn.SetTitleText }, // Set Title Text
{ 0x6C, PacketTypesIn.SetTitleTime }, // Set Titles Animation
{ 0x6D, PacketTypesIn.EntitySoundEffect }, // Sound Entity
{ 0x6E, PacketTypesIn.SoundEffect }, // Sound
{ 0x6F, PacketTypesIn.StartConfiguration }, // Start Configuration
{ 0x70, PacketTypesIn.StopSound }, // Stop Sound
{ 0x71, PacketTypesIn.StoreCookie }, // Store Cookie
{ 0x72, PacketTypesIn.SystemChat }, // System Chat
{ 0x73, PacketTypesIn.PlayerListHeaderAndFooter }, // Tab List
{ 0x74, PacketTypesIn.NBTQueryResponse }, // Tag Query
{ 0x75, PacketTypesIn.CollectItem }, // Take Item Entity
{ 0x76, PacketTypesIn.EntityTeleport }, // Teleport Entity
{ 0x77, PacketTypesIn.TestInstanceBlockStatus }, // Test Instance Block Status
{ 0x78, PacketTypesIn.SetTickingState }, // Ticking State
{ 0x79, PacketTypesIn.StepTick }, // Ticking Step
{ 0x7A, PacketTypesIn.Transfer }, // Transfer
{ 0x7B, PacketTypesIn.Advancements }, // Update Advancements
{ 0x7C, PacketTypesIn.EntityProperties }, // Update Attributes
{ 0x7D, PacketTypesIn.EntityEffect }, // Update Mob Effect
{ 0x7E, PacketTypesIn.DeclareRecipes }, // Update Recipes
{ 0x7F, PacketTypesIn.Tags }, // Update Tags
{ 0x80, PacketTypesIn.ProjectilePower }, // Projectile Power
{ 0x81, PacketTypesIn.CustomReportDetails }, // Custom Report Details
{ 0x82, PacketTypesIn.ServerLinks }, // Server Links
{ 0x83, PacketTypesIn.Waypoint }, // Waypoint (new in 1.21.6)
{ 0x84, PacketTypesIn.ClearDialog }, // Clear Dialog (new in 1.21.6)
{ 0x85, PacketTypesIn.ShowDialog } // Show Dialog (new in 1.21.6)
};
private readonly Dictionary<int, PacketTypesOut> typeOut = new()
{
{ 0x00, PacketTypesOut.TeleportConfirm }, // Accept Teleportation
{ 0x01, PacketTypesOut.QueryBlockNBT }, // Block Entity Tag Query
{ 0x02, PacketTypesOut.BundleItemSelected }, // Bundle Item Selected
{ 0x03, PacketTypesOut.SetDifficulty }, // Change Difficulty
{ 0x04, PacketTypesOut.ChangeGameMode }, // Change Game Mode (new in 1.21.6)
{ 0x05, PacketTypesOut.MessageAcknowledgment }, // Chat Ack
{ 0x06, PacketTypesOut.ChatCommand }, // Chat Command
{ 0x07, PacketTypesOut.SignedChatCommand }, // Chat Command Signed
{ 0x08, PacketTypesOut.ChatMessage }, // Chat
{ 0x09, PacketTypesOut.PlayerSession }, // Chat Session Update
{ 0x0A, PacketTypesOut.ChunkBatchReceived }, // Chunk Batch Received
{ 0x0B, PacketTypesOut.ClientStatus }, // Client Command
{ 0x0C, PacketTypesOut.ClientTickEnd }, // Client Tick End
{ 0x0D, PacketTypesOut.ClientSettings }, // Client Information
{ 0x0E, PacketTypesOut.TabComplete }, // Command Suggestion
{ 0x0F, PacketTypesOut.AcknowledgeConfiguration }, // Configuration Acknowledged
{ 0x10, PacketTypesOut.ClickWindowButton }, // Container Button Click
{ 0x11, PacketTypesOut.ClickWindow }, // Container Click
{ 0x12, PacketTypesOut.CloseWindow }, // Container Close
{ 0x13, PacketTypesOut.ChangeContainerSlotState }, // Container Slot State Changed
{ 0x14, PacketTypesOut.CookieResponse }, // Cookie Response
{ 0x15, PacketTypesOut.PluginMessage }, // Custom Payload
{ 0x16, PacketTypesOut.DebugSampleSubscription }, // Debug Sample Subscription
{ 0x17, PacketTypesOut.EditBook }, // Edit Book
{ 0x18, PacketTypesOut.EntityNBTRequest }, // Entity Tag Query
{ 0x19, PacketTypesOut.InteractEntity }, // Interact
{ 0x1A, PacketTypesOut.GenerateStructure }, // Jigsaw Generate
{ 0x1B, PacketTypesOut.KeepAlive }, // Keep Alive
{ 0x1C, PacketTypesOut.LockDifficulty }, // Lock Difficulty
{ 0x1D, PacketTypesOut.PlayerPosition }, // Move Player Pos
{ 0x1E, PacketTypesOut.PlayerPositionAndRotation }, // Move Player Pos Rot
{ 0x1F, PacketTypesOut.PlayerRotation }, // Move Player Rot
{ 0x20, PacketTypesOut.PlayerMovement }, // Move Player Status Only
{ 0x21, PacketTypesOut.VehicleMove }, // Move Vehicle
{ 0x22, PacketTypesOut.SteerBoat }, // Paddle Boat
{ 0x23, PacketTypesOut.PickItem }, // Pick Item From Block
{ 0x24, PacketTypesOut.PickItemFromEntity }, // Pick Item From Entity
{ 0x25, PacketTypesOut.PingRequest }, // Ping Request
{ 0x26, PacketTypesOut.CraftRecipeRequest }, // Place Recipe
{ 0x27, PacketTypesOut.PlayerAbilities }, // Player Abilities
{ 0x28, PacketTypesOut.PlayerDigging }, // Player Action
{ 0x29, PacketTypesOut.EntityAction }, // Player Command
{ 0x2A, PacketTypesOut.SteerVehicle }, // Player Input
{ 0x2B, PacketTypesOut.PlayerLoaded }, // Player Loaded
{ 0x2C, PacketTypesOut.Pong }, // Pong
{ 0x2D, PacketTypesOut.SetDisplayedRecipe }, // Recipe Book Change Settings
{ 0x2E, PacketTypesOut.SetRecipeBookState }, // Recipe Book Seen Recipe
{ 0x2F, PacketTypesOut.NameItem }, // Rename Item
{ 0x30, PacketTypesOut.ResourcePackStatus }, // Resource Pack
{ 0x31, PacketTypesOut.AdvancementTab }, // Seen Advancements
{ 0x32, PacketTypesOut.SelectTrade }, // Select Trade
{ 0x33, PacketTypesOut.SetBeaconEffect }, // Set Beacon
{ 0x34, PacketTypesOut.HeldItemChange }, // Set Carried Item
{ 0x35, PacketTypesOut.UpdateCommandBlock }, // Set Command Block
{ 0x36, PacketTypesOut.UpdateCommandBlockMinecart }, // Set Command Minecart
{ 0x37, PacketTypesOut.CreativeInventoryAction }, // Set Creative Mode Slot
{ 0x38, PacketTypesOut.UpdateJigsawBlock }, // Set Jigsaw Block
{ 0x39, PacketTypesOut.UpdateStructureBlock }, // Set Structure Block
{ 0x3A, PacketTypesOut.SetTestBlock }, // Set Test Block
{ 0x3B, PacketTypesOut.UpdateSign }, // Sign Update
{ 0x3C, PacketTypesOut.Animation }, // Swing
{ 0x3D, PacketTypesOut.Spectate }, // Teleport To Entity
{ 0x3E, PacketTypesOut.TestInstanceBlockAction }, // Test Instance Block Action
{ 0x3F, PacketTypesOut.PlayerBlockPlacement }, // Use Item On
{ 0x40, PacketTypesOut.UseItem }, // Use Item
{ 0x41, PacketTypesOut.CustomClickAction } // Custom Click Action (new in 1.21.6)
};
private readonly Dictionary<int, ConfigurationPacketTypesIn> configurationTypesIn = new()
{
{ 0x00, ConfigurationPacketTypesIn.CookieRequest },
{ 0x01, ConfigurationPacketTypesIn.PluginMessage },
{ 0x02, ConfigurationPacketTypesIn.Disconnect },
{ 0x03, ConfigurationPacketTypesIn.FinishConfiguration },
{ 0x04, ConfigurationPacketTypesIn.KeepAlive },
{ 0x05, ConfigurationPacketTypesIn.Ping },
{ 0x06, ConfigurationPacketTypesIn.ResetChat },
{ 0x07, ConfigurationPacketTypesIn.RegistryData },
{ 0x08, ConfigurationPacketTypesIn.RemoveResourcePack },
{ 0x09, ConfigurationPacketTypesIn.ResourcePack },
{ 0x0A, ConfigurationPacketTypesIn.StoreCookie },
{ 0x0B, ConfigurationPacketTypesIn.Transfer },
{ 0x0C, ConfigurationPacketTypesIn.FeatureFlags },
{ 0x0D, ConfigurationPacketTypesIn.UpdateTags },
{ 0x0E, ConfigurationPacketTypesIn.KnownDataPacks },
{ 0x0F, ConfigurationPacketTypesIn.CustomReportDetails },
{ 0x10, ConfigurationPacketTypesIn.ServerLinks },
{ 0x11, ConfigurationPacketTypesIn.ClearDialog }, // New in 1.21.6
{ 0x12, ConfigurationPacketTypesIn.ShowDialog } // New in 1.21.6
};
private readonly Dictionary<int, ConfigurationPacketTypesOut> configurationTypesOut = new()
{
{ 0x00, ConfigurationPacketTypesOut.ClientInformation },
{ 0x01, ConfigurationPacketTypesOut.CookieResponse },
{ 0x02, ConfigurationPacketTypesOut.PluginMessage },
{ 0x03, ConfigurationPacketTypesOut.FinishConfiguration },
{ 0x04, ConfigurationPacketTypesOut.KeepAlive },
{ 0x05, ConfigurationPacketTypesOut.Pong },
{ 0x06, ConfigurationPacketTypesOut.ResourcePackResponse },
{ 0x07, ConfigurationPacketTypesOut.KnownDataPacks },
{ 0x08, ConfigurationPacketTypesOut.CustomClickAction } // New in 1.21.6
};
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => configurationTypesIn!;
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => configurationTypesOut!;
}

View file

@ -48,8 +48,9 @@ namespace MinecraftClient.Protocol.Handlers
{
PacketTypePalette p = protocol switch
{
> Protocol18Handler.MC_1_21_5_Version => throw new NotImplementedException(Translations
> Protocol18Handler.MC_1_21_6_Version => throw new NotImplementedException(Translations
.exception_palette_packet),
<= Protocol18Handler.MC_1_21_6_Version and > Protocol18Handler.MC_1_21_5_Version => new PacketPalette1216(),
<= Protocol18Handler.MC_1_21_5_Version and > Protocol18Handler.MC_1_21_4_Version => new PacketPalette1215(),
<= Protocol18Handler.MC_1_21_4_Version and > Protocol18Handler.MC_1_21_2_Version => new PacketPalette1214(),
<= Protocol18Handler.MC_1_8_Version => new PacketPalette17(),

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,8 +151,9 @@ 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_6_Version => new Palette1216(),
>= MC_1_21_5_Version => new Palette1215(),
>= MC_1_21_4_Version => new Palette1214(),
>= MC_1_21_2_Version => new Palette1212(),
@ -172,8 +174,9 @@ 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_6_Version => new EntityPalette1216(),
>= MC_1_21_5_Version => new EntityPalette1215(),
>= MC_1_21_4_Version => new EntityPalette1214(),
>= MC_1_21_2_Version => new EntityPalette1212(),
@ -198,8 +201,9 @@ 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_6_Version => new ItemPalette1216(),
>= MC_1_21_5_Version => new ItemPalette1215(),
>= MC_1_21_4_Version => new ItemPalette1214(),
>= MC_1_21_2_Version => new ItemPalette1212(),
@ -2655,7 +2659,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

@ -213,7 +213,9 @@ namespace MinecraftClient.Protocol.Handlers
{
// 1.21.5: No VarInt length prefix; calculate from bits per entry
// Biome container has 64 entries (4x4x4)
int dataArrayLength = (64 * bitsPerEntryBiome + 63) / 64;
// Uses SimpleBitStorage: valuesPerLong = 64/bitsPerEntry, longs = ceil(64/valuesPerLong)
int valuesPerLong = 64 / bitsPerEntryBiome;
int dataArrayLength = (64 + valuesPerLong - 1) / valuesPerLong;
dataTypes.DropData(dataArrayLength * 8, cache);
}
else

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