mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
Merge pull request #2955 from BruceChenQAQ/master
Add Minecraft 26.1 Support
This commit is contained in:
commit
cffddb398e
20 changed files with 4616 additions and 27 deletions
1524
MinecraftClient/Inventory/ItemPalettes/ItemPalette261.cs
Normal file
1524
MinecraftClient/Inventory/ItemPalettes/ItemPalette261.cs
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -578,6 +578,7 @@ namespace MinecraftClient.Inventory
|
|||
GoldenAxe,
|
||||
GoldenBoots,
|
||||
GoldenCarrot,
|
||||
GoldenDandelion,
|
||||
GoldenChestplate,
|
||||
GoldenHelmet,
|
||||
GoldenHoe,
|
||||
|
|
|
|||
2354
MinecraftClient/Mapping/BlockPalettes/Palette261.cs
Normal file
2354
MinecraftClient/Mapping/BlockPalettes/Palette261.cs
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -57,10 +57,18 @@ public enum EntityMetaDataType
|
|||
/// </summary>
|
||||
CatVariant,
|
||||
/// <summary>
|
||||
/// VarInt (1.21.5+)
|
||||
/// </summary>
|
||||
CatSoundVariant,
|
||||
/// <summary>
|
||||
/// VarInt (1.20.6+)
|
||||
/// </summary>
|
||||
CowVariant,
|
||||
/// <summary>
|
||||
/// VarInt (1.21.5+)
|
||||
/// </summary>
|
||||
CowSoundVariant,
|
||||
/// <summary>
|
||||
/// VarInt (1.20.6+)
|
||||
/// </summary>
|
||||
WolfVariant,
|
||||
|
|
@ -76,8 +84,16 @@ public enum EntityMetaDataType
|
|||
/// <summary>
|
||||
/// VarInt (1.21.5+)
|
||||
/// </summary>
|
||||
PigSoundVariant,
|
||||
/// <summary>
|
||||
/// VarInt (1.21.5+)
|
||||
/// </summary>
|
||||
ChickenVariant,
|
||||
/// <summary>
|
||||
/// VarInt (1.21.5+)
|
||||
/// </summary>
|
||||
ChickenSoundVariant,
|
||||
/// <summary>
|
||||
/// String + Position
|
||||
/// </summary>
|
||||
GlobalPosition,
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public abstract class EntityMetadataPalette
|
|||
<= Protocol18Handler.MC_1_21_7_Version => new EntityMetadataPalette1215(), // 1.21.5 - 1.21.8
|
||||
<= Protocol18Handler.MC_1_21_9_Version => new EntityMetadataPalette1219(), // 1.21.9 - 1.21.10
|
||||
<= Protocol18Handler.MC_1_21_11_Version => new EntityMetadataPalette12111(), // 1.21.11
|
||||
<= Protocol18Handler.MC_26_1_Version => new EntityMetadataPalette261(), // 26.1
|
||||
_ => throw new NotImplementedException()
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Mapping.EntityMetadataPalettes;
|
||||
|
||||
public class EntityMetadataPalette261 : EntityMetadataPalette
|
||||
{
|
||||
private readonly Dictionary<int, EntityMetaDataType> entityMetadataMappings = new()
|
||||
{
|
||||
{ 0, EntityMetaDataType.Byte },
|
||||
{ 1, EntityMetaDataType.VarInt },
|
||||
{ 2, EntityMetaDataType.VarLong },
|
||||
{ 3, EntityMetaDataType.Float },
|
||||
{ 4, EntityMetaDataType.String },
|
||||
{ 5, EntityMetaDataType.Chat },
|
||||
{ 6, EntityMetaDataType.OptionalChat },
|
||||
{ 7, EntityMetaDataType.Slot },
|
||||
{ 8, EntityMetaDataType.Boolean },
|
||||
{ 9, EntityMetaDataType.Rotation },
|
||||
{ 10, EntityMetaDataType.Position },
|
||||
{ 11, EntityMetaDataType.OptionalPosition },
|
||||
{ 12, EntityMetaDataType.Direction },
|
||||
{ 13, EntityMetaDataType.OptionalLivingEntityReference },
|
||||
{ 14, EntityMetaDataType.BlockId },
|
||||
{ 15, EntityMetaDataType.OptionalBlockId },
|
||||
{ 16, EntityMetaDataType.Particle },
|
||||
{ 17, EntityMetaDataType.Particles },
|
||||
{ 18, EntityMetaDataType.VillagerData },
|
||||
{ 19, EntityMetaDataType.OptionalVarInt },
|
||||
{ 20, EntityMetaDataType.Pose },
|
||||
{ 21, EntityMetaDataType.CatVariant },
|
||||
{ 22, EntityMetaDataType.CatSoundVariant },
|
||||
{ 23, EntityMetaDataType.CowVariant },
|
||||
{ 24, EntityMetaDataType.CowSoundVariant },
|
||||
{ 25, EntityMetaDataType.WolfVariant },
|
||||
{ 26, EntityMetaDataType.WolfSoundVariant },
|
||||
{ 27, EntityMetaDataType.FrogVariant },
|
||||
{ 28, EntityMetaDataType.PigVariant },
|
||||
{ 29, EntityMetaDataType.PigSoundVariant },
|
||||
{ 30, EntityMetaDataType.ChickenVariant },
|
||||
{ 31, EntityMetaDataType.ChickenSoundVariant },
|
||||
{ 32, EntityMetaDataType.ZombieNautilusVariant },
|
||||
{ 33, EntityMetaDataType.OptionalGlobalPosition },
|
||||
{ 34, EntityMetaDataType.PaintingVariant },
|
||||
{ 35, EntityMetaDataType.SnifferState },
|
||||
{ 36, EntityMetaDataType.ArmadilloState },
|
||||
{ 37, EntityMetaDataType.CopperGolemState },
|
||||
{ 38, EntityMetaDataType.WeatheringCopperState },
|
||||
{ 39, EntityMetaDataType.Vector3 },
|
||||
{ 40, EntityMetaDataType.Quaternion },
|
||||
{ 41, EntityMetaDataType.ResolvableProfile },
|
||||
{ 42, EntityMetaDataType.HumanoidArm },
|
||||
};
|
||||
|
||||
public override Dictionary<int, EntityMetaDataType> GetEntityMetadataMappingsList()
|
||||
{
|
||||
return entityMetadataMappings;
|
||||
}
|
||||
}
|
||||
175
MinecraftClient/Mapping/EntityPalettes/EntityPalette261.cs
Normal file
175
MinecraftClient/Mapping/EntityPalettes/EntityPalette261.cs
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Mapping.EntityPalettes
|
||||
{
|
||||
public class EntityPalette261 : EntityPalette
|
||||
{
|
||||
private static readonly Dictionary<int, EntityType> mappings = new();
|
||||
|
||||
static EntityPalette261()
|
||||
{
|
||||
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.CamelHusk;
|
||||
mappings[21] = EntityType.Cat;
|
||||
mappings[22] = EntityType.CaveSpider;
|
||||
mappings[23] = EntityType.CherryBoat;
|
||||
mappings[24] = EntityType.CherryChestBoat;
|
||||
mappings[25] = EntityType.ChestMinecart;
|
||||
mappings[26] = EntityType.Chicken;
|
||||
mappings[27] = EntityType.Cod;
|
||||
mappings[28] = EntityType.CopperGolem;
|
||||
mappings[29] = EntityType.CommandBlockMinecart;
|
||||
mappings[30] = EntityType.Cow;
|
||||
mappings[31] = EntityType.Creaking;
|
||||
mappings[32] = EntityType.Creeper;
|
||||
mappings[33] = EntityType.DarkOakBoat;
|
||||
mappings[34] = EntityType.DarkOakChestBoat;
|
||||
mappings[35] = EntityType.Dolphin;
|
||||
mappings[36] = EntityType.Donkey;
|
||||
mappings[37] = EntityType.DragonFireball;
|
||||
mappings[38] = EntityType.Drowned;
|
||||
mappings[39] = EntityType.Egg;
|
||||
mappings[40] = EntityType.ElderGuardian;
|
||||
mappings[41] = EntityType.Enderman;
|
||||
mappings[42] = EntityType.Endermite;
|
||||
mappings[43] = EntityType.EnderDragon;
|
||||
mappings[44] = EntityType.EnderPearl;
|
||||
mappings[45] = EntityType.EndCrystal;
|
||||
mappings[46] = EntityType.Evoker;
|
||||
mappings[47] = EntityType.EvokerFangs;
|
||||
mappings[48] = EntityType.ExperienceBottle;
|
||||
mappings[49] = EntityType.ExperienceOrb;
|
||||
mappings[50] = EntityType.EyeOfEnder;
|
||||
mappings[51] = EntityType.FallingBlock;
|
||||
mappings[52] = EntityType.Fireball;
|
||||
mappings[53] = EntityType.FireworkRocket;
|
||||
mappings[54] = EntityType.Fox;
|
||||
mappings[55] = EntityType.Frog;
|
||||
mappings[56] = EntityType.FurnaceMinecart;
|
||||
mappings[57] = EntityType.Ghast;
|
||||
mappings[58] = EntityType.HappyGhast;
|
||||
mappings[59] = EntityType.Giant;
|
||||
mappings[60] = EntityType.GlowItemFrame;
|
||||
mappings[61] = EntityType.GlowSquid;
|
||||
mappings[62] = EntityType.Goat;
|
||||
mappings[63] = EntityType.Guardian;
|
||||
mappings[64] = EntityType.Hoglin;
|
||||
mappings[65] = EntityType.HopperMinecart;
|
||||
mappings[66] = EntityType.Horse;
|
||||
mappings[67] = EntityType.Husk;
|
||||
mappings[68] = EntityType.Illusioner;
|
||||
mappings[69] = EntityType.Interaction;
|
||||
mappings[70] = EntityType.IronGolem;
|
||||
mappings[71] = EntityType.Item;
|
||||
mappings[72] = EntityType.ItemDisplay;
|
||||
mappings[73] = EntityType.ItemFrame;
|
||||
mappings[74] = EntityType.JungleBoat;
|
||||
mappings[75] = EntityType.JungleChestBoat;
|
||||
mappings[76] = EntityType.LeashKnot;
|
||||
mappings[77] = EntityType.LightningBolt;
|
||||
mappings[78] = EntityType.Llama;
|
||||
mappings[79] = EntityType.LlamaSpit;
|
||||
mappings[80] = EntityType.MagmaCube;
|
||||
mappings[81] = EntityType.MangroveBoat;
|
||||
mappings[82] = EntityType.MangroveChestBoat;
|
||||
mappings[83] = EntityType.Mannequin;
|
||||
mappings[84] = EntityType.Marker;
|
||||
mappings[85] = EntityType.Minecart;
|
||||
mappings[86] = EntityType.Mooshroom;
|
||||
mappings[87] = EntityType.Mule;
|
||||
mappings[88] = EntityType.Nautilus;
|
||||
mappings[89] = EntityType.OakBoat;
|
||||
mappings[90] = EntityType.OakChestBoat;
|
||||
mappings[91] = EntityType.Ocelot;
|
||||
mappings[92] = EntityType.OminousItemSpawner;
|
||||
mappings[93] = EntityType.Painting;
|
||||
mappings[94] = EntityType.PaleOakBoat;
|
||||
mappings[95] = EntityType.PaleOakChestBoat;
|
||||
mappings[96] = EntityType.Panda;
|
||||
mappings[97] = EntityType.Parched;
|
||||
mappings[98] = EntityType.Parrot;
|
||||
mappings[99] = EntityType.Phantom;
|
||||
mappings[100] = EntityType.Pig;
|
||||
mappings[101] = EntityType.Piglin;
|
||||
mappings[102] = EntityType.PiglinBrute;
|
||||
mappings[103] = EntityType.Pillager;
|
||||
mappings[104] = EntityType.PolarBear;
|
||||
mappings[105] = EntityType.SplashPotion;
|
||||
mappings[106] = EntityType.LingeringPotion;
|
||||
mappings[107] = EntityType.Pufferfish;
|
||||
mappings[108] = EntityType.Rabbit;
|
||||
mappings[109] = EntityType.Ravager;
|
||||
mappings[110] = EntityType.Salmon;
|
||||
mappings[111] = EntityType.Sheep;
|
||||
mappings[112] = EntityType.Shulker;
|
||||
mappings[113] = EntityType.ShulkerBullet;
|
||||
mappings[114] = EntityType.Silverfish;
|
||||
mappings[115] = EntityType.Skeleton;
|
||||
mappings[116] = EntityType.SkeletonHorse;
|
||||
mappings[117] = EntityType.Slime;
|
||||
mappings[118] = EntityType.SmallFireball;
|
||||
mappings[119] = EntityType.Sniffer;
|
||||
mappings[120] = EntityType.Snowball;
|
||||
mappings[121] = EntityType.SnowGolem;
|
||||
mappings[122] = EntityType.SpawnerMinecart;
|
||||
mappings[123] = EntityType.SpectralArrow;
|
||||
mappings[124] = EntityType.Spider;
|
||||
mappings[125] = EntityType.SpruceBoat;
|
||||
mappings[126] = EntityType.SpruceChestBoat;
|
||||
mappings[127] = EntityType.Squid;
|
||||
mappings[128] = EntityType.Stray;
|
||||
mappings[129] = EntityType.Strider;
|
||||
mappings[130] = EntityType.Tadpole;
|
||||
mappings[131] = EntityType.TextDisplay;
|
||||
mappings[132] = EntityType.Tnt;
|
||||
mappings[133] = EntityType.TntMinecart;
|
||||
mappings[134] = EntityType.TraderLlama;
|
||||
mappings[135] = EntityType.Trident;
|
||||
mappings[136] = EntityType.TropicalFish;
|
||||
mappings[137] = EntityType.Turtle;
|
||||
mappings[138] = EntityType.Vex;
|
||||
mappings[139] = EntityType.Villager;
|
||||
mappings[140] = EntityType.Vindicator;
|
||||
mappings[141] = EntityType.WanderingTrader;
|
||||
mappings[142] = EntityType.Warden;
|
||||
mappings[143] = EntityType.WindCharge;
|
||||
mappings[144] = EntityType.Witch;
|
||||
mappings[145] = EntityType.Wither;
|
||||
mappings[146] = EntityType.WitherSkeleton;
|
||||
mappings[147] = EntityType.WitherSkull;
|
||||
mappings[148] = EntityType.Wolf;
|
||||
mappings[149] = EntityType.Zoglin;
|
||||
mappings[150] = EntityType.Zombie;
|
||||
mappings[151] = EntityType.ZombieHorse;
|
||||
mappings[152] = EntityType.ZombieNautilus;
|
||||
mappings[153] = EntityType.ZombieVillager;
|
||||
mappings[154] = EntityType.ZombifiedPiglin;
|
||||
mappings[155] = EntityType.Player;
|
||||
mappings[156] = EntityType.FishingBobber;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, EntityType> GetDict()
|
||||
{
|
||||
return mappings;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -431,6 +431,7 @@ namespace MinecraftClient.Mapping
|
|||
Glowstone,
|
||||
GoldBlock,
|
||||
GoldOre,
|
||||
GoldenDandelion,
|
||||
Granite,
|
||||
GraniteSlab,
|
||||
GraniteStairs,
|
||||
|
|
@ -799,6 +800,7 @@ namespace MinecraftClient.Mapping
|
|||
PottedDeadBush,
|
||||
PottedFern,
|
||||
PottedFloweringAzaleaBush,
|
||||
PottedGoldenDandelion,
|
||||
PottedJungleSapling,
|
||||
PottedLilyOfTheValley,
|
||||
PottedMangrovePropagule,
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace MinecraftClient
|
|||
|
||||
public const string Version = MCHighestVersion;
|
||||
public const string MCLowestVersion = "1.4.6";
|
||||
public const string MCHighestVersion = "1.21.11";
|
||||
public const string MCHighestVersion = "26.1";
|
||||
public static readonly string? BuildInfo = null;
|
||||
|
||||
private static Tuple<Thread, CancellationTokenSource>? offlinePrompt = null;
|
||||
|
|
|
|||
|
|
@ -893,16 +893,20 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
value = ReadNextVarInt(cache);
|
||||
break;
|
||||
case EntityMetaDataType.CatVariant: // Cat Variant
|
||||
case EntityMetaDataType.CatSoundVariant: // Cat Sound Variant (26.1+)
|
||||
value = ReadNextVarInt(cache);
|
||||
break;
|
||||
case EntityMetaDataType.CowVariant: // Cow Variant (1.21.5+)
|
||||
case EntityMetaDataType.CowSoundVariant: // Cow Sound Variant (26.1+)
|
||||
case EntityMetaDataType.WolfVariant: // Wolf Variant (1.20.6+)
|
||||
case EntityMetaDataType.WolfSoundVariant: // Wolf Sound Variant (1.21.5+)
|
||||
value = ReadNextVarInt(cache);
|
||||
break;
|
||||
case EntityMetaDataType.FrogVariant: // Frog Variant
|
||||
case EntityMetaDataType.PigVariant: // Pig Variant (1.21.5+)
|
||||
case EntityMetaDataType.PigSoundVariant: // Pig Sound Variant (26.1+)
|
||||
case EntityMetaDataType.ChickenVariant: // Chicken Variant (1.21.5+)
|
||||
case EntityMetaDataType.ChickenSoundVariant: // Chicken Sound Variant (26.1+)
|
||||
value = ReadNextVarInt(cache);
|
||||
break;
|
||||
case EntityMetaDataType.GlobalPosition: // GlobalPos
|
||||
|
|
|
|||
|
|
@ -0,0 +1,266 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Protocol.Handlers.PacketPalettes;
|
||||
|
||||
public class PacketPalette261 : 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.DebugBlockValue }, // Debug Block Value
|
||||
{ 0x1B, PacketTypesIn.DebugChunkValue }, // Debug Chunk Value
|
||||
{ 0x1C, PacketTypesIn.DebugEntityValue }, // Debug Entity Value
|
||||
{ 0x1D, PacketTypesIn.DebugEvent }, // Debug Event
|
||||
{ 0x1E, PacketTypesIn.DebugSample }, // Debug Sample
|
||||
{ 0x1F, PacketTypesIn.HideMessage }, // Delete Chat
|
||||
{ 0x20, PacketTypesIn.Disconnect }, // Disconnect
|
||||
{ 0x21, PacketTypesIn.ProfilelessChatMessage }, // Disguised Chat
|
||||
{ 0x22, PacketTypesIn.EntityStatus }, // Entity Event
|
||||
{ 0x23, PacketTypesIn.EntityPositionSync }, // Entity Position Sync
|
||||
{ 0x24, PacketTypesIn.Explosion }, // Explode
|
||||
{ 0x25, PacketTypesIn.UnloadChunk }, // Forget Level Chunk
|
||||
{ 0x26, PacketTypesIn.ChangeGameState }, // Game Event
|
||||
{ 0x27, PacketTypesIn.GameRuleValues }, // Game Rule Values (new in 26.1)
|
||||
{ 0x28, PacketTypesIn.GameTestHighlightPos }, // Game Test Highlight Pos
|
||||
{ 0x29, PacketTypesIn.OpenHorseWindow }, // Mount Screen Open (renamed from Horse Screen Open)
|
||||
{ 0x2A, PacketTypesIn.HurtAnimation }, // Hurt Animation
|
||||
{ 0x2B, PacketTypesIn.InitializeWorldBorder }, // Initialize Border
|
||||
{ 0x2C, PacketTypesIn.KeepAlive }, // Keep Alive
|
||||
{ 0x2D, PacketTypesIn.ChunkData }, // Level Chunk With Light
|
||||
{ 0x2E, PacketTypesIn.Effect }, // Level Event
|
||||
{ 0x2F, PacketTypesIn.Particle }, // Level Particles
|
||||
{ 0x30, PacketTypesIn.UpdateLight }, // Light Update
|
||||
{ 0x31, PacketTypesIn.JoinGame }, // Login
|
||||
{ 0x32, PacketTypesIn.LowDiskSpaceWarning }, // Low Disk Space Warning (new in 26.1)
|
||||
{ 0x33, PacketTypesIn.MapData }, // Map Item Data
|
||||
{ 0x34, PacketTypesIn.TradeList }, // Merchant Offers
|
||||
{ 0x35, PacketTypesIn.EntityPosition }, // Move Entity Pos
|
||||
{ 0x36, PacketTypesIn.EntityPositionAndRotation }, // Move Entity Pos Rot
|
||||
{ 0x37, PacketTypesIn.MoveMinecartAlongTrack }, // Move Minecart Along Track
|
||||
{ 0x38, PacketTypesIn.EntityRotation }, // Move Entity Rot
|
||||
{ 0x39, PacketTypesIn.VehicleMove }, // Move Vehicle
|
||||
{ 0x3A, PacketTypesIn.OpenBook }, // Open Book
|
||||
{ 0x3B, PacketTypesIn.OpenWindow }, // Open Screen
|
||||
{ 0x3C, PacketTypesIn.OpenSignEditor }, // Open Sign Editor
|
||||
{ 0x3D, PacketTypesIn.Ping }, // Ping
|
||||
{ 0x3E, PacketTypesIn.PingResponse }, // Pong Response
|
||||
{ 0x3F, PacketTypesIn.CraftRecipeResponse }, // Place Ghost Recipe
|
||||
{ 0x40, PacketTypesIn.PlayerAbilities }, // Player Abilities
|
||||
{ 0x41, PacketTypesIn.ChatMessage }, // Player Chat
|
||||
{ 0x42, PacketTypesIn.EndCombatEvent }, // Player Combat End
|
||||
{ 0x43, PacketTypesIn.EnterCombatEvent }, // Player Combat Enter
|
||||
{ 0x44, PacketTypesIn.DeathCombatEvent }, // Player Combat Kill
|
||||
{ 0x45, PacketTypesIn.PlayerRemove }, // Player Info Remove
|
||||
{ 0x46, PacketTypesIn.PlayerInfo }, // Player Info Update
|
||||
{ 0x47, PacketTypesIn.FacePlayer }, // Player Look At
|
||||
{ 0x48, PacketTypesIn.PlayerPositionAndLook }, // Player Position
|
||||
{ 0x49, PacketTypesIn.PlayerRotation }, // Player Rotation
|
||||
{ 0x4A, PacketTypesIn.RecipeBookAdd }, // Recipe Book Add
|
||||
{ 0x4B, PacketTypesIn.RecipeBookRemove }, // Recipe Book Remove
|
||||
{ 0x4C, PacketTypesIn.RecipeBookSettings }, // Recipe Book Settings
|
||||
{ 0x4D, PacketTypesIn.DestroyEntities }, // Remove Entities
|
||||
{ 0x4E, PacketTypesIn.RemoveEntityEffect }, // Remove Mob Effect
|
||||
{ 0x4F, PacketTypesIn.ResetScore }, // Reset Score
|
||||
{ 0x50, PacketTypesIn.RemoveResourcePack }, // Resource Pack Pop
|
||||
{ 0x51, PacketTypesIn.ResourcePackSend }, // Resource Pack Push
|
||||
{ 0x52, PacketTypesIn.Respawn }, // Respawn
|
||||
{ 0x53, PacketTypesIn.EntityHeadLook }, // Rotate Head
|
||||
{ 0x54, PacketTypesIn.MultiBlockChange }, // Section Blocks Update
|
||||
{ 0x55, PacketTypesIn.SelectAdvancementTab }, // Select Advancements Tab
|
||||
{ 0x56, PacketTypesIn.ServerData }, // Server Data
|
||||
{ 0x57, PacketTypesIn.ActionBar }, // Set Action Bar Text
|
||||
{ 0x58, PacketTypesIn.WorldBorderCenter }, // Set Border Center
|
||||
{ 0x59, PacketTypesIn.WorldBorderLerpSize }, // Set Border Lerp Size
|
||||
{ 0x5A, PacketTypesIn.WorldBorderSize }, // Set Border Size
|
||||
{ 0x5B, PacketTypesIn.WorldBorderWarningDelay }, // Set Border Warning Delay
|
||||
{ 0x5C, PacketTypesIn.WorldBorderWarningReach }, // Set Border Warning Distance
|
||||
{ 0x5D, PacketTypesIn.Camera }, // Set Camera
|
||||
{ 0x5E, PacketTypesIn.UpdateViewPosition }, // Set Chunk Cache Center
|
||||
{ 0x5F, PacketTypesIn.UpdateViewDistance }, // Set Chunk Cache Radius
|
||||
{ 0x60, PacketTypesIn.SetCursorItem }, // Set Cursor Item
|
||||
{ 0x61, PacketTypesIn.SpawnPosition }, // Set Default Spawn Position
|
||||
{ 0x62, PacketTypesIn.DisplayScoreboard }, // Set Display Objective
|
||||
{ 0x63, PacketTypesIn.EntityMetadata }, // Set Entity Data
|
||||
{ 0x64, PacketTypesIn.AttachEntity }, // Set Entity Link
|
||||
{ 0x65, PacketTypesIn.EntityVelocity }, // Set Entity Motion
|
||||
{ 0x66, PacketTypesIn.EntityEquipment }, // Set Equipment
|
||||
{ 0x67, PacketTypesIn.SetExperience }, // Set Experience
|
||||
{ 0x68, PacketTypesIn.UpdateHealth }, // Set Health
|
||||
{ 0x69, PacketTypesIn.SetHeldSlot }, // Set Held Slot
|
||||
{ 0x6A, PacketTypesIn.ScoreboardObjective }, // Set Objective
|
||||
{ 0x6B, PacketTypesIn.SetPassengers }, // Set Passengers
|
||||
{ 0x6C, PacketTypesIn.SetPlayerInventory }, // Set Player Inventory
|
||||
{ 0x6D, PacketTypesIn.Teams }, // Set Player Team
|
||||
{ 0x6E, PacketTypesIn.UpdateScore }, // Set Score
|
||||
{ 0x6F, PacketTypesIn.UpdateSimulationDistance }, // Set Simulation Distance
|
||||
{ 0x70, PacketTypesIn.SetTitleSubTitle }, // Set Subtitle Text
|
||||
{ 0x71, PacketTypesIn.TimeUpdate }, // Set Time
|
||||
{ 0x72, PacketTypesIn.SetTitleText }, // Set Title Text
|
||||
{ 0x73, PacketTypesIn.SetTitleTime }, // Set Titles Animation
|
||||
{ 0x74, PacketTypesIn.EntitySoundEffect }, // Sound Entity
|
||||
{ 0x75, PacketTypesIn.SoundEffect }, // Sound
|
||||
{ 0x76, PacketTypesIn.StartConfiguration }, // Start Configuration
|
||||
{ 0x77, PacketTypesIn.StopSound }, // Stop Sound
|
||||
{ 0x78, PacketTypesIn.StoreCookie }, // Store Cookie
|
||||
{ 0x79, PacketTypesIn.SystemChat }, // System Chat
|
||||
{ 0x7A, PacketTypesIn.PlayerListHeaderAndFooter }, // Tab List
|
||||
{ 0x7B, PacketTypesIn.NBTQueryResponse }, // Tag Query
|
||||
{ 0x7C, PacketTypesIn.CollectItem }, // Take Item Entity
|
||||
{ 0x7D, PacketTypesIn.EntityTeleport }, // Teleport Entity
|
||||
{ 0x7E, PacketTypesIn.TestInstanceBlockStatus }, // Test Instance Block Status
|
||||
{ 0x7F, PacketTypesIn.SetTickingState }, // Ticking State
|
||||
{ 0x80, PacketTypesIn.StepTick }, // Ticking Step
|
||||
{ 0x81, PacketTypesIn.Transfer }, // Transfer
|
||||
{ 0x82, PacketTypesIn.Advancements }, // Update Advancements
|
||||
{ 0x83, PacketTypesIn.EntityProperties }, // Update Attributes
|
||||
{ 0x84, PacketTypesIn.EntityEffect }, // Update Mob Effect
|
||||
{ 0x85, PacketTypesIn.DeclareRecipes }, // Update Recipes
|
||||
{ 0x86, PacketTypesIn.Tags }, // Update Tags
|
||||
{ 0x87, PacketTypesIn.ProjectilePower }, // Projectile Power
|
||||
{ 0x88, PacketTypesIn.CustomReportDetails }, // Custom Report Details
|
||||
{ 0x89, PacketTypesIn.ServerLinks }, // Server Links
|
||||
{ 0x8A, PacketTypesIn.Waypoint }, // Waypoint
|
||||
{ 0x8B, PacketTypesIn.ClearDialog }, // Clear Dialog
|
||||
{ 0x8C, PacketTypesIn.ShowDialog } // Show Dialog
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, PacketTypesOut> typeOut = new()
|
||||
{
|
||||
{ 0x00, PacketTypesOut.TeleportConfirm }, // Accept Teleportation
|
||||
{ 0x01, PacketTypesOut.Attack }, // Attack (new in 26.1)
|
||||
{ 0x02, PacketTypesOut.QueryBlockNBT }, // Block Entity Tag Query
|
||||
{ 0x03, PacketTypesOut.BundleItemSelected }, // Bundle Item Selected
|
||||
{ 0x04, PacketTypesOut.SetDifficulty }, // Change Difficulty
|
||||
{ 0x05, PacketTypesOut.ChangeGameMode }, // Change Game Mode
|
||||
{ 0x06, PacketTypesOut.MessageAcknowledgment }, // Chat Ack
|
||||
{ 0x07, PacketTypesOut.ChatCommand }, // Chat Command
|
||||
{ 0x08, PacketTypesOut.SignedChatCommand }, // Chat Command Signed
|
||||
{ 0x09, PacketTypesOut.ChatMessage }, // Chat
|
||||
{ 0x0A, PacketTypesOut.PlayerSession }, // Chat Session Update
|
||||
{ 0x0B, PacketTypesOut.ChunkBatchReceived }, // Chunk Batch Received
|
||||
{ 0x0C, PacketTypesOut.ClientStatus }, // Client Command
|
||||
{ 0x0D, PacketTypesOut.ClientTickEnd }, // Client Tick End
|
||||
{ 0x0E, PacketTypesOut.ClientSettings }, // Client Information
|
||||
{ 0x0F, PacketTypesOut.TabComplete }, // Command Suggestion
|
||||
{ 0x10, PacketTypesOut.AcknowledgeConfiguration }, // Configuration Acknowledged
|
||||
{ 0x11, PacketTypesOut.ClickWindowButton }, // Container Button Click
|
||||
{ 0x12, PacketTypesOut.ClickWindow }, // Container Click
|
||||
{ 0x13, PacketTypesOut.CloseWindow }, // Container Close
|
||||
{ 0x14, PacketTypesOut.ChangeContainerSlotState }, // Container Slot State Changed
|
||||
{ 0x15, PacketTypesOut.CookieResponse }, // Cookie Response
|
||||
{ 0x16, PacketTypesOut.PluginMessage }, // Custom Payload
|
||||
{ 0x17, PacketTypesOut.DebugSampleSubscription }, // Debug Subscription Request (renamed)
|
||||
{ 0x18, PacketTypesOut.EditBook }, // Edit Book
|
||||
{ 0x19, PacketTypesOut.EntityNBTRequest }, // Entity Tag Query
|
||||
{ 0x1A, PacketTypesOut.InteractEntity }, // Interact
|
||||
{ 0x1B, PacketTypesOut.GenerateStructure }, // Jigsaw Generate
|
||||
{ 0x1C, PacketTypesOut.KeepAlive }, // Keep Alive
|
||||
{ 0x1D, PacketTypesOut.LockDifficulty }, // Lock Difficulty
|
||||
{ 0x1E, PacketTypesOut.PlayerPosition }, // Move Player Pos
|
||||
{ 0x1F, PacketTypesOut.PlayerPositionAndRotation }, // Move Player Pos Rot
|
||||
{ 0x20, PacketTypesOut.PlayerRotation }, // Move Player Rot
|
||||
{ 0x21, PacketTypesOut.PlayerMovement }, // Move Player Status Only
|
||||
{ 0x22, PacketTypesOut.VehicleMove }, // Move Vehicle
|
||||
{ 0x23, PacketTypesOut.SteerBoat }, // Paddle Boat
|
||||
{ 0x24, PacketTypesOut.PickItem }, // Pick Item From Block
|
||||
{ 0x25, PacketTypesOut.PickItemFromEntity }, // Pick Item From Entity
|
||||
{ 0x26, PacketTypesOut.PingRequest }, // Ping Request
|
||||
{ 0x27, PacketTypesOut.CraftRecipeRequest }, // Place Recipe
|
||||
{ 0x28, PacketTypesOut.PlayerAbilities }, // Player Abilities
|
||||
{ 0x29, PacketTypesOut.PlayerDigging }, // Player Action
|
||||
{ 0x2A, PacketTypesOut.EntityAction }, // Player Command
|
||||
{ 0x2B, PacketTypesOut.SteerVehicle }, // Player Input
|
||||
{ 0x2C, PacketTypesOut.PlayerLoaded }, // Player Loaded
|
||||
{ 0x2D, PacketTypesOut.Pong }, // Pong
|
||||
{ 0x2E, PacketTypesOut.SetDisplayedRecipe }, // Recipe Book Change Settings
|
||||
{ 0x2F, PacketTypesOut.SetRecipeBookState }, // Recipe Book Seen Recipe
|
||||
{ 0x30, PacketTypesOut.NameItem }, // Rename Item
|
||||
{ 0x31, PacketTypesOut.ResourcePackStatus }, // Resource Pack
|
||||
{ 0x32, PacketTypesOut.AdvancementTab }, // Seen Advancements
|
||||
{ 0x33, PacketTypesOut.SelectTrade }, // Select Trade
|
||||
{ 0x34, PacketTypesOut.SetBeaconEffect }, // Set Beacon
|
||||
{ 0x35, PacketTypesOut.HeldItemChange }, // Set Carried Item
|
||||
{ 0x36, PacketTypesOut.UpdateCommandBlock }, // Set Command Block
|
||||
{ 0x37, PacketTypesOut.UpdateCommandBlockMinecart }, // Set Command Minecart
|
||||
{ 0x38, PacketTypesOut.CreativeInventoryAction }, // Set Creative Mode Slot
|
||||
{ 0x39, PacketTypesOut.SetGameRule }, // Set Game Rule (new in 26.1)
|
||||
{ 0x3A, PacketTypesOut.UpdateJigsawBlock }, // Set Jigsaw Block
|
||||
{ 0x3B, PacketTypesOut.UpdateStructureBlock }, // Set Structure Block
|
||||
{ 0x3C, PacketTypesOut.SetTestBlock }, // Set Test Block
|
||||
{ 0x3D, PacketTypesOut.UpdateSign }, // Sign Update
|
||||
{ 0x3F, PacketTypesOut.Animation }, // Swing
|
||||
{ 0x40, PacketTypesOut.Spectate }, // Teleport To Entity
|
||||
{ 0x41, PacketTypesOut.TestInstanceBlockAction }, // Test Instance Block Action
|
||||
{ 0x42, PacketTypesOut.PlayerBlockPlacement }, // Use Item On
|
||||
{ 0x43, PacketTypesOut.UseItem }, // Use Item
|
||||
{ 0x44, PacketTypesOut.CustomClickAction } // Custom Click Action
|
||||
};
|
||||
|
||||
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 },
|
||||
{ 0x12, ConfigurationPacketTypesIn.ShowDialog },
|
||||
{ 0x13, ConfigurationPacketTypesIn.CodeOfConduct }
|
||||
};
|
||||
|
||||
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 },
|
||||
{ 0x09, ConfigurationPacketTypesOut.AcceptCodeOfConduct }
|
||||
};
|
||||
|
||||
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!;
|
||||
}
|
||||
|
|
@ -48,8 +48,9 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
{
|
||||
PacketTypePalette p = protocol switch
|
||||
{
|
||||
> Protocol18Handler.MC_1_21_11_Version => throw new NotImplementedException(Translations
|
||||
> Protocol18Handler.MC_26_1_Version => throw new NotImplementedException(Translations
|
||||
.exception_palette_packet),
|
||||
>= Protocol18Handler.MC_26_1_Version => new PacketPalette261(),
|
||||
<= Protocol18Handler.MC_1_21_11_Version and > Protocol18Handler.MC_1_21_7_Version => new PacketPalette1219(),
|
||||
<= Protocol18Handler.MC_1_21_7_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(),
|
||||
|
|
|
|||
|
|
@ -169,5 +169,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
DebugEntityValue, // Added in 1.21.9
|
||||
DebugEvent, // Added in 1.21.9
|
||||
GameTestHighlightPos, // Added in 1.21.9
|
||||
GameRuleValues, // Added in 26.1
|
||||
LowDiskSpaceWarning, // Added in 26.1
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,5 +78,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
WindowConfirmation, //
|
||||
ChangeGameMode, // Added in 1.21.6
|
||||
CustomClickAction, // Added in 1.21.6
|
||||
Attack, // Added in 26.1
|
||||
SetGameRule, // Added in 26.1
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,12 +80,14 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
internal const int MC_1_21_7_Version = 772;
|
||||
internal const int MC_1_21_9_Version = 773;
|
||||
internal const int MC_1_21_11_Version = 774;
|
||||
internal const int MC_26_1_Version = 775;
|
||||
|
||||
private int compression_treshold = -1;
|
||||
private int autocomplete_transaction_id = 0;
|
||||
private readonly Dictionary<int, short> window_actions = new();
|
||||
private CurrentState currentState = CurrentState.Login;
|
||||
private readonly int protocolVersion;
|
||||
private readonly int rawProtocolVersion;
|
||||
private int currentDimension;
|
||||
private bool isOnlineMode = false;
|
||||
private readonly BlockingCollection<Tuple<int, Queue<byte>>> packetQueue = new();
|
||||
|
|
@ -119,13 +121,14 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
readonly RandomNumberGenerator randomGen;
|
||||
|
||||
public Protocol18Handler(TcpClient Client, int protocolVersion, IMinecraftComHandler handler,
|
||||
ForgeInfo? forgeInfo)
|
||||
ForgeInfo? forgeInfo, int rawProtocolVersion = 0)
|
||||
{
|
||||
ConsoleIO.SetAutoCompleteEngine(this);
|
||||
ChatParser.InitTranslations();
|
||||
socketWrapper = new SocketWrapper(Client);
|
||||
dataTypes = new DataTypes(protocolVersion);
|
||||
this.protocolVersion = protocolVersion;
|
||||
this.rawProtocolVersion = rawProtocolVersion != 0 ? rawProtocolVersion : protocolVersion;
|
||||
this.handler = handler;
|
||||
pForge = new Protocol18Forge(forgeInfo, protocolVersion, dataTypes, this, handler);
|
||||
pTerrain = new Protocol18Terrain(protocolVersion, dataTypes, handler);
|
||||
|
|
@ -135,21 +138,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_11_Version)
|
||||
if (handler.GetTerrainEnabled() && protocolVersion > MC_26_1_Version)
|
||||
{
|
||||
log.Error($"§c{Translations.extra_terrainandmovement_disabled}");
|
||||
handler.SetTerrainEnabled(false);
|
||||
}
|
||||
|
||||
if (handler.GetInventoryEnabled() &&
|
||||
protocolVersion is < MC_1_8_Version or > MC_1_21_11_Version)
|
||||
protocolVersion is < MC_1_8_Version or > MC_26_1_Version)
|
||||
{
|
||||
log.Error($"§c{Translations.extra_inventory_disabled}");
|
||||
handler.SetInventoryEnabled(false);
|
||||
}
|
||||
|
||||
if (handler.GetEntityHandlingEnabled() &&
|
||||
protocolVersion is < MC_1_8_Version or > MC_1_21_11_Version)
|
||||
protocolVersion is < MC_1_8_Version or > MC_26_1_Version)
|
||||
{
|
||||
log.Error($"§c{Translations.extra_entity_disabled}");
|
||||
handler.SetEntityHandlingEnabled(false);
|
||||
|
|
@ -158,8 +161,9 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
Block.Palette = protocolVersion switch
|
||||
{
|
||||
// Block palette
|
||||
> MC_1_21_11_Version when handler.GetTerrainEnabled() =>
|
||||
> MC_26_1_Version when handler.GetTerrainEnabled() =>
|
||||
throw new NotImplementedException(Translations.exception_palette_block),
|
||||
>= MC_26_1_Version => new Palette261(),
|
||||
>= MC_1_21_9_Version => new Palette1219(),
|
||||
>= MC_1_21_6_Version => new Palette1216(), // 1.21.7/1.21.8 blocks unchanged, reuse 1216
|
||||
>= MC_1_21_5_Version => new Palette1215(),
|
||||
|
|
@ -182,8 +186,9 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
entityPalette = protocolVersion switch
|
||||
{
|
||||
// Entity palette
|
||||
> MC_1_21_11_Version when handler.GetEntityHandlingEnabled() =>
|
||||
> MC_26_1_Version when handler.GetEntityHandlingEnabled() =>
|
||||
throw new NotImplementedException(Translations.exception_palette_entity),
|
||||
>= MC_26_1_Version => new EntityPalette261(),
|
||||
>= MC_1_21_11_Version => new EntityPalette12111(),
|
||||
>= MC_1_21_9_Version => new EntityPalette1219(),
|
||||
>= MC_1_21_6_Version => new EntityPalette1216(), // 1.21.7/1.21.8 entities unchanged, reuse 1216
|
||||
|
|
@ -211,8 +216,9 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
itemPalette = protocolVersion switch
|
||||
{
|
||||
// Item palette
|
||||
> MC_1_21_11_Version when handler.GetInventoryEnabled() =>
|
||||
> MC_26_1_Version when handler.GetInventoryEnabled() =>
|
||||
throw new NotImplementedException(Translations.exception_palette_item),
|
||||
>= MC_26_1_Version => new ItemPalette261(),
|
||||
>= MC_1_21_11_Version => new ItemPalette12111(),
|
||||
>= MC_1_21_9_Version => new ItemPalette1219(),
|
||||
>= MC_1_21_7_Version => new ItemPalette1217(),
|
||||
|
|
@ -2681,7 +2687,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
// Also make a palette for field? Will be a lot of work
|
||||
var healthField = protocolVersion switch
|
||||
{
|
||||
> MC_1_21_11_Version => throw new NotImplementedException(Translations
|
||||
> MC_26_1_Version => throw new NotImplementedException(Translations
|
||||
.exception_palette_healthfield),
|
||||
// 1.17 and above
|
||||
>= MC_1_17_Version => 9,
|
||||
|
|
@ -2711,11 +2717,30 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
|
||||
break;
|
||||
case PacketTypesIn.TimeUpdate:
|
||||
var worldAge = dataTypes.ReadNextLong(packetData);
|
||||
var timeOfDay = dataTypes.ReadNextLong(packetData);
|
||||
if (protocolVersion >= MC_1_21_2_Version)
|
||||
dataTypes.ReadNextBool(packetData); // Tick day time
|
||||
handler.OnTimeUpdate(worldAge, timeOfDay);
|
||||
if (protocolVersion >= MC_26_1_Version)
|
||||
{
|
||||
var worldAge = dataTypes.ReadNextLong(packetData);
|
||||
long timeOfDay = 0;
|
||||
var clockCount = dataTypes.ReadNextVarInt(packetData);
|
||||
for (int i = 0; i < clockCount; i++)
|
||||
{
|
||||
dataTypes.ReadNextVarInt(packetData); // clock holder id
|
||||
var totalTicks = dataTypes.ReadNextVarLong(packetData);
|
||||
dataTypes.ReadNextFloat(packetData); // partialTick
|
||||
dataTypes.ReadNextFloat(packetData); // rate
|
||||
if (i == 0)
|
||||
timeOfDay = totalTicks;
|
||||
}
|
||||
handler.OnTimeUpdate(worldAge, timeOfDay);
|
||||
}
|
||||
else
|
||||
{
|
||||
var worldAge = dataTypes.ReadNextLong(packetData);
|
||||
var timeOfDay = dataTypes.ReadNextLong(packetData);
|
||||
if (protocolVersion >= MC_1_21_2_Version)
|
||||
dataTypes.ReadNextBool(packetData); // Tick day time
|
||||
handler.OnTimeUpdate(worldAge, timeOfDay);
|
||||
}
|
||||
break;
|
||||
case PacketTypesIn.EntityTeleport:
|
||||
if (handler.GetEntityHandlingEnabled())
|
||||
|
|
@ -3164,8 +3189,8 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
{
|
||||
// 1. Send the handshake packet
|
||||
SendPacket(0x00, dataTypes.ConcatBytes(
|
||||
// Protocol Version
|
||||
DataTypes.GetVarInt(protocolVersion),
|
||||
// Protocol Version (use raw version for snapshot/RC servers)
|
||||
DataTypes.GetVarInt(rawProtocolVersion),
|
||||
|
||||
// Server Address
|
||||
dataTypes.GetString(pForge.GetServerAddress(handler.GetServerHost())),
|
||||
|
|
|
|||
|
|
@ -185,6 +185,9 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
// Non-air block count inside chunk section, for lighting purposes
|
||||
int blockCnt = dataTypes.ReadNextShort(cache);
|
||||
|
||||
if (protocolversion >= Protocol18Handler.MC_26_1_Version)
|
||||
dataTypes.ReadNextShort(cache); // Fluid count (26.1+)
|
||||
|
||||
// Read Block states (Type: Paletted Container)
|
||||
Chunk? chunk = ReadBlockStatesField(cache);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,129 @@
|
|||
using MinecraftClient.Inventory.ItemPalettes;
|
||||
using MinecraftClient.Protocol.Handlers.StructuredComponents.Components;
|
||||
using MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_20_6;
|
||||
using MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_21;
|
||||
using MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_21_2;
|
||||
using MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_21_5;
|
||||
using MinecraftClient.Protocol.Handlers.StructuredComponents.Components._1_21_11;
|
||||
using MinecraftClient.Protocol.Handlers.StructuredComponents.Core;
|
||||
|
||||
namespace MinecraftClient.Protocol.Handlers.StructuredComponents.Registries;
|
||||
|
||||
public class StructuredComponentsRegistry261 : StructuredComponentRegistry
|
||||
{
|
||||
public StructuredComponentsRegistry261(DataTypes dataTypes, ItemPalette itemPalette, SubComponentRegistry subComponentRegistry)
|
||||
: base(dataTypes, itemPalette, subComponentRegistry)
|
||||
{
|
||||
RegisterComponent<CustomDataComponent>(0, "minecraft:custom_data");
|
||||
RegisterComponent<MaxStackSizeComponent>(1, "minecraft:max_stack_size");
|
||||
RegisterComponent<MaxDamageComponent>(2, "minecraft:max_damage");
|
||||
RegisterComponent<DamageComponent>(3, "minecraft:damage");
|
||||
RegisterComponent<EmptyComponent>(4, "minecraft:unbreakable");
|
||||
RegisterComponent<UseEffectsComponent>(5, "minecraft:use_effects");
|
||||
RegisterComponent<CustomNameComponent>(6, "minecraft:custom_name");
|
||||
RegisterComponent<PotionDurationScaleComponent>(7, "minecraft:minimum_attack_charge");
|
||||
RegisterComponent<RegistryEitherHolderComponent>(8, "minecraft:damage_type");
|
||||
RegisterComponent<ItemNameComponent>(9, "minecraft:item_name");
|
||||
RegisterComponent<ItemModelComponent>(10, "minecraft:item_model");
|
||||
RegisterComponent<LoreNameComponent1206>(11, "minecraft:lore");
|
||||
RegisterComponent<RarityComponent>(12, "minecraft:rarity");
|
||||
RegisterComponent<EnchantmentsComponent1215>(13, "minecraft:enchantments");
|
||||
RegisterComponent<CanPlaceOnComponent>(14, "minecraft:can_place_on");
|
||||
RegisterComponent<CanBreakComponent>(15, "minecraft:can_break");
|
||||
RegisterComponent<AttributeModifiersComponent>(16, "minecraft:attribute_modifiers");
|
||||
RegisterComponent<CustomModelDataComponent>(17, "minecraft:custom_model_data");
|
||||
RegisterComponent<TooltipDisplayComponent>(18, "minecraft:tooltip_display");
|
||||
RegisterComponent<RepairCostComponent>(19, "minecraft:repair_cost");
|
||||
RegisterComponent<CreativeSlotLockComponent>(20, "minecraft:creative_slot_lock");
|
||||
RegisterComponent<EnchantmentGlintOverrideComponent>(21, "minecraft:enchantment_glint_override");
|
||||
RegisterComponent<IntangibleProjectileComponent>(22, "minecraft:intangible_projectile");
|
||||
RegisterComponent<FoodComponent1212>(23, "minecraft:food");
|
||||
RegisterComponent<ConsumableComponent>(24, "minecraft:consumable");
|
||||
RegisterComponent<UseRemainderComponent>(25, "minecraft:use_remainder");
|
||||
RegisterComponent<UseCooldownComponent>(26, "minecraft:use_cooldown");
|
||||
RegisterComponent<DamageResistantComponent>(27, "minecraft:damage_resistant");
|
||||
RegisterComponent<ToolComponent>(28, "minecraft:tool");
|
||||
RegisterComponent<WeaponComponent>(29, "minecraft:weapon");
|
||||
RegisterComponent<AttackRangeComponent>(30, "minecraft:attack_range");
|
||||
RegisterComponent<EnchantableComponent>(31, "minecraft:enchantable");
|
||||
RegisterComponent<EquippableComponent>(32, "minecraft:equippable");
|
||||
RegisterComponent<RepairableComponent>(33, "minecraft:repairable");
|
||||
RegisterComponent<GliderComponent>(34, "minecraft:glider");
|
||||
RegisterComponent<TooltipStyleComponent>(35, "minecraft:tooltip_style");
|
||||
RegisterComponent<DeathProtectionComponent>(36, "minecraft:death_protection");
|
||||
RegisterComponent<BlocksAttacksComponent>(37, "minecraft:blocks_attacks");
|
||||
RegisterComponent<PiercingWeaponComponent>(38, "minecraft:piercing_weapon");
|
||||
RegisterComponent<KineticWeaponComponent>(39, "minecraft:kinetic_weapon");
|
||||
RegisterComponent<SwingAnimationComponent>(40, "minecraft:swing_animation");
|
||||
RegisterComponent<VarIntComponent>(41, "minecraft:additional_trade_cost"); // New in 26.1
|
||||
RegisterComponent<StoredEnchantmentsComponent1215>(42, "minecraft:stored_enchantments");
|
||||
RegisterComponent<VarIntComponent>(43, "minecraft:dye"); // New in 26.1
|
||||
RegisterComponent<DyeColorComponent>(44, "minecraft:dyed_color");
|
||||
RegisterComponent<MapColorComponent>(45, "minecraft:map_color");
|
||||
RegisterComponent<MapIdComponent>(46, "minecraft:map_id");
|
||||
RegisterComponent<MapDecorationsComponent>(47, "minecraft:map_decorations");
|
||||
RegisterComponent<MapPostProcessingComponent>(48, "minecraft:map_post_processing");
|
||||
RegisterComponent<ChargedProjectilesComponent>(49, "minecraft:charged_projectiles");
|
||||
RegisterComponent<BundleContentsComponent>(50, "minecraft:bundle_contents");
|
||||
RegisterComponent<PotionContentsComponent>(51, "minecraft:potion_contents");
|
||||
RegisterComponent<PotionDurationScaleComponent>(52, "minecraft:potion_duration_scale");
|
||||
RegisterComponent<SuspiciousStewEffectsComponent>(53, "minecraft:suspicious_stew_effects");
|
||||
RegisterComponent<WritableBlookContentComponent>(54, "minecraft:writable_book_content");
|
||||
RegisterComponent<WrittenBlookContentComponent>(55, "minecraft:written_book_content");
|
||||
RegisterComponent<TrimComponent>(56, "minecraft:trim");
|
||||
RegisterComponent<DebugStickStateComponent>(57, "minecraft:debug_stick_state");
|
||||
RegisterComponent<EntityDataComponent>(58, "minecraft:entity_data");
|
||||
RegisterComponent<BucketEntityDataComponent>(59, "minecraft:bucket_entity_data");
|
||||
RegisterComponent<BlockEntityDataComponent>(60, "minecraft:block_entity_data");
|
||||
RegisterComponent<InstrumentComponent1215>(61, "minecraft:instrument");
|
||||
RegisterComponent<ProvidesTrimMaterialComponent>(62, "minecraft:provides_trim_material");
|
||||
RegisterComponent<OmniousBottleAmplifierComponent>(63, "minecraft:ominous_bottle_amplifier");
|
||||
RegisterComponent<JukeBoxPlayableComponent>(64, "minecraft:jukebox_playable");
|
||||
RegisterComponent<ProvidesBannerPatternsComponent>(65, "minecraft:provides_banner_patterns");
|
||||
RegisterComponent<RecipesComponent>(66, "minecraft:recipes");
|
||||
RegisterComponent<LodestoneTrackerComponent>(67, "minecraft:lodestone_tracker");
|
||||
RegisterComponent<FireworkExplosionComponent>(68, "minecraft:firework_explosion");
|
||||
RegisterComponent<FireworksComponent>(69, "minecraft:fireworks");
|
||||
RegisterComponent<ProfileComponent>(70, "minecraft:profile");
|
||||
RegisterComponent<NoteBlockSoundComponent>(71, "minecraft:note_block_sound");
|
||||
RegisterComponent<BannerPatternsComponent>(72, "minecraft:banner_patterns");
|
||||
RegisterComponent<BaseColorComponent>(73, "minecraft:base_color");
|
||||
RegisterComponent<PotDecorationsComponent>(74, "minecraft:pot_decorations");
|
||||
RegisterComponent<ContainerComponent>(75, "minecraft:container");
|
||||
RegisterComponent<BlockStateComponent>(76, "minecraft:block_state");
|
||||
RegisterComponent<BeesComponent>(77, "minecraft:bees");
|
||||
RegisterComponent<LockComponent>(78, "minecraft:lock");
|
||||
RegisterComponent<ContainerLootComponent>(79, "minecraft:container_loot");
|
||||
|
||||
RegisterComponent<SoundEventHolderComponent>(80, "minecraft:break_sound");
|
||||
RegisterComponent<VarIntComponent>(81, "minecraft:villager/variant");
|
||||
RegisterComponent<VarIntComponent>(82, "minecraft:wolf/variant");
|
||||
RegisterComponent<VarIntComponent>(83, "minecraft:wolf/sound_variant");
|
||||
RegisterComponent<VarIntComponent>(84, "minecraft:wolf/collar");
|
||||
RegisterComponent<VarIntComponent>(85, "minecraft:fox/variant");
|
||||
RegisterComponent<VarIntComponent>(86, "minecraft:salmon/size");
|
||||
RegisterComponent<VarIntComponent>(87, "minecraft:parrot/variant");
|
||||
RegisterComponent<VarIntComponent>(88, "minecraft:tropical_fish/pattern");
|
||||
RegisterComponent<VarIntComponent>(89, "minecraft:tropical_fish/base_color");
|
||||
RegisterComponent<VarIntComponent>(90, "minecraft:tropical_fish/pattern_color");
|
||||
RegisterComponent<VarIntComponent>(91, "minecraft:mooshroom/variant");
|
||||
RegisterComponent<VarIntComponent>(92, "minecraft:rabbit/variant");
|
||||
RegisterComponent<VarIntComponent>(93, "minecraft:pig/variant");
|
||||
RegisterComponent<VarIntComponent>(94, "minecraft:pig/sound_variant"); // New in 26.1
|
||||
RegisterComponent<VarIntComponent>(95, "minecraft:cow/variant");
|
||||
RegisterComponent<VarIntComponent>(96, "minecraft:cow/sound_variant"); // New in 26.1
|
||||
RegisterComponent<EitherHolderComponent>(97, "minecraft:chicken/variant");
|
||||
RegisterComponent<VarIntComponent>(98, "minecraft:chicken/sound_variant"); // New in 26.1
|
||||
RegisterComponent<RegistryEitherHolderComponent>(99, "minecraft:zombie_nautilus/variant");
|
||||
RegisterComponent<VarIntComponent>(100, "minecraft:frog/variant");
|
||||
RegisterComponent<VarIntComponent>(101, "minecraft:horse/variant");
|
||||
RegisterComponent<PaintingVariantHolderComponent>(102, "minecraft:painting/variant");
|
||||
RegisterComponent<VarIntComponent>(103, "minecraft:llama/variant");
|
||||
RegisterComponent<VarIntComponent>(104, "minecraft:axolotl/variant");
|
||||
RegisterComponent<VarIntComponent>(105, "minecraft:cat/variant");
|
||||
RegisterComponent<VarIntComponent>(106, "minecraft:cat/sound_variant"); // New in 26.1
|
||||
RegisterComponent<VarIntComponent>(107, "minecraft:cat/collar");
|
||||
RegisterComponent<VarIntComponent>(108, "minecraft:sheep/color");
|
||||
RegisterComponent<VarIntComponent>(109, "minecraft:shulker/color");
|
||||
}
|
||||
}
|
||||
|
|
@ -33,6 +33,7 @@ public class StructuredComponentsHandler
|
|||
{
|
||||
Protocol18Handler.MC_1_20_6_Version => typeof(StructuredComponentsRegistry1206),
|
||||
Protocol18Handler.MC_1_21_Version => typeof(StructuredComponentsRegistry121),
|
||||
>= Protocol18Handler.MC_26_1_Version => typeof(StructuredComponentsRegistry261),
|
||||
>= Protocol18Handler.MC_1_21_11_Version => typeof(StructuredComponentsRegistry12111),
|
||||
>= Protocol18Handler.MC_1_21_5_Version => typeof(StructuredComponentsRegistry1215),
|
||||
>= Protocol18Handler.MC_1_21_2_Version => typeof(StructuredComponentsRegistry1212),
|
||||
|
|
|
|||
|
|
@ -145,20 +145,22 @@ namespace MinecraftClient.Protocol
|
|||
public static IMinecraftCom GetProtocolHandler(TcpClient client, int protocolVersion, ForgeInfo? forgeInfo,
|
||||
IMinecraftComHandler handler)
|
||||
{
|
||||
int normalizedVersion = NormalizeSnapshotProtocol(protocolVersion);
|
||||
|
||||
int[] suppoertedVersionsProtocol16 = { 51, 60, 61, 72, 73, 74, 78 };
|
||||
|
||||
if (Array.IndexOf(suppoertedVersionsProtocol16, protocolVersion) > -1)
|
||||
return new Protocol16Handler(client, protocolVersion, handler);
|
||||
if (Array.IndexOf(suppoertedVersionsProtocol16, normalizedVersion) > -1)
|
||||
return new Protocol16Handler(client, normalizedVersion, handler);
|
||||
|
||||
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,
|
||||
769, 770, 771, 772, 773, 774
|
||||
769, 770, 771, 772, 773, 774, 775
|
||||
};
|
||||
|
||||
if (Array.IndexOf(suppoertedVersionsProtocol18, protocolVersion) > -1)
|
||||
return new Protocol18Handler(client, protocolVersion, handler, forgeInfo);
|
||||
if (Array.IndexOf(suppoertedVersionsProtocol18, normalizedVersion) > -1)
|
||||
return new Protocol18Handler(client, normalizedVersion, handler, forgeInfo, protocolVersion);
|
||||
|
||||
throw new NotSupportedException(string.Format(Translations.exception_version_unsupport, protocolVersion));
|
||||
}
|
||||
|
|
@ -370,6 +372,8 @@ namespace MinecraftClient.Protocol
|
|||
return 773;
|
||||
case "1.21.11":
|
||||
return 774;
|
||||
case "26.1":
|
||||
return 775;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -458,10 +462,27 @@ namespace MinecraftClient.Protocol
|
|||
772 => "1.21.7",
|
||||
773 => "1.21.9",
|
||||
774 => "1.21.11",
|
||||
775 => "26.1",
|
||||
_ => "0.0"
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Normalize snapshot/pre-release protocol numbers (0x40000000 | data_version) to the
|
||||
/// corresponding release protocol number. Unknown snapshot versions pass through unchanged.
|
||||
/// </summary>
|
||||
public static int NormalizeSnapshotProtocol(int protocol)
|
||||
{
|
||||
if ((protocol & 0x40000000) == 0)
|
||||
return protocol;
|
||||
|
||||
return protocol switch
|
||||
{
|
||||
0x4000012E => 775, // 26.1-rc-2 → 26.1
|
||||
_ => protocol
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if we can force-enable Forge support for a Minecraft version without using server Ping
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -46,13 +46,17 @@ FIELD_TO_ENUM = {
|
|||
"VILLAGER_DATA": "VillagerData",
|
||||
"OPTIONAL_UNSIGNED_INT": "OptionalVarInt",
|
||||
"POSE": "Pose",
|
||||
"CAT_SOUND_VARIANT": "CatSoundVariant",
|
||||
"CAT_VARIANT": "CatVariant",
|
||||
"COW_VARIANT": "CowVariant",
|
||||
"WOLF_VARIANT": "WolfVariant",
|
||||
"WOLF_SOUND_VARIANT": "WolfSoundVariant",
|
||||
"FROG_VARIANT": "FrogVariant",
|
||||
"PIG_VARIANT": "PigVariant",
|
||||
"CHICKEN_SOUND_VARIANT": "ChickenSoundVariant",
|
||||
"CHICKEN_VARIANT": "ChickenVariant",
|
||||
"COW_SOUND_VARIANT": "CowSoundVariant",
|
||||
"COW_VARIANT": "CowVariant",
|
||||
"FROG_VARIANT": "FrogVariant",
|
||||
"PIG_SOUND_VARIANT": "PigSoundVariant",
|
||||
"PIG_VARIANT": "PigVariant",
|
||||
"WOLF_SOUND_VARIANT": "WolfSoundVariant",
|
||||
"WOLF_VARIANT": "WolfVariant",
|
||||
"OPTIONAL_GLOBAL_POS": "OptionalGlobalPosition",
|
||||
"PAINTING_VARIANT": "PaintingVariant",
|
||||
"SNIFFER_STATE": "SnifferState",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue