Merge pull request #2932: Add Minecraft 1.21.4 (Protocol 769) Support

Add Minecraft 1.21.4 (Protocol 769) Support
This commit is contained in:
BruceChen 2026-03-21 01:11:16 +08:00 committed by GitHub
commit 5d00fa6ea6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 3710 additions and 12 deletions

11
.gitignore vendored
View file

@ -383,7 +383,7 @@ FodyWeavers.xsd
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/launch.json``
!.vscode/extensions.json
*.code-workspace
@ -419,3 +419,12 @@ FodyWeavers.xsd
/docs/l10n/
/docs/.vuepress/public/MCC-README/
# Floder to store the decompiled Minecraft official source code
MinecraftOfficial/
# Possible debug files
/lang/*
/mcc_input.txt
/MinecraftClient.ini
/MinecraftClient.backup.ini

File diff suppressed because it is too large Load diff

View file

@ -244,6 +244,7 @@ namespace MinecraftClient.Inventory
ChiseledPolishedBlackstone,
ChiseledQuartzBlock,
ChiseledRedSandstone,
ChiseledResinBricks,
ChiseledSandstone,
ChiseledStoneBricks,
ChiseledTuff,
@ -254,6 +255,7 @@ namespace MinecraftClient.Inventory
Clay,
ClayBall,
Clock,
ClosedEyeblossom,
Coal,
CoalBlock,
CoalOre,
@ -855,6 +857,7 @@ namespace MinecraftClient.Inventory
OchreFroglight,
OminousBottle,
OminousTrialKey,
OpenEyeblossom,
OrangeBanner,
OrangeBed,
OrangeCandle,
@ -1066,6 +1069,13 @@ namespace MinecraftClient.Inventory
ReinforcedDeepslate,
Repeater,
RepeatingCommandBlock,
ResinBlock,
ResinBrick,
ResinBricks,
ResinBrickSlab,
ResinBrickStairs,
ResinBrickWall,
ResinClump,
RespawnAnchor,
RibArmorTrimSmithingTemplate,
RootedDirt,

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_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_2_Version => new EntityMetadataPalette1206(), // 1.20.6 - 1.21.2
<= Protocol18Handler.MC_1_21_4_Version => new EntityMetadataPalette1206(), // 1.20.6 - 1.21.4
_ => throw new NotImplementedException()
};
}

View file

@ -0,0 +1,168 @@
using System.Collections.Generic;
namespace MinecraftClient.Mapping.EntityPalettes
{
public class EntityPalette1214 : EntityPalette
{
private static readonly Dictionary<int, EntityType> mappings = new();
static EntityPalette1214()
{
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;
// CreakingTransient removed in 1.21.4
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.Giant;
mappings[57] = EntityType.GlowItemFrame;
mappings[58] = EntityType.GlowSquid;
mappings[59] = EntityType.Goat;
mappings[60] = EntityType.Guardian;
mappings[61] = EntityType.Hoglin;
mappings[62] = EntityType.HopperMinecart;
mappings[63] = EntityType.Horse;
mappings[64] = EntityType.Husk;
mappings[65] = EntityType.Illusioner;
mappings[66] = EntityType.Interaction;
mappings[67] = EntityType.IronGolem;
mappings[68] = EntityType.Item;
mappings[69] = EntityType.ItemDisplay;
mappings[70] = EntityType.ItemFrame;
mappings[71] = EntityType.JungleBoat;
mappings[72] = EntityType.JungleChestBoat;
mappings[73] = EntityType.LeashKnot;
mappings[74] = EntityType.LightningBolt;
mappings[75] = EntityType.Llama;
mappings[76] = EntityType.LlamaSpit;
mappings[77] = EntityType.MagmaCube;
mappings[78] = EntityType.MangroveBoat;
mappings[79] = EntityType.MangroveChestBoat;
mappings[80] = EntityType.Marker;
mappings[81] = EntityType.Minecart;
mappings[82] = EntityType.Mooshroom;
mappings[83] = EntityType.Mule;
mappings[84] = EntityType.OakBoat;
mappings[85] = EntityType.OakChestBoat;
mappings[86] = EntityType.Ocelot;
mappings[87] = EntityType.OminousItemSpawner;
mappings[88] = EntityType.Painting;
mappings[89] = EntityType.PaleOakBoat;
mappings[90] = EntityType.PaleOakChestBoat;
mappings[91] = EntityType.Panda;
mappings[92] = EntityType.Parrot;
mappings[93] = EntityType.Phantom;
mappings[94] = EntityType.Pig;
mappings[95] = EntityType.Piglin;
mappings[96] = EntityType.PiglinBrute;
mappings[97] = EntityType.Pillager;
mappings[98] = EntityType.PolarBear;
mappings[99] = EntityType.Potion;
mappings[100] = EntityType.Pufferfish;
mappings[101] = EntityType.Rabbit;
mappings[102] = EntityType.Ravager;
mappings[103] = EntityType.Salmon;
mappings[104] = EntityType.Sheep;
mappings[105] = EntityType.Shulker;
mappings[106] = EntityType.ShulkerBullet;
mappings[107] = EntityType.Silverfish;
mappings[108] = EntityType.Skeleton;
mappings[109] = EntityType.SkeletonHorse;
mappings[110] = EntityType.Slime;
mappings[111] = EntityType.SmallFireball;
mappings[112] = EntityType.Sniffer;
mappings[113] = EntityType.Snowball;
mappings[114] = EntityType.SnowGolem;
mappings[115] = EntityType.SpawnerMinecart;
mappings[116] = EntityType.SpectralArrow;
mappings[117] = EntityType.Spider;
mappings[118] = EntityType.SpruceBoat;
mappings[119] = EntityType.SpruceChestBoat;
mappings[120] = EntityType.Squid;
mappings[121] = EntityType.Stray;
mappings[122] = EntityType.Strider;
mappings[123] = EntityType.Tadpole;
mappings[124] = EntityType.TextDisplay;
mappings[125] = EntityType.Tnt;
mappings[126] = EntityType.TntMinecart;
mappings[127] = EntityType.TraderLlama;
mappings[128] = EntityType.Trident;
mappings[129] = EntityType.TropicalFish;
mappings[130] = EntityType.Turtle;
mappings[131] = EntityType.Vex;
mappings[132] = EntityType.Villager;
mappings[133] = EntityType.Vindicator;
mappings[134] = EntityType.WanderingTrader;
mappings[135] = EntityType.Warden;
mappings[136] = EntityType.WindCharge;
mappings[137] = EntityType.Witch;
mappings[138] = EntityType.Wither;
mappings[139] = EntityType.WitherSkeleton;
mappings[140] = EntityType.WitherSkull;
mappings[141] = EntityType.Wolf;
mappings[142] = EntityType.Zoglin;
mappings[143] = EntityType.Zombie;
mappings[144] = EntityType.ZombieHorse;
mappings[145] = EntityType.ZombieVillager;
mappings[146] = EntityType.ZombifiedPiglin;
mappings[147] = EntityType.Player;
mappings[148] = EntityType.FishingBobber;
}
protected override Dictionary<int, EntityType> GetDict()
{
return mappings;
}
}
}

View file

@ -204,6 +204,7 @@ namespace MinecraftClient.Mapping
ChiseledPolishedBlackstone,
ChiseledQuartzBlock,
ChiseledRedSandstone,
ChiseledResinBricks,
ChiseledSandstone,
ChiseledStoneBricks,
ChiseledTuff,
@ -211,6 +212,7 @@ namespace MinecraftClient.Mapping
ChorusFlower,
ChorusPlant,
Clay,
ClosedEyeblossom,
CoalBlock,
CoalOre,
CoarseDirt,
@ -636,6 +638,7 @@ namespace MinecraftClient.Mapping
Observer,
Obsidian,
OchreFroglight,
OpenEyeblossom,
OrangeBanner,
OrangeBed,
OrangeCandle,
@ -752,6 +755,7 @@ namespace MinecraftClient.Mapping
PottedBrownMushroom,
PottedCactus,
PottedCherrySapling,
PottedClosedEyeblossom,
PottedCornflower,
PottedCrimsonFungus,
PottedCrimsonRoots,
@ -764,6 +768,7 @@ namespace MinecraftClient.Mapping
PottedLilyOfTheValley,
PottedMangrovePropagule,
PottedOakSapling,
PottedOpenEyeblossom,
PottedOrangeTulip,
PottedOxeyeDaisy,
PottedPaleOakSapling,
@ -851,6 +856,12 @@ namespace MinecraftClient.Mapping
ReinforcedDeepslate,
Repeater,
RepeatingCommandBlock,
ResinBlock,
ResinBrickSlab,
ResinBrickStairs,
ResinBrickWall,
ResinBricks,
ResinClump,
RespawnAnchor,
RootedDirt,
RoseBush,

View file

@ -1,4 +1,4 @@
namespace MinecraftClient.Mapping
namespace MinecraftClient.Mapping
{
/// <summary>
/// Defines extension methods for the Material enumeration
@ -122,6 +122,7 @@
case Material.ChiseledPolishedBlackstone:
case Material.ChiseledQuartzBlock:
case Material.ChiseledRedSandstone:
case Material.ChiseledResinBricks:
case Material.ChiseledSandstone:
case Material.ChiseledStoneBricks:
case Material.ChorusFlower:
@ -500,6 +501,8 @@
case Material.PottedBlueOrchid:
case Material.PottedBrownMushroom:
case Material.PottedCactus:
case Material.PottedCherrySapling:
case Material.PottedClosedEyeblossom:
case Material.PottedCornflower:
case Material.PottedDandelion:
case Material.PottedDarkOakSapling:
@ -509,6 +512,7 @@
case Material.PottedJungleSapling:
case Material.PottedLilyOfTheValley:
case Material.PottedOakSapling:
case Material.PottedOpenEyeblossom:
case Material.PottedOrangeTulip:
case Material.PottedOxeyeDaisy:
case Material.PottedPinkTulip:
@ -576,6 +580,10 @@
case Material.RedWool:
case Material.ReinforcedDeepslate:
case Material.RepeatingCommandBlock:
case Material.ResinBlock:
case Material.ResinBrickStairs:
case Material.ResinBrickWall:
case Material.ResinBricks:
case Material.RespawnAnchor:
case Material.RootedDirt:
case Material.Sand:
@ -868,6 +876,7 @@
case Material.QuartzSlab:
case Material.RedNetherBrickSlab:
case Material.RedSandstoneSlab:
case Material.ResinBrickSlab:
case Material.SandstoneSlab:
case Material.SmoothQuartzSlab:
case Material.SmoothRedSandstoneSlab:

View file

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

View file

@ -37,10 +37,12 @@ namespace MinecraftClient.Protocol.Handlers
MessageAcknowledgment, // Added in 1.19.1 (1.19.2)
NameItem, //
PickItem, //
PickItemFromEntity, // Added in 1.21.4 (split from PickItem)
PingRequest, // Added in 1.20.2
PlayerAbilities, //
PlayerBlockPlacement, //
PlayerDigging, //
PlayerLoaded, // Added in 1.21.4
PlayerMovement, //
PlayerPosition, //
PlayerPositionAndRotation, //

View file

@ -74,6 +74,7 @@ namespace MinecraftClient.Protocol.Handlers
internal const int MC_1_20_6_Version = 766;
internal const int MC_1_21_Version = 767;
internal const int MC_1_21_2_Version = 768;
internal const int MC_1_21_4_Version = 769;
private int compression_treshold = -1;
private int autocomplete_transaction_id = 0;
@ -125,21 +126,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_2_Version)
if (handler.GetTerrainEnabled() && protocolVersion > MC_1_21_4_Version)
{
log.Error($"§c{Translations.extra_terrainandmovement_disabled}");
handler.SetTerrainEnabled(false);
}
if (handler.GetInventoryEnabled() &&
protocolVersion is < MC_1_8_Version or > MC_1_21_2_Version)
protocolVersion is < MC_1_8_Version or > MC_1_21_4_Version)
{
log.Error($"§c{Translations.extra_inventory_disabled}");
handler.SetInventoryEnabled(false);
}
if (handler.GetEntityHandlingEnabled() &&
protocolVersion is < MC_1_8_Version or > MC_1_21_2_Version)
protocolVersion is < MC_1_8_Version or > MC_1_21_4_Version)
{
log.Error($"§c{Translations.extra_entity_disabled}");
handler.SetEntityHandlingEnabled(false);
@ -148,8 +149,9 @@ namespace MinecraftClient.Protocol.Handlers
Block.Palette = protocolVersion switch
{
// Block palette
> MC_1_21_2_Version when handler.GetTerrainEnabled() =>
> MC_1_21_4_Version when handler.GetTerrainEnabled() =>
throw new NotImplementedException(Translations.exception_palette_block),
>= MC_1_21_4_Version => new Palette1214(),
>= MC_1_21_2_Version => new Palette1212(),
>= MC_1_20_6_Version => new Palette1206(),
>= MC_1_20_4_Version => new Palette1204(),
@ -168,8 +170,9 @@ namespace MinecraftClient.Protocol.Handlers
entityPalette = protocolVersion switch
{
// Entity palette
> MC_1_21_2_Version when handler.GetEntityHandlingEnabled() =>
> MC_1_21_4_Version when handler.GetEntityHandlingEnabled() =>
throw new NotImplementedException(Translations.exception_palette_entity),
>= MC_1_21_4_Version => new EntityPalette1214(),
>= MC_1_21_2_Version => new EntityPalette1212(),
>= MC_1_20_6_Version => new EntityPalette1206(),
>= MC_1_20_4_Version => new EntityPalette1204(),
@ -192,8 +195,9 @@ namespace MinecraftClient.Protocol.Handlers
itemPalette = protocolVersion switch
{
// Item palette
> MC_1_21_2_Version when handler.GetInventoryEnabled() =>
> MC_1_21_4_Version when handler.GetInventoryEnabled() =>
throw new NotImplementedException(Translations.exception_palette_item),
>= MC_1_21_4_Version => new ItemPalette1214(),
>= MC_1_21_2_Version => new ItemPalette1212(),
>= MC_1_21_Version => new ItemPalette121(),
>= MC_1_20_6_Version => new ItemPalette1206(),
@ -877,6 +881,10 @@ namespace MinecraftClient.Protocol.Handlers
if (protocolVersion >= MC_1_20_6_Version)
dataTypes.ReadNextBool(packetData); // Enforoces Secure Chat
}
if (protocolVersion >= MC_1_21_4_Version)
SendPacket(PacketTypesOut.PlayerLoaded, new List<byte>());
break;
case PacketTypesIn.SpawnPainting: // Just skip, no need for this
return true;
@ -2623,7 +2631,7 @@ namespace MinecraftClient.Protocol.Handlers
// Also make a palette for field? Will be a lot of work
var healthField = protocolVersion switch
{
> MC_1_21_2_Version => throw new NotImplementedException(Translations
> MC_1_21_4_Version => throw new NotImplementedException(Translations
.exception_palette_healthfield),
// 1.17 and above
>= MC_1_17_Version => 9,

View file

@ -153,7 +153,8 @@ namespace MinecraftClient.Protocol
int[] suppoertedVersionsProtocol18 =
{
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
575, 578, 735, 736, 751, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768,
769
};
if (Array.IndexOf(suppoertedVersionsProtocol18, protocolVersion) > -1)
@ -353,6 +354,10 @@ namespace MinecraftClient.Protocol
return 767;
case "1.21.2":
return 768;
case "1.21.3":
return 768;
case "1.21.4":
return 769;
default:
return 0;
}
@ -435,6 +440,7 @@ namespace MinecraftClient.Protocol
766 => "1.20.6",
767 => "1.21",
768 => "1.21.2",
769 => "1.21.4",
_ => "0.0"
};
}