diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 5e74359a..3f48dbb0 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -26,7 +26,7 @@ jobs: submodules: 'true' - name: Download translations from crowdin - uses: crowdin/github-action@1.5.0 + uses: crowdin/github-action@1.6.0 with: upload_sources: true upload_translations: false diff --git a/.github/workflows/deploy-doc-only.yml b/.github/workflows/deploy-doc-only.yml index 52707f29..b794284f 100644 --- a/.github/workflows/deploy-doc-only.yml +++ b/.github/workflows/deploy-doc-only.yml @@ -17,10 +17,10 @@ jobs: fetch-depth: 0 submodules: 'true' - - name: Sync translations from crowdin - uses: crowdin/github-action@1.5.0 + - name: Download translations from crowdin + uses: crowdin/github-action@1.6.0 with: - upload_sources: true + upload_sources: false upload_translations: false download_translations: true diff --git a/.github/workflows/sync-translations-only.yml b/.github/workflows/update-translations-only.yml similarity index 79% rename from .github/workflows/sync-translations-only.yml rename to .github/workflows/update-translations-only.yml index 104876b5..c47ea685 100644 --- a/.github/workflows/sync-translations-only.yml +++ b/.github/workflows/update-translations-only.yml @@ -1,4 +1,4 @@ -name: Sync Translations +name: Upload translation sources on: workflow_dispatch: @@ -15,12 +15,12 @@ jobs: fetch-depth: 0 submodules: 'true' - - name: Sync translations from crowdin - uses: crowdin/github-action@1.5.0 + - name: Upload translation sources to crowdin + uses: crowdin/github-action@1.6.0 with: upload_sources: true upload_translations: false - download_translations: true + download_translations: false localization_branch_name: l10n_master create_pull_request: false diff --git a/MinecraftClient/ChatBots/AutoAttack.cs b/MinecraftClient/ChatBots/AutoAttack.cs index 9225e370..4b203497 100644 --- a/MinecraftClient/ChatBots/AutoAttack.cs +++ b/MinecraftClient/ChatBots/AutoAttack.cs @@ -100,7 +100,7 @@ namespace MinecraftClient.ChatBots private Double attackSpeed = 4; private Double attackCooldownSeconds; private readonly bool overrideAttackSpeed = false; - private readonly int attackRange = 4; + private readonly double attackRange = 4.0; private Double serverTPS; private float health = 100; private readonly bool attackHostile = true; diff --git a/MinecraftClient/ChatBots/Map.cs b/MinecraftClient/ChatBots/Map.cs index fef48a90..25e75a74 100644 --- a/MinecraftClient/ChatBots/Map.cs +++ b/MinecraftClient/ChatBots/Map.cs @@ -344,10 +344,8 @@ namespace MinecraftClient.ChatBots private static void RenderInConsole(McMap map) { StringBuilder sb = new(); - int consoleWidth = Math.Max(Console.BufferWidth, Settings.Config.Main.Advanced.MinTerminalWidth) / 2; int consoleHeight = Math.Max(Console.BufferHeight, Settings.Config.Main.Advanced.MinTerminalHeight) - 1; - int scaleX = (map.Width + consoleWidth - 1) / consoleWidth; int scaleY = (map.Height + consoleHeight - 1) / consoleHeight; int scale = Math.Max(scaleX, scaleY); @@ -356,11 +354,12 @@ namespace MinecraftClient.ChatBots for (int base_y = 0; base_y < map.Height; base_y += scale) { - int last_R = -1, last_G = -1, last_B = -1; + string lastFg = string.Empty, lagtBg = string.Empty; for (int base_x = 0; base_x < map.Width; base_x += scale) { - int RL = 0, GL = 0, BL = 0, RR = 0, GR = 0, BR = 0; - double mid_dx = (double)(scale - 1) / 2; + int RUL = 0, GUL = 0, BUL = 0, RUR = 0, GUR = 0, BUR = 0; + int RDL = 0, GDL = 0, BDL = 0, RDR = 0, GDR = 0, BDR = 0; + double mid = (double)(scale - 1) / 2; for (int dy = 0; dy < scale; ++dy) { for (int dx = 0; dx < scale; ++dx) @@ -368,40 +367,57 @@ namespace MinecraftClient.ChatBots int x = Math.Min(base_x + dx, map.Width - 1); int y = Math.Min(base_y + dy, map.Height - 1); ColorRGBA color = MapColors.ColorByteToRGBA(map.Colors![x + y * map.Width]); - if (dx <= mid_dx) + if (dx <= mid) { - RL += color.R; GL += color.G; BL += color.B; + if (dy <= mid) + { + RUL += color.R; GUL += color.G; BUL += color.B; + } + if (dy >= mid) + { + RDL += color.R; GDL += color.G; BDL += color.B; + } } - if (dx >= mid_dx) + if (dx >= mid) { - RR += color.R; GR += color.G; BR += color.B; + if (dy <= mid) + { + RUR += color.R; GUR += color.G; BUR += color.B; + } + if (dy >= mid) + { + RDR += color.R; GDR += color.G; BDR += color.B; + } } } } - int pixel_cnt = ((scale + 1) / 2) * scale; - RL = (int)Math.Round((double)RL / pixel_cnt); - GL = (int)Math.Round((double)GL / pixel_cnt); - BL = (int)Math.Round((double)BL / pixel_cnt); - RR = (int)Math.Round((double)RR / pixel_cnt); - GR = (int)Math.Round((double)GR / pixel_cnt); - BR = (int)Math.Round((double)BR / pixel_cnt); + int pixel_cnt = ((scale + 1) / 2) * ((scale + 1) / 2); + RDL = (int)Math.Round((double)RDL / pixel_cnt); + GDL = (int)Math.Round((double)GDL / pixel_cnt); + BDL = (int)Math.Round((double)BDL / pixel_cnt); + RDR = (int)Math.Round((double)RDR / pixel_cnt); + GDR = (int)Math.Round((double)GDR / pixel_cnt); + BDR = (int)Math.Round((double)BDR / pixel_cnt); - if (RL == last_R && GL == last_G && BL == last_B) - sb.Append(' '); - else - { - sb.Append(ColorHelper.GetColorEscapeCode((byte)RL, (byte)GL, (byte)BL, false)).Append(' '); - last_R = RL; last_G = GL; last_B = BL; - } + RUL = (int)Math.Round((double)RUL / pixel_cnt); + GUL = (int)Math.Round((double)GUL / pixel_cnt); + BUL = (int)Math.Round((double)BUL / pixel_cnt); + RUR = (int)Math.Round((double)RUR / pixel_cnt); + GUR = (int)Math.Round((double)GUR / pixel_cnt); + BUR = (int)Math.Round((double)BUR / pixel_cnt); - if (RR == last_R && GR == last_G && BR == last_B) - sb.Append(' '); - else - { - sb.Append(ColorHelper.GetColorEscapeCode((byte)RR, (byte)GR, (byte)BR, false)).Append(' '); - last_R = RR; last_G = GR; last_B = BR; - } + string colorCode = ColorHelper.GetColorEscapeCode((byte)RUL, (byte)GUL, (byte)BUL, true); + if (lastFg != colorCode) { sb.Append(colorCode); lastFg = colorCode; } + colorCode = ColorHelper.GetColorEscapeCode((byte)RDL, (byte)GDL, (byte)BDL, false); + if (lagtBg != colorCode) { sb.Append(colorCode); lagtBg = colorCode; } + sb.Append('▀'); + + colorCode = ColorHelper.GetColorEscapeCode((byte)RUR, (byte)GUR, (byte)BUR, true); + if (lastFg != colorCode) { sb.Append(colorCode); lastFg = colorCode; } + colorCode = ColorHelper.GetColorEscapeCode((byte)RDR, (byte)GDR, (byte)BDR, false); + if (lagtBg != colorCode) { sb.Append(colorCode); lagtBg = colorCode; } + sb.Append('▀'); } if (base_y >= map.Height - scale) sb.Append(ColorHelper.GetResetEscapeCode()); diff --git a/MinecraftClient/ChatBots/Script.cs b/MinecraftClient/ChatBots/Script.cs index 8ed7cb42..9e139db9 100644 --- a/MinecraftClient/ChatBots/Script.cs +++ b/MinecraftClient/ChatBots/Script.cs @@ -5,6 +5,7 @@ using System.IO; using System.Reflection; using System.Text; using System.Threading; +using MinecraftClient.CommandHandler; using MinecraftClient.Scripting; namespace MinecraftClient.ChatBots @@ -85,7 +86,7 @@ namespace MinecraftClient.ChatBots public static bool LookForScript(ref string filename) { //Automatically look in subfolders and try to add ".txt" file extension - char dir_slash = Path.DirectorySeparatorChar; + char dir_slash = Path.DirectorySeparatorChar; string[] files = new string[] { filename, @@ -210,11 +211,22 @@ namespace MinecraftClient.ChatBots sleepticks = ticks; break; default: - if (!PerformInternalCommand(instruction_line)) + CmdResult response = new(); + if (PerformInternalCommand(instruction_line, ref response)) + { + if (instruction_name.ToLower() != "log") + { + LogToConsole(instruction_line); + } + if (response.status != CmdResult.Status.Done || !string.IsNullOrWhiteSpace(response.result)) + { + LogToConsole(response); + } + } + else { Update(); //Unknown command : process next line immediately } - else if (instruction_name.ToLower() != "log") { LogToConsole(instruction_line); } break; } } diff --git a/MinecraftClient/ChatBots/ScriptScheduler.cs b/MinecraftClient/ChatBots/ScriptScheduler.cs index bf8680a4..0e15949d 100644 --- a/MinecraftClient/ChatBots/ScriptScheduler.cs +++ b/MinecraftClient/ChatBots/ScriptScheduler.cs @@ -1,4 +1,5 @@ using System; +using MinecraftClient.CommandHandler; using MinecraftClient.Scripting; using Tomlet.Attributes; using static MinecraftClient.ChatBots.ScriptScheduler.Configs; @@ -191,7 +192,10 @@ namespace MinecraftClient.ChatBots { task.Trigger_On_Time_Already_Triggered = true; LogDebugToConsole(string.Format(Translations.bot_scriptScheduler_running_time, task.Action)); - PerformInternalCommand(task.Action); + CmdResult response = new(); + PerformInternalCommand(task.Action, ref response); + if (response.status != CmdResult.Status.Done || !string.IsNullOrWhiteSpace(response.result)) + LogToConsole(response); } } } @@ -209,7 +213,10 @@ namespace MinecraftClient.ChatBots if (task.Trigger_On_Login || (firstlogin_done == false && task.Trigger_On_First_Login)) { LogDebugToConsole(string.Format(Translations.bot_scriptScheduler_running_login, task.Action)); - PerformInternalCommand(task.Action); + CmdResult response = new(); + PerformInternalCommand(task.Action, ref response); + if (response.status != CmdResult.Status.Done || !string.IsNullOrWhiteSpace(response.result)) + LogToConsole(response); } } @@ -229,7 +236,10 @@ namespace MinecraftClient.ChatBots Settings.DoubleToTick(task.Trigger_On_Interval.MinTime), Settings.DoubleToTick(task.Trigger_On_Interval.MaxTime) ); LogDebugToConsole(string.Format(Translations.bot_scriptScheduler_running_inverval, task.Action)); - PerformInternalCommand(task.Action); + CmdResult response = new(); + PerformInternalCommand(task.Action, ref response); + if (response.status != CmdResult.Status.Done || !string.IsNullOrWhiteSpace(response.result)) + LogToConsole(response); } else task.Trigger_On_Interval_Countdown--; } diff --git a/MinecraftClient/CommandHandler/ArgumentType/InventoryActionArgumentType.cs b/MinecraftClient/CommandHandler/ArgumentType/InventoryActionArgumentType.cs index 89616af6..5448218b 100644 --- a/MinecraftClient/CommandHandler/ArgumentType/InventoryActionArgumentType.cs +++ b/MinecraftClient/CommandHandler/ArgumentType/InventoryActionArgumentType.cs @@ -21,14 +21,20 @@ namespace MinecraftClient.CommandHandler.ArgumentType public override WindowActionType Parse(IStringReader reader) { reader.SkipWhitespace(); - string inputStr = reader.ReadString(); - foreach (var action in SupportActions) + string inputStr = reader.ReadString().ToLower(); + return inputStr switch { - string actionStr = action.ToString(); - if (string.Compare(inputStr, actionStr, true) == 0) - return action; - } - throw CommandSyntaxException.BuiltInExceptions.LiteralIncorrect().CreateWithContext(reader, inputStr); + "left" => WindowActionType.LeftClick, + "leftclick" => WindowActionType.LeftClick, + "right" => WindowActionType.RightClick, + "rightclick" => WindowActionType.RightClick, + "mid" => WindowActionType.MiddleClick, + "middle" => WindowActionType.MiddleClick, + "middleclick" => WindowActionType.MiddleClick, + "shift" => WindowActionType.ShiftClick, + "shiftclick" => WindowActionType.ShiftClick, + _ => throw CommandSyntaxException.BuiltInExceptions.LiteralIncorrect().CreateWithContext(reader, inputStr) + }; } public override Task ListSuggestions(CommandContext context, SuggestionsBuilder builder) diff --git a/MinecraftClient/CommandHandler/ArgumentType/ScriptNameArgumentType.cs b/MinecraftClient/CommandHandler/ArgumentType/ScriptNameArgumentType.cs new file mode 100644 index 00000000..fe77a04c --- /dev/null +++ b/MinecraftClient/CommandHandler/ArgumentType/ScriptNameArgumentType.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Brigadier.NET; +using Brigadier.NET.ArgumentTypes; +using Brigadier.NET.Context; +using Brigadier.NET.Suggestion; + +namespace MinecraftClient.CommandHandler.ArgumentType +{ + public class ScriptNameArgumentType : ArgumentType + { + public override string Parse(IStringReader reader) + { + string remaining = reader.Remaining; + reader.Cursor += reader.RemainingLength; + return remaining; + } + + public override Task ListSuggestions(CommandContext context, SuggestionsBuilder builder) + { + try + { + string? dir = Path.GetDirectoryName(builder.Remaining); + if (!string.IsNullOrEmpty(dir) && Path.Exists(dir)) + { + foreach (string fileName in Directory.GetFiles(dir, "*.cs")) + builder.Suggest(fileName); + foreach (string fileName in Directory.GetFiles(dir, "*.txt")) + builder.Suggest(fileName); + } + } + catch (IOException) { } + catch (ArgumentException) { } + catch (UnauthorizedAccessException) { } + + try + { + foreach (string fileName in Directory.GetFiles("." + Path.DirectorySeparatorChar, "*.cs")) + builder.Suggest(fileName); + foreach (string fileName in Directory.GetFiles("." + Path.DirectorySeparatorChar, "*.txt")) + builder.Suggest(fileName); + } + catch (IOException) { } + catch (ArgumentException) { } + catch (UnauthorizedAccessException) { } + + return builder.BuildFuture(); + } + } +} diff --git a/MinecraftClient/CommandHandler/MccArguments.cs b/MinecraftClient/CommandHandler/MccArguments.cs index c659ee3e..78416bc1 100644 --- a/MinecraftClient/CommandHandler/MccArguments.cs +++ b/MinecraftClient/CommandHandler/MccArguments.cs @@ -110,5 +110,10 @@ namespace MinecraftClient.CommandHandler { return new HotbarSlotArgumentType(); } + + public static ScriptNameArgumentType ScriptName() + { + return new ScriptNameArgumentType(); + } } } diff --git a/MinecraftClient/Commands/Dig.cs b/MinecraftClient/Commands/Dig.cs index 3a30619a..3a00c44b 100644 --- a/MinecraftClient/Commands/Dig.cs +++ b/MinecraftClient/Commands/Dig.cs @@ -23,8 +23,12 @@ namespace MinecraftClient.Commands dispatcher.Register(l => l.Literal(CmdName) .Executes(r => DigLookAt(r.Source)) + .Then(l => l.Argument("Duration", Arguments.Double()) + .Executes(r => DigLookAt(r.Source, Arguments.GetDouble(r, "Duration")))) .Then(l => l.Argument("Location", MccArguments.Location()) - .Executes(r => DigAt(r.Source, MccArguments.GetLocation(r, "Location")))) + .Executes(r => DigAt(r.Source, MccArguments.GetLocation(r, "Location"))) + .Then(l => l.Argument("Duration", Arguments.Double()) + .Executes(r => DigAt(r.Source, MccArguments.GetLocation(r, "Location"), Arguments.GetDouble(r, "Duration"))))) .Then(l => l.Literal("_help") .Executes(r => GetUsage(r.Source, string.Empty)) .Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName))) @@ -41,7 +45,7 @@ namespace MinecraftClient.Commands }); } - private int DigAt(CmdResult r, Location blockToBreak) + private int DigAt(CmdResult r, Location blockToBreak, double duration = 0) { McClient handler = CmdResult.currentHandler!; if (!handler.GetTerrainEnabled()) @@ -54,7 +58,7 @@ namespace MinecraftClient.Commands Block block = handler.GetWorld().GetBlock(blockToBreak); if (block.Type == Material.Air) return r.SetAndReturn(Status.Fail, Translations.cmd_dig_no_block); - else if (handler.DigBlock(blockToBreak)) + else if (handler.DigBlock(blockToBreak, duration: duration)) { blockToBreak = blockToBreak.ToCenter(); return r.SetAndReturn(Status.Done, string.Format(Translations.cmd_dig_dig, blockToBreak.X, blockToBreak.Y, blockToBreak.Z, block.GetTypeString())); @@ -63,7 +67,7 @@ namespace MinecraftClient.Commands return r.SetAndReturn(Status.Fail, Translations.cmd_dig_fail); } - private int DigLookAt(CmdResult r) + private int DigLookAt(CmdResult r, double duration = 0) { McClient handler = CmdResult.currentHandler!; if (!handler.GetTerrainEnabled()) @@ -74,7 +78,7 @@ namespace MinecraftClient.Commands return r.SetAndReturn(Status.Fail, Translations.cmd_dig_too_far); else if (block.Type == Material.Air) return r.SetAndReturn(Status.Fail, Translations.cmd_dig_no_block); - else if (handler.DigBlock(blockLoc, lookAtBlock: false)) + else if (handler.DigBlock(blockLoc, lookAtBlock: false, duration: duration)) return r.SetAndReturn(Status.Done, string.Format(Translations.cmd_dig_dig, blockLoc.X, blockLoc.Y, blockLoc.Z, block.GetTypeString())); else return r.SetAndReturn(Status.Fail, Translations.cmd_dig_fail); diff --git a/MinecraftClient/Commands/Script.cs b/MinecraftClient/Commands/Script.cs index d2f310dd..37a8da80 100644 --- a/MinecraftClient/Commands/Script.cs +++ b/MinecraftClient/Commands/Script.cs @@ -20,7 +20,7 @@ namespace MinecraftClient.Commands ); dispatcher.Register(l => l.Literal(CmdName) - .Then(l => l.Argument("Script", Arguments.GreedyString()) + .Then(l => l.Argument("Script", MccArguments.ScriptName()) .Executes(r => DoExecuteScript(r.Source, Arguments.GetString(r, "Script"), null))) .Then(l => l.Literal("_help") .Executes(r => GetUsage(r.Source, string.Empty)) diff --git a/MinecraftClient/Crypto/AesCfb8Stream.cs b/MinecraftClient/Crypto/AesCfb8Stream.cs index d50aaa54..dfa2dd78 100644 --- a/MinecraftClient/Crypto/AesCfb8Stream.cs +++ b/MinecraftClient/Crypto/AesCfb8Stream.cs @@ -1,9 +1,7 @@ using System; -using System.Collections.Concurrent; using System.IO; using System.Runtime.CompilerServices; using System.Security.Cryptography; -using System.Threading.Tasks; namespace MinecraftClient.Crypto { diff --git a/MinecraftClient/Inventory/ItemPalettes/ItemPalette1193.cs b/MinecraftClient/Inventory/ItemPalettes/ItemPalette1193.cs new file mode 100644 index 00000000..563b16a5 --- /dev/null +++ b/MinecraftClient/Inventory/ItemPalettes/ItemPalette1193.cs @@ -0,0 +1,1204 @@ +using System.Collections.Generic; + +namespace MinecraftClient.Inventory.ItemPalettes +{ + public class ItemPalette1193 : ItemPalette + { + private static readonly Dictionary mappings = new(); + + static ItemPalette1193() + { + mappings[721] = ItemType.AcaciaBoat; + mappings[648] = ItemType.AcaciaButton; + mappings[722] = ItemType.AcaciaChestBoat; + mappings[673] = ItemType.AcaciaDoor; + mappings[279] = ItemType.AcaciaFence; + mappings[694] = ItemType.AcaciaFenceGate; + mappings[835] = ItemType.AcaciaHangingSign; + mappings[150] = ItemType.AcaciaLeaves; + mappings[110] = ItemType.AcaciaLog; + mappings[27] = ItemType.AcaciaPlanks; + mappings[662] = ItemType.AcaciaPressurePlate; + mappings[38] = ItemType.AcaciaSapling; + mappings[825] = ItemType.AcaciaSign; + mappings[222] = ItemType.AcaciaSlab; + mappings[350] = ItemType.AcaciaStairs; + mappings[684] = ItemType.AcaciaTrapdoor; + mappings[141] = ItemType.AcaciaWood; + mappings[703] = ItemType.ActivatorRail; + mappings[0] = ItemType.Air; + mappings[940] = ItemType.AllaySpawnEgg; + mappings[190] = ItemType.Allium; + mappings[68] = ItemType.AmethystBlock; + mappings[1179] = ItemType.AmethystCluster; + mappings[743] = ItemType.AmethystShard; + mappings[63] = ItemType.AncientDebris; + mappings[6] = ItemType.Andesite; + mappings[609] = ItemType.AndesiteSlab; + mappings[592] = ItemType.AndesiteStairs; + mappings[369] = ItemType.AndesiteWall; + mappings[381] = ItemType.Anvil; + mappings[734] = ItemType.Apple; + mappings[1049] = ItemType.ArmorStand; + mappings[736] = ItemType.Arrow; + mappings[852] = ItemType.AxolotlBucket; + mappings[941] = ItemType.AxolotlSpawnEgg; + mappings[166] = ItemType.Azalea; + mappings[153] = ItemType.AzaleaLeaves; + mappings[191] = ItemType.AzureBluet; + mappings[1025] = ItemType.BakedPotato; + mappings[217] = ItemType.Bamboo; + mappings[117] = ItemType.BambooBlock; + mappings[651] = ItemType.BambooButton; + mappings[728] = ItemType.BambooChestRaft; + mappings[676] = ItemType.BambooDoor; + mappings[282] = ItemType.BambooFence; + mappings[697] = ItemType.BambooFenceGate; + mappings[838] = ItemType.BambooHangingSign; + mappings[33] = ItemType.BambooMosaic; + mappings[226] = ItemType.BambooMosaicSlab; + mappings[354] = ItemType.BambooMosaicStairs; + mappings[30] = ItemType.BambooPlanks; + mappings[665] = ItemType.BambooPressurePlate; + mappings[727] = ItemType.BambooRaft; + mappings[828] = ItemType.BambooSign; + mappings[225] = ItemType.BambooSlab; + mappings[353] = ItemType.BambooStairs; + mappings[687] = ItemType.BambooTrapdoor; + mappings[1123] = ItemType.Barrel; + mappings[405] = ItemType.Barrier; + mappings[291] = ItemType.Basalt; + mappings[942] = ItemType.BatSpawnEgg; + mappings[358] = ItemType.Beacon; + mappings[41] = ItemType.Bedrock; + mappings[1140] = ItemType.BeeNest; + mappings[943] = ItemType.BeeSpawnEgg; + mappings[920] = ItemType.Beef; + mappings[1141] = ItemType.Beehive; + mappings[1078] = ItemType.Beetroot; + mappings[1079] = ItemType.BeetrootSeeds; + mappings[1080] = ItemType.BeetrootSoup; + mappings[1131] = ItemType.Bell; + mappings[215] = ItemType.BigDripleaf; + mappings[717] = ItemType.BirchBoat; + mappings[646] = ItemType.BirchButton; + mappings[718] = ItemType.BirchChestBoat; + mappings[671] = ItemType.BirchDoor; + mappings[277] = ItemType.BirchFence; + mappings[692] = ItemType.BirchFenceGate; + mappings[833] = ItemType.BirchHangingSign; + mappings[148] = ItemType.BirchLeaves; + mappings[108] = ItemType.BirchLog; + mappings[25] = ItemType.BirchPlanks; + mappings[660] = ItemType.BirchPressurePlate; + mappings[36] = ItemType.BirchSapling; + mappings[823] = ItemType.BirchSign; + mappings[220] = ItemType.BirchSlab; + mappings[348] = ItemType.BirchStairs; + mappings[682] = ItemType.BirchTrapdoor; + mappings[139] = ItemType.BirchWood; + mappings[1074] = ItemType.BlackBanner; + mappings[912] = ItemType.BlackBed; + mappings[1175] = ItemType.BlackCandle; + mappings[423] = ItemType.BlackCarpet; + mappings[532] = ItemType.BlackConcrete; + mappings[548] = ItemType.BlackConcretePowder; + mappings[892] = ItemType.BlackDye; + mappings[516] = ItemType.BlackGlazedTerracotta; + mappings[500] = ItemType.BlackShulkerBox; + mappings[448] = ItemType.BlackStainedGlass; + mappings[464] = ItemType.BlackStainedGlassPane; + mappings[404] = ItemType.BlackTerracotta; + mappings[186] = ItemType.BlackWool; + mappings[1146] = ItemType.Blackstone; + mappings[1147] = ItemType.BlackstoneSlab; + mappings[1148] = ItemType.BlackstoneStairs; + mappings[374] = ItemType.BlackstoneWall; + mappings[1125] = ItemType.BlastFurnace; + mappings[934] = ItemType.BlazePowder; + mappings[926] = ItemType.BlazeRod; + mappings[944] = ItemType.BlazeSpawnEgg; + mappings[1070] = ItemType.BlueBanner; + mappings[908] = ItemType.BlueBed; + mappings[1171] = ItemType.BlueCandle; + mappings[419] = ItemType.BlueCarpet; + mappings[528] = ItemType.BlueConcrete; + mappings[544] = ItemType.BlueConcretePowder; + mappings[888] = ItemType.BlueDye; + mappings[512] = ItemType.BlueGlazedTerracotta; + mappings[580] = ItemType.BlueIce; + mappings[189] = ItemType.BlueOrchid; + mappings[496] = ItemType.BlueShulkerBox; + mappings[444] = ItemType.BlueStainedGlass; + mappings[460] = ItemType.BlueStainedGlassPane; + mappings[400] = ItemType.BlueTerracotta; + mappings[182] = ItemType.BlueWool; + mappings[894] = ItemType.Bone; + mappings[482] = ItemType.BoneBlock; + mappings[893] = ItemType.BoneMeal; + mappings[858] = ItemType.Book; + mappings[251] = ItemType.Bookshelf; + mappings[735] = ItemType.Bow; + mappings[783] = ItemType.Bowl; + mappings[561] = ItemType.BrainCoral; + mappings[556] = ItemType.BrainCoralBlock; + mappings[571] = ItemType.BrainCoralFan; + mappings[790] = ItemType.Bread; + mappings[936] = ItemType.BrewingStand; + mappings[854] = ItemType.Brick; + mappings[235] = ItemType.BrickSlab; + mappings[324] = ItemType.BrickStairs; + mappings[361] = ItemType.BrickWall; + mappings[250] = ItemType.Bricks; + mappings[1071] = ItemType.BrownBanner; + mappings[909] = ItemType.BrownBed; + mappings[1172] = ItemType.BrownCandle; + mappings[420] = ItemType.BrownCarpet; + mappings[529] = ItemType.BrownConcrete; + mappings[545] = ItemType.BrownConcretePowder; + mappings[889] = ItemType.BrownDye; + mappings[513] = ItemType.BrownGlazedTerracotta; + mappings[201] = ItemType.BrownMushroom; + mappings[315] = ItemType.BrownMushroomBlock; + mappings[497] = ItemType.BrownShulkerBox; + mappings[445] = ItemType.BrownStainedGlass; + mappings[461] = ItemType.BrownStainedGlassPane; + mappings[401] = ItemType.BrownTerracotta; + mappings[183] = ItemType.BrownWool; + mappings[562] = ItemType.BubbleCoral; + mappings[557] = ItemType.BubbleCoralBlock; + mappings[572] = ItemType.BubbleCoralFan; + mappings[841] = ItemType.Bucket; + mappings[69] = ItemType.BuddingAmethyst; + mappings[863] = ItemType.Bundle; + mappings[272] = ItemType.Cactus; + mappings[896] = ItemType.Cake; + mappings[11] = ItemType.Calcite; + mappings[946] = ItemType.CamelSpawnEgg; + mappings[1136] = ItemType.Campfire; + mappings[1159] = ItemType.Candle; + mappings[1023] = ItemType.Carrot; + mappings[710] = ItemType.CarrotOnAStick; + mappings[1126] = ItemType.CartographyTable; + mappings[286] = ItemType.CarvedPumpkin; + mappings[945] = ItemType.CatSpawnEgg; + mappings[937] = ItemType.Cauldron; + mappings[947] = ItemType.CaveSpiderSpawnEgg; + mappings[319] = ItemType.Chain; + mappings[477] = ItemType.ChainCommandBlock; + mappings[798] = ItemType.ChainmailBoots; + mappings[796] = ItemType.ChainmailChestplate; + mappings[795] = ItemType.ChainmailHelmet; + mappings[797] = ItemType.ChainmailLeggings; + mappings[738] = ItemType.Charcoal; + mappings[263] = ItemType.Chest; + mappings[706] = ItemType.ChestMinecart; + mappings[922] = ItemType.Chicken; + mappings[948] = ItemType.ChickenSpawnEgg; + mappings[382] = ItemType.ChippedAnvil; + mappings[252] = ItemType.ChiseledBookshelf; + mappings[313] = ItemType.ChiseledDeepslate; + mappings[331] = ItemType.ChiseledNetherBricks; + mappings[1153] = ItemType.ChiseledPolishedBlackstone; + mappings[384] = ItemType.ChiseledQuartzBlock; + mappings[473] = ItemType.ChiseledRedSandstone; + mappings[161] = ItemType.ChiseledSandstone; + mappings[306] = ItemType.ChiseledStoneBricks; + mappings[258] = ItemType.ChorusFlower; + mappings[1076] = ItemType.ChorusFruit; + mappings[257] = ItemType.ChorusPlant; + mappings[273] = ItemType.Clay; + mappings[855] = ItemType.ClayBall; + mappings[865] = ItemType.Clock; + mappings[737] = ItemType.Coal; + mappings[64] = ItemType.CoalBlock; + mappings[45] = ItemType.CoalOre; + mappings[16] = ItemType.CoarseDirt; + mappings[9] = ItemType.CobbledDeepslate; + mappings[613] = ItemType.CobbledDeepslateSlab; + mappings[596] = ItemType.CobbledDeepslateStairs; + mappings[377] = ItemType.CobbledDeepslateWall; + mappings[22] = ItemType.Cobblestone; + mappings[234] = ItemType.CobblestoneSlab; + mappings[268] = ItemType.CobblestoneStairs; + mappings[359] = ItemType.CobblestoneWall; + mappings[163] = ItemType.Cobweb; + mappings[876] = ItemType.CocoaBeans; + mappings[868] = ItemType.Cod; + mappings[850] = ItemType.CodBucket; + mappings[949] = ItemType.CodSpawnEgg; + mappings[357] = ItemType.CommandBlock; + mappings[1056] = ItemType.CommandBlockMinecart; + mappings[622] = ItemType.Comparator; + mappings[861] = ItemType.Compass; + mappings[1122] = ItemType.Composter; + mappings[581] = ItemType.Conduit; + mappings[921] = ItemType.CookedBeef; + mappings[923] = ItemType.CookedChicken; + mappings[872] = ItemType.CookedCod; + mappings[1058] = ItemType.CookedMutton; + mappings[817] = ItemType.CookedPorkchop; + mappings[1045] = ItemType.CookedRabbit; + mappings[873] = ItemType.CookedSalmon; + mappings[913] = ItemType.Cookie; + mappings[71] = ItemType.CopperBlock; + mappings[747] = ItemType.CopperIngot; + mappings[49] = ItemType.CopperOre; + mappings[197] = ItemType.Cornflower; + mappings[950] = ItemType.CowSpawnEgg; + mappings[310] = ItemType.CrackedDeepslateBricks; + mappings[312] = ItemType.CrackedDeepslateTiles; + mappings[330] = ItemType.CrackedNetherBricks; + mappings[1157] = ItemType.CrackedPolishedBlackstoneBricks; + mappings[305] = ItemType.CrackedStoneBricks; + mappings[264] = ItemType.CraftingTable; + mappings[1116] = ItemType.CreeperBannerPattern; + mappings[1033] = ItemType.CreeperHead; + mappings[951] = ItemType.CreeperSpawnEgg; + mappings[652] = ItemType.CrimsonButton; + mappings[677] = ItemType.CrimsonDoor; + mappings[283] = ItemType.CrimsonFence; + mappings[698] = ItemType.CrimsonFenceGate; + mappings[203] = ItemType.CrimsonFungus; + mappings[839] = ItemType.CrimsonHangingSign; + mappings[144] = ItemType.CrimsonHyphae; + mappings[20] = ItemType.CrimsonNylium; + mappings[31] = ItemType.CrimsonPlanks; + mappings[666] = ItemType.CrimsonPressurePlate; + mappings[205] = ItemType.CrimsonRoots; + mappings[829] = ItemType.CrimsonSign; + mappings[227] = ItemType.CrimsonSlab; + mappings[355] = ItemType.CrimsonStairs; + mappings[115] = ItemType.CrimsonStem; + mappings[688] = ItemType.CrimsonTrapdoor; + mappings[1112] = ItemType.Crossbow; + mappings[1145] = ItemType.CryingObsidian; + mappings[78] = ItemType.CutCopper; + mappings[86] = ItemType.CutCopperSlab; + mappings[82] = ItemType.CutCopperStairs; + mappings[474] = ItemType.CutRedSandstone; + mappings[241] = ItemType.CutRedSandstoneSlab; + mappings[162] = ItemType.CutSandstone; + mappings[232] = ItemType.CutSandstoneSlab; + mappings[1068] = ItemType.CyanBanner; + mappings[906] = ItemType.CyanBed; + mappings[1169] = ItemType.CyanCandle; + mappings[417] = ItemType.CyanCarpet; + mappings[526] = ItemType.CyanConcrete; + mappings[542] = ItemType.CyanConcretePowder; + mappings[886] = ItemType.CyanDye; + mappings[510] = ItemType.CyanGlazedTerracotta; + mappings[494] = ItemType.CyanShulkerBox; + mappings[442] = ItemType.CyanStainedGlass; + mappings[458] = ItemType.CyanStainedGlassPane; + mappings[398] = ItemType.CyanTerracotta; + mappings[180] = ItemType.CyanWool; + mappings[383] = ItemType.DamagedAnvil; + mappings[187] = ItemType.Dandelion; + mappings[723] = ItemType.DarkOakBoat; + mappings[649] = ItemType.DarkOakButton; + mappings[724] = ItemType.DarkOakChestBoat; + mappings[674] = ItemType.DarkOakDoor; + mappings[280] = ItemType.DarkOakFence; + mappings[695] = ItemType.DarkOakFenceGate; + mappings[836] = ItemType.DarkOakHangingSign; + mappings[151] = ItemType.DarkOakLeaves; + mappings[111] = ItemType.DarkOakLog; + mappings[28] = ItemType.DarkOakPlanks; + mappings[663] = ItemType.DarkOakPressurePlate; + mappings[39] = ItemType.DarkOakSapling; + mappings[826] = ItemType.DarkOakSign; + mappings[223] = ItemType.DarkOakSlab; + mappings[351] = ItemType.DarkOakStairs; + mappings[685] = ItemType.DarkOakTrapdoor; + mappings[142] = ItemType.DarkOakWood; + mappings[467] = ItemType.DarkPrismarine; + mappings[245] = ItemType.DarkPrismarineSlab; + mappings[470] = ItemType.DarkPrismarineStairs; + mappings[635] = ItemType.DaylightDetector; + mappings[565] = ItemType.DeadBrainCoral; + mappings[551] = ItemType.DeadBrainCoralBlock; + mappings[576] = ItemType.DeadBrainCoralFan; + mappings[566] = ItemType.DeadBubbleCoral; + mappings[552] = ItemType.DeadBubbleCoralBlock; + mappings[577] = ItemType.DeadBubbleCoralFan; + mappings[168] = ItemType.DeadBush; + mappings[567] = ItemType.DeadFireCoral; + mappings[553] = ItemType.DeadFireCoralBlock; + mappings[578] = ItemType.DeadFireCoralFan; + mappings[568] = ItemType.DeadHornCoral; + mappings[554] = ItemType.DeadHornCoralBlock; + mappings[579] = ItemType.DeadHornCoralFan; + mappings[569] = ItemType.DeadTubeCoral; + mappings[550] = ItemType.DeadTubeCoralBlock; + mappings[575] = ItemType.DeadTubeCoralFan; + mappings[1091] = ItemType.DebugStick; + mappings[8] = ItemType.Deepslate; + mappings[615] = ItemType.DeepslateBrickSlab; + mappings[598] = ItemType.DeepslateBrickStairs; + mappings[379] = ItemType.DeepslateBrickWall; + mappings[309] = ItemType.DeepslateBricks; + mappings[46] = ItemType.DeepslateCoalOre; + mappings[50] = ItemType.DeepslateCopperOre; + mappings[60] = ItemType.DeepslateDiamondOre; + mappings[56] = ItemType.DeepslateEmeraldOre; + mappings[52] = ItemType.DeepslateGoldOre; + mappings[48] = ItemType.DeepslateIronOre; + mappings[58] = ItemType.DeepslateLapisOre; + mappings[54] = ItemType.DeepslateRedstoneOre; + mappings[616] = ItemType.DeepslateTileSlab; + mappings[599] = ItemType.DeepslateTileStairs; + mappings[380] = ItemType.DeepslateTileWall; + mappings[311] = ItemType.DeepslateTiles; + mappings[701] = ItemType.DetectorRail; + mappings[739] = ItemType.Diamond; + mappings[775] = ItemType.DiamondAxe; + mappings[73] = ItemType.DiamondBlock; + mappings[806] = ItemType.DiamondBoots; + mappings[804] = ItemType.DiamondChestplate; + mappings[803] = ItemType.DiamondHelmet; + mappings[776] = ItemType.DiamondHoe; + mappings[1052] = ItemType.DiamondHorseArmor; + mappings[805] = ItemType.DiamondLeggings; + mappings[59] = ItemType.DiamondOre; + mappings[774] = ItemType.DiamondPickaxe; + mappings[773] = ItemType.DiamondShovel; + mappings[772] = ItemType.DiamondSword; + mappings[4] = ItemType.Diorite; + mappings[612] = ItemType.DioriteSlab; + mappings[595] = ItemType.DioriteStairs; + mappings[373] = ItemType.DioriteWall; + mappings[15] = ItemType.Dirt; + mappings[426] = ItemType.DirtPath; + mappings[1107] = ItemType.DiscFragment5; + mappings[629] = ItemType.Dispenser; + mappings[952] = ItemType.DolphinSpawnEgg; + mappings[953] = ItemType.DonkeySpawnEgg; + mappings[1081] = ItemType.DragonBreath; + mappings[342] = ItemType.DragonEgg; + mappings[1034] = ItemType.DragonHead; + mappings[917] = ItemType.DriedKelp; + mappings[856] = ItemType.DriedKelpBlock; + mappings[13] = ItemType.DripstoneBlock; + mappings[630] = ItemType.Dropper; + mappings[954] = ItemType.DrownedSpawnEgg; + mappings[1185] = ItemType.EchoShard; + mappings[860] = ItemType.Egg; + mappings[955] = ItemType.ElderGuardianSpawnEgg; + mappings[712] = ItemType.Elytra; + mappings[740] = ItemType.Emerald; + mappings[345] = ItemType.EmeraldBlock; + mappings[55] = ItemType.EmeraldOre; + mappings[1040] = ItemType.EnchantedBook; + mappings[820] = ItemType.EnchantedGoldenApple; + mappings[338] = ItemType.EnchantingTable; + mappings[1075] = ItemType.EndCrystal; + mappings[339] = ItemType.EndPortalFrame; + mappings[256] = ItemType.EndRod; + mappings[340] = ItemType.EndStone; + mappings[605] = ItemType.EndStoneBrickSlab; + mappings[587] = ItemType.EndStoneBrickStairs; + mappings[372] = ItemType.EndStoneBrickWall; + mappings[341] = ItemType.EndStoneBricks; + mappings[344] = ItemType.EnderChest; + mappings[956] = ItemType.EnderDragonSpawnEgg; + mappings[938] = ItemType.EnderEye; + mappings[925] = ItemType.EnderPearl; + mappings[957] = ItemType.EndermanSpawnEgg; + mappings[958] = ItemType.EndermiteSpawnEgg; + mappings[959] = ItemType.EvokerSpawnEgg; + mappings[1016] = ItemType.ExperienceBottle; + mappings[75] = ItemType.ExposedCopper; + mappings[79] = ItemType.ExposedCutCopper; + mappings[87] = ItemType.ExposedCutCopperSlab; + mappings[83] = ItemType.ExposedCutCopperStairs; + mappings[265] = ItemType.Farmland; + mappings[786] = ItemType.Feather; + mappings[933] = ItemType.FermentedSpiderEye; + mappings[165] = ItemType.Fern; + mappings[914] = ItemType.FilledMap; + mappings[1017] = ItemType.FireCharge; + mappings[563] = ItemType.FireCoral; + mappings[558] = ItemType.FireCoralBlock; + mappings[573] = ItemType.FireCoralFan; + mappings[1038] = ItemType.FireworkRocket; + mappings[1039] = ItemType.FireworkStar; + mappings[864] = ItemType.FishingRod; + mappings[1127] = ItemType.FletchingTable; + mappings[815] = ItemType.Flint; + mappings[733] = ItemType.FlintAndSteel; + mappings[1115] = ItemType.FlowerBannerPattern; + mappings[1022] = ItemType.FlowerPot; + mappings[167] = ItemType.FloweringAzalea; + mappings[154] = ItemType.FloweringAzaleaLeaves; + mappings[960] = ItemType.FoxSpawnEgg; + mappings[961] = ItemType.FrogSpawnEgg; + mappings[1184] = ItemType.Frogspawn; + mappings[266] = ItemType.Furnace; + mappings[707] = ItemType.FurnaceMinecart; + mappings[962] = ItemType.GhastSpawnEgg; + mappings[927] = ItemType.GhastTear; + mappings[1149] = ItemType.GildedBlackstone; + mappings[157] = ItemType.Glass; + mappings[931] = ItemType.GlassBottle; + mappings[320] = ItemType.GlassPane; + mappings[939] = ItemType.GlisteringMelonSlice; + mappings[1119] = ItemType.GlobeBannerPattern; + mappings[1135] = ItemType.GlowBerries; + mappings[875] = ItemType.GlowInkSac; + mappings[1021] = ItemType.GlowItemFrame; + mappings[323] = ItemType.GlowLichen; + mappings[963] = ItemType.GlowSquidSpawnEgg; + mappings[295] = ItemType.Glowstone; + mappings[867] = ItemType.GlowstoneDust; + mappings[1121] = ItemType.GoatHorn; + mappings[964] = ItemType.GoatSpawnEgg; + mappings[72] = ItemType.GoldBlock; + mappings[749] = ItemType.GoldIngot; + mappings[928] = ItemType.GoldNugget; + mappings[51] = ItemType.GoldOre; + mappings[819] = ItemType.GoldenApple; + mappings[765] = ItemType.GoldenAxe; + mappings[810] = ItemType.GoldenBoots; + mappings[1028] = ItemType.GoldenCarrot; + mappings[808] = ItemType.GoldenChestplate; + mappings[807] = ItemType.GoldenHelmet; + mappings[766] = ItemType.GoldenHoe; + mappings[1051] = ItemType.GoldenHorseArmor; + mappings[809] = ItemType.GoldenLeggings; + mappings[764] = ItemType.GoldenPickaxe; + mappings[763] = ItemType.GoldenShovel; + mappings[762] = ItemType.GoldenSword; + mappings[2] = ItemType.Granite; + mappings[608] = ItemType.GraniteSlab; + mappings[591] = ItemType.GraniteStairs; + mappings[365] = ItemType.GraniteWall; + mappings[164] = ItemType.Grass; + mappings[14] = ItemType.GrassBlock; + mappings[44] = ItemType.Gravel; + mappings[1066] = ItemType.GrayBanner; + mappings[904] = ItemType.GrayBed; + mappings[1167] = ItemType.GrayCandle; + mappings[415] = ItemType.GrayCarpet; + mappings[524] = ItemType.GrayConcrete; + mappings[540] = ItemType.GrayConcretePowder; + mappings[884] = ItemType.GrayDye; + mappings[508] = ItemType.GrayGlazedTerracotta; + mappings[492] = ItemType.GrayShulkerBox; + mappings[440] = ItemType.GrayStainedGlass; + mappings[456] = ItemType.GrayStainedGlassPane; + mappings[396] = ItemType.GrayTerracotta; + mappings[178] = ItemType.GrayWool; + mappings[1072] = ItemType.GreenBanner; + mappings[910] = ItemType.GreenBed; + mappings[1173] = ItemType.GreenCandle; + mappings[421] = ItemType.GreenCarpet; + mappings[530] = ItemType.GreenConcrete; + mappings[546] = ItemType.GreenConcretePowder; + mappings[890] = ItemType.GreenDye; + mappings[514] = ItemType.GreenGlazedTerracotta; + mappings[498] = ItemType.GreenShulkerBox; + mappings[446] = ItemType.GreenStainedGlass; + mappings[462] = ItemType.GreenStainedGlassPane; + mappings[402] = ItemType.GreenTerracotta; + mappings[184] = ItemType.GreenWool; + mappings[1128] = ItemType.Grindstone; + mappings[965] = ItemType.GuardianSpawnEgg; + mappings[787] = ItemType.Gunpowder; + mappings[214] = ItemType.HangingRoots; + mappings[407] = ItemType.HayBlock; + mappings[1111] = ItemType.HeartOfTheSea; + mappings[657] = ItemType.HeavyWeightedPressurePlate; + mappings[966] = ItemType.HoglinSpawnEgg; + mappings[626] = ItemType.HoneyBlock; + mappings[1142] = ItemType.HoneyBottle; + mappings[1139] = ItemType.Honeycomb; + mappings[1143] = ItemType.HoneycombBlock; + mappings[628] = ItemType.Hopper; + mappings[709] = ItemType.HopperMinecart; + mappings[564] = ItemType.HornCoral; + mappings[559] = ItemType.HornCoralBlock; + mappings[574] = ItemType.HornCoralFan; + mappings[967] = ItemType.HorseSpawnEgg; + mappings[968] = ItemType.HuskSpawnEgg; + mappings[270] = ItemType.Ice; + mappings[301] = ItemType.InfestedChiseledStoneBricks; + mappings[297] = ItemType.InfestedCobblestone; + mappings[300] = ItemType.InfestedCrackedStoneBricks; + mappings[302] = ItemType.InfestedDeepslate; + mappings[299] = ItemType.InfestedMossyStoneBricks; + mappings[296] = ItemType.InfestedStone; + mappings[298] = ItemType.InfestedStoneBricks; + mappings[874] = ItemType.InkSac; + mappings[770] = ItemType.IronAxe; + mappings[318] = ItemType.IronBars; + mappings[70] = ItemType.IronBlock; + mappings[802] = ItemType.IronBoots; + mappings[800] = ItemType.IronChestplate; + mappings[668] = ItemType.IronDoor; + mappings[969] = ItemType.IronGolemSpawnEgg; + mappings[799] = ItemType.IronHelmet; + mappings[771] = ItemType.IronHoe; + mappings[1050] = ItemType.IronHorseArmor; + mappings[745] = ItemType.IronIngot; + mappings[801] = ItemType.IronLeggings; + mappings[1089] = ItemType.IronNugget; + mappings[47] = ItemType.IronOre; + mappings[769] = ItemType.IronPickaxe; + mappings[768] = ItemType.IronShovel; + mappings[767] = ItemType.IronSword; + mappings[679] = ItemType.IronTrapdoor; + mappings[1020] = ItemType.ItemFrame; + mappings[287] = ItemType.JackOLantern; + mappings[730] = ItemType.Jigsaw; + mappings[274] = ItemType.Jukebox; + mappings[719] = ItemType.JungleBoat; + mappings[647] = ItemType.JungleButton; + mappings[720] = ItemType.JungleChestBoat; + mappings[672] = ItemType.JungleDoor; + mappings[278] = ItemType.JungleFence; + mappings[693] = ItemType.JungleFenceGate; + mappings[834] = ItemType.JungleHangingSign; + mappings[149] = ItemType.JungleLeaves; + mappings[109] = ItemType.JungleLog; + mappings[26] = ItemType.JunglePlanks; + mappings[661] = ItemType.JunglePressurePlate; + mappings[37] = ItemType.JungleSapling; + mappings[824] = ItemType.JungleSign; + mappings[221] = ItemType.JungleSlab; + mappings[349] = ItemType.JungleStairs; + mappings[683] = ItemType.JungleTrapdoor; + mappings[140] = ItemType.JungleWood; + mappings[211] = ItemType.Kelp; + mappings[1090] = ItemType.KnowledgeBook; + mappings[267] = ItemType.Ladder; + mappings[1132] = ItemType.Lantern; + mappings[159] = ItemType.LapisBlock; + mappings[741] = ItemType.LapisLazuli; + mappings[57] = ItemType.LapisOre; + mappings[1178] = ItemType.LargeAmethystBud; + mappings[432] = ItemType.LargeFern; + mappings[843] = ItemType.LavaBucket; + mappings[1054] = ItemType.Lead; + mappings[846] = ItemType.Leather; + mappings[794] = ItemType.LeatherBoots; + mappings[792] = ItemType.LeatherChestplate; + mappings[791] = ItemType.LeatherHelmet; + mappings[1053] = ItemType.LeatherHorseArmor; + mappings[793] = ItemType.LeatherLeggings; + mappings[631] = ItemType.Lectern; + mappings[633] = ItemType.Lever; + mappings[406] = ItemType.Light; + mappings[1062] = ItemType.LightBlueBanner; + mappings[900] = ItemType.LightBlueBed; + mappings[1163] = ItemType.LightBlueCandle; + mappings[411] = ItemType.LightBlueCarpet; + mappings[520] = ItemType.LightBlueConcrete; + mappings[536] = ItemType.LightBlueConcretePowder; + mappings[880] = ItemType.LightBlueDye; + mappings[504] = ItemType.LightBlueGlazedTerracotta; + mappings[488] = ItemType.LightBlueShulkerBox; + mappings[436] = ItemType.LightBlueStainedGlass; + mappings[452] = ItemType.LightBlueStainedGlassPane; + mappings[392] = ItemType.LightBlueTerracotta; + mappings[174] = ItemType.LightBlueWool; + mappings[1067] = ItemType.LightGrayBanner; + mappings[905] = ItemType.LightGrayBed; + mappings[1168] = ItemType.LightGrayCandle; + mappings[416] = ItemType.LightGrayCarpet; + mappings[525] = ItemType.LightGrayConcrete; + mappings[541] = ItemType.LightGrayConcretePowder; + mappings[885] = ItemType.LightGrayDye; + mappings[509] = ItemType.LightGrayGlazedTerracotta; + mappings[493] = ItemType.LightGrayShulkerBox; + mappings[441] = ItemType.LightGrayStainedGlass; + mappings[457] = ItemType.LightGrayStainedGlassPane; + mappings[397] = ItemType.LightGrayTerracotta; + mappings[179] = ItemType.LightGrayWool; + mappings[656] = ItemType.LightWeightedPressurePlate; + mappings[634] = ItemType.LightningRod; + mappings[428] = ItemType.Lilac; + mappings[198] = ItemType.LilyOfTheValley; + mappings[328] = ItemType.LilyPad; + mappings[1064] = ItemType.LimeBanner; + mappings[902] = ItemType.LimeBed; + mappings[1165] = ItemType.LimeCandle; + mappings[413] = ItemType.LimeCarpet; + mappings[522] = ItemType.LimeConcrete; + mappings[538] = ItemType.LimeConcretePowder; + mappings[882] = ItemType.LimeDye; + mappings[506] = ItemType.LimeGlazedTerracotta; + mappings[490] = ItemType.LimeShulkerBox; + mappings[438] = ItemType.LimeStainedGlass; + mappings[454] = ItemType.LimeStainedGlassPane; + mappings[394] = ItemType.LimeTerracotta; + mappings[176] = ItemType.LimeWool; + mappings[1085] = ItemType.LingeringPotion; + mappings[970] = ItemType.LlamaSpawnEgg; + mappings[1144] = ItemType.Lodestone; + mappings[1114] = ItemType.Loom; + mappings[1061] = ItemType.MagentaBanner; + mappings[899] = ItemType.MagentaBed; + mappings[1162] = ItemType.MagentaCandle; + mappings[410] = ItemType.MagentaCarpet; + mappings[519] = ItemType.MagentaConcrete; + mappings[535] = ItemType.MagentaConcretePowder; + mappings[879] = ItemType.MagentaDye; + mappings[503] = ItemType.MagentaGlazedTerracotta; + mappings[487] = ItemType.MagentaShulkerBox; + mappings[435] = ItemType.MagentaStainedGlass; + mappings[451] = ItemType.MagentaStainedGlassPane; + mappings[391] = ItemType.MagentaTerracotta; + mappings[173] = ItemType.MagentaWool; + mappings[478] = ItemType.MagmaBlock; + mappings[935] = ItemType.MagmaCream; + mappings[971] = ItemType.MagmaCubeSpawnEgg; + mappings[725] = ItemType.MangroveBoat; + mappings[650] = ItemType.MangroveButton; + mappings[726] = ItemType.MangroveChestBoat; + mappings[675] = ItemType.MangroveDoor; + mappings[281] = ItemType.MangroveFence; + mappings[696] = ItemType.MangroveFenceGate; + mappings[837] = ItemType.MangroveHangingSign; + mappings[152] = ItemType.MangroveLeaves; + mappings[112] = ItemType.MangroveLog; + mappings[29] = ItemType.MangrovePlanks; + mappings[664] = ItemType.MangrovePressurePlate; + mappings[40] = ItemType.MangrovePropagule; + mappings[113] = ItemType.MangroveRoots; + mappings[827] = ItemType.MangroveSign; + mappings[224] = ItemType.MangroveSlab; + mappings[352] = ItemType.MangroveStairs; + mappings[686] = ItemType.MangroveTrapdoor; + mappings[143] = ItemType.MangroveWood; + mappings[1027] = ItemType.Map; + mappings[1177] = ItemType.MediumAmethystBud; + mappings[321] = ItemType.Melon; + mappings[919] = ItemType.MelonSeeds; + mappings[916] = ItemType.MelonSlice; + mappings[847] = ItemType.MilkBucket; + mappings[705] = ItemType.Minecart; + mappings[1118] = ItemType.MojangBannerPattern; + mappings[972] = ItemType.MooshroomSpawnEgg; + mappings[213] = ItemType.MossBlock; + mappings[212] = ItemType.MossCarpet; + mappings[253] = ItemType.MossyCobblestone; + mappings[604] = ItemType.MossyCobblestoneSlab; + mappings[586] = ItemType.MossyCobblestoneStairs; + mappings[360] = ItemType.MossyCobblestoneWall; + mappings[602] = ItemType.MossyStoneBrickSlab; + mappings[584] = ItemType.MossyStoneBrickStairs; + mappings[364] = ItemType.MossyStoneBrickWall; + mappings[304] = ItemType.MossyStoneBricks; + mappings[19] = ItemType.Mud; + mappings[237] = ItemType.MudBrickSlab; + mappings[326] = ItemType.MudBrickStairs; + mappings[367] = ItemType.MudBrickWall; + mappings[308] = ItemType.MudBricks; + mappings[114] = ItemType.MuddyMangroveRoots; + mappings[973] = ItemType.MuleSpawnEgg; + mappings[317] = ItemType.MushroomStem; + mappings[784] = ItemType.MushroomStew; + mappings[1102] = ItemType.MusicDisc11; + mappings[1092] = ItemType.MusicDisc13; + mappings[1105] = ItemType.MusicDisc5; + mappings[1094] = ItemType.MusicDiscBlocks; + mappings[1093] = ItemType.MusicDiscCat; + mappings[1095] = ItemType.MusicDiscChirp; + mappings[1096] = ItemType.MusicDiscFar; + mappings[1097] = ItemType.MusicDiscMall; + mappings[1098] = ItemType.MusicDiscMellohi; + mappings[1104] = ItemType.MusicDiscOtherside; + mappings[1106] = ItemType.MusicDiscPigstep; + mappings[1099] = ItemType.MusicDiscStal; + mappings[1100] = ItemType.MusicDiscStrad; + mappings[1103] = ItemType.MusicDiscWait; + mappings[1101] = ItemType.MusicDiscWard; + mappings[1057] = ItemType.Mutton; + mappings[327] = ItemType.Mycelium; + mappings[1055] = ItemType.NameTag; + mappings[1110] = ItemType.NautilusShell; + mappings[1041] = ItemType.NetherBrick; + mappings[332] = ItemType.NetherBrickFence; + mappings[238] = ItemType.NetherBrickSlab; + mappings[333] = ItemType.NetherBrickStairs; + mappings[368] = ItemType.NetherBrickWall; + mappings[329] = ItemType.NetherBricks; + mappings[61] = ItemType.NetherGoldOre; + mappings[62] = ItemType.NetherQuartzOre; + mappings[207] = ItemType.NetherSprouts; + mappings[1036] = ItemType.NetherStar; + mappings[929] = ItemType.NetherWart; + mappings[479] = ItemType.NetherWartBlock; + mappings[780] = ItemType.NetheriteAxe; + mappings[74] = ItemType.NetheriteBlock; + mappings[814] = ItemType.NetheriteBoots; + mappings[812] = ItemType.NetheriteChestplate; + mappings[811] = ItemType.NetheriteHelmet; + mappings[781] = ItemType.NetheriteHoe; + mappings[750] = ItemType.NetheriteIngot; + mappings[813] = ItemType.NetheriteLeggings; + mappings[779] = ItemType.NetheritePickaxe; + mappings[751] = ItemType.NetheriteScrap; + mappings[778] = ItemType.NetheriteShovel; + mappings[777] = ItemType.NetheriteSword; + mappings[288] = ItemType.Netherrack; + mappings[641] = ItemType.NoteBlock; + mappings[713] = ItemType.OakBoat; + mappings[644] = ItemType.OakButton; + mappings[714] = ItemType.OakChestBoat; + mappings[669] = ItemType.OakDoor; + mappings[275] = ItemType.OakFence; + mappings[690] = ItemType.OakFenceGate; + mappings[831] = ItemType.OakHangingSign; + mappings[146] = ItemType.OakLeaves; + mappings[106] = ItemType.OakLog; + mappings[23] = ItemType.OakPlanks; + mappings[658] = ItemType.OakPressurePlate; + mappings[34] = ItemType.OakSapling; + mappings[821] = ItemType.OakSign; + mappings[218] = ItemType.OakSlab; + mappings[346] = ItemType.OakStairs; + mappings[680] = ItemType.OakTrapdoor; + mappings[137] = ItemType.OakWood; + mappings[627] = ItemType.Observer; + mappings[254] = ItemType.Obsidian; + mappings[974] = ItemType.OcelotSpawnEgg; + mappings[1181] = ItemType.OchreFroglight; + mappings[1060] = ItemType.OrangeBanner; + mappings[898] = ItemType.OrangeBed; + mappings[1161] = ItemType.OrangeCandle; + mappings[409] = ItemType.OrangeCarpet; + mappings[518] = ItemType.OrangeConcrete; + mappings[534] = ItemType.OrangeConcretePowder; + mappings[878] = ItemType.OrangeDye; + mappings[502] = ItemType.OrangeGlazedTerracotta; + mappings[486] = ItemType.OrangeShulkerBox; + mappings[434] = ItemType.OrangeStainedGlass; + mappings[450] = ItemType.OrangeStainedGlassPane; + mappings[390] = ItemType.OrangeTerracotta; + mappings[193] = ItemType.OrangeTulip; + mappings[172] = ItemType.OrangeWool; + mappings[196] = ItemType.OxeyeDaisy; + mappings[77] = ItemType.OxidizedCopper; + mappings[81] = ItemType.OxidizedCutCopper; + mappings[89] = ItemType.OxidizedCutCopperSlab; + mappings[85] = ItemType.OxidizedCutCopperStairs; + mappings[425] = ItemType.PackedIce; + mappings[307] = ItemType.PackedMud; + mappings[818] = ItemType.Painting; + mappings[975] = ItemType.PandaSpawnEgg; + mappings[857] = ItemType.Paper; + mappings[976] = ItemType.ParrotSpawnEgg; + mappings[1183] = ItemType.PearlescentFroglight; + mappings[430] = ItemType.Peony; + mappings[233] = ItemType.PetrifiedOakSlab; + mappings[1109] = ItemType.PhantomMembrane; + mappings[977] = ItemType.PhantomSpawnEgg; + mappings[978] = ItemType.PigSpawnEgg; + mappings[1120] = ItemType.PiglinBannerPattern; + mappings[980] = ItemType.PiglinBruteSpawnEgg; + mappings[1035] = ItemType.PiglinHead; + mappings[979] = ItemType.PiglinSpawnEgg; + mappings[981] = ItemType.PillagerSpawnEgg; + mappings[1065] = ItemType.PinkBanner; + mappings[903] = ItemType.PinkBed; + mappings[1166] = ItemType.PinkCandle; + mappings[414] = ItemType.PinkCarpet; + mappings[523] = ItemType.PinkConcrete; + mappings[539] = ItemType.PinkConcretePowder; + mappings[883] = ItemType.PinkDye; + mappings[507] = ItemType.PinkGlazedTerracotta; + mappings[491] = ItemType.PinkShulkerBox; + mappings[439] = ItemType.PinkStainedGlass; + mappings[455] = ItemType.PinkStainedGlassPane; + mappings[395] = ItemType.PinkTerracotta; + mappings[195] = ItemType.PinkTulip; + mappings[177] = ItemType.PinkWool; + mappings[623] = ItemType.Piston; + mappings[1031] = ItemType.PlayerHead; + mappings[17] = ItemType.Podzol; + mappings[1180] = ItemType.PointedDripstone; + mappings[1026] = ItemType.PoisonousPotato; + mappings[982] = ItemType.PolarBearSpawnEgg; + mappings[7] = ItemType.PolishedAndesite; + mappings[611] = ItemType.PolishedAndesiteSlab; + mappings[594] = ItemType.PolishedAndesiteStairs; + mappings[292] = ItemType.PolishedBasalt; + mappings[1150] = ItemType.PolishedBlackstone; + mappings[1155] = ItemType.PolishedBlackstoneBrickSlab; + mappings[1156] = ItemType.PolishedBlackstoneBrickStairs; + mappings[376] = ItemType.PolishedBlackstoneBrickWall; + mappings[1154] = ItemType.PolishedBlackstoneBricks; + mappings[643] = ItemType.PolishedBlackstoneButton; + mappings[655] = ItemType.PolishedBlackstonePressurePlate; + mappings[1151] = ItemType.PolishedBlackstoneSlab; + mappings[1152] = ItemType.PolishedBlackstoneStairs; + mappings[375] = ItemType.PolishedBlackstoneWall; + mappings[10] = ItemType.PolishedDeepslate; + mappings[614] = ItemType.PolishedDeepslateSlab; + mappings[597] = ItemType.PolishedDeepslateStairs; + mappings[378] = ItemType.PolishedDeepslateWall; + mappings[5] = ItemType.PolishedDiorite; + mappings[603] = ItemType.PolishedDioriteSlab; + mappings[585] = ItemType.PolishedDioriteStairs; + mappings[3] = ItemType.PolishedGranite; + mappings[600] = ItemType.PolishedGraniteSlab; + mappings[582] = ItemType.PolishedGraniteStairs; + mappings[1077] = ItemType.PoppedChorusFruit; + mappings[188] = ItemType.Poppy; + mappings[816] = ItemType.Porkchop; + mappings[1024] = ItemType.Potato; + mappings[930] = ItemType.Potion; + mappings[844] = ItemType.PowderSnowBucket; + mappings[700] = ItemType.PoweredRail; + mappings[465] = ItemType.Prismarine; + mappings[244] = ItemType.PrismarineBrickSlab; + mappings[469] = ItemType.PrismarineBrickStairs; + mappings[466] = ItemType.PrismarineBricks; + mappings[1043] = ItemType.PrismarineCrystals; + mappings[1042] = ItemType.PrismarineShard; + mappings[243] = ItemType.PrismarineSlab; + mappings[468] = ItemType.PrismarineStairs; + mappings[362] = ItemType.PrismarineWall; + mappings[871] = ItemType.Pufferfish; + mappings[848] = ItemType.PufferfishBucket; + mappings[983] = ItemType.PufferfishSpawnEgg; + mappings[285] = ItemType.Pumpkin; + mappings[1037] = ItemType.PumpkinPie; + mappings[918] = ItemType.PumpkinSeeds; + mappings[1069] = ItemType.PurpleBanner; + mappings[907] = ItemType.PurpleBed; + mappings[1170] = ItemType.PurpleCandle; + mappings[418] = ItemType.PurpleCarpet; + mappings[527] = ItemType.PurpleConcrete; + mappings[543] = ItemType.PurpleConcretePowder; + mappings[887] = ItemType.PurpleDye; + mappings[511] = ItemType.PurpleGlazedTerracotta; + mappings[495] = ItemType.PurpleShulkerBox; + mappings[443] = ItemType.PurpleStainedGlass; + mappings[459] = ItemType.PurpleStainedGlassPane; + mappings[399] = ItemType.PurpleTerracotta; + mappings[181] = ItemType.PurpleWool; + mappings[259] = ItemType.PurpurBlock; + mappings[260] = ItemType.PurpurPillar; + mappings[242] = ItemType.PurpurSlab; + mappings[261] = ItemType.PurpurStairs; + mappings[742] = ItemType.Quartz; + mappings[385] = ItemType.QuartzBlock; + mappings[386] = ItemType.QuartzBricks; + mappings[387] = ItemType.QuartzPillar; + mappings[239] = ItemType.QuartzSlab; + mappings[388] = ItemType.QuartzStairs; + mappings[1044] = ItemType.Rabbit; + mappings[1047] = ItemType.RabbitFoot; + mappings[1048] = ItemType.RabbitHide; + mappings[984] = ItemType.RabbitSpawnEgg; + mappings[1046] = ItemType.RabbitStew; + mappings[702] = ItemType.Rail; + mappings[985] = ItemType.RavagerSpawnEgg; + mappings[746] = ItemType.RawCopper; + mappings[66] = ItemType.RawCopperBlock; + mappings[748] = ItemType.RawGold; + mappings[67] = ItemType.RawGoldBlock; + mappings[744] = ItemType.RawIron; + mappings[65] = ItemType.RawIronBlock; + mappings[862] = ItemType.RecoveryCompass; + mappings[1073] = ItemType.RedBanner; + mappings[911] = ItemType.RedBed; + mappings[1174] = ItemType.RedCandle; + mappings[422] = ItemType.RedCarpet; + mappings[531] = ItemType.RedConcrete; + mappings[547] = ItemType.RedConcretePowder; + mappings[891] = ItemType.RedDye; + mappings[515] = ItemType.RedGlazedTerracotta; + mappings[202] = ItemType.RedMushroom; + mappings[316] = ItemType.RedMushroomBlock; + mappings[610] = ItemType.RedNetherBrickSlab; + mappings[593] = ItemType.RedNetherBrickStairs; + mappings[370] = ItemType.RedNetherBrickWall; + mappings[481] = ItemType.RedNetherBricks; + mappings[43] = ItemType.RedSand; + mappings[472] = ItemType.RedSandstone; + mappings[240] = ItemType.RedSandstoneSlab; + mappings[475] = ItemType.RedSandstoneStairs; + mappings[363] = ItemType.RedSandstoneWall; + mappings[499] = ItemType.RedShulkerBox; + mappings[447] = ItemType.RedStainedGlass; + mappings[463] = ItemType.RedStainedGlassPane; + mappings[403] = ItemType.RedTerracotta; + mappings[192] = ItemType.RedTulip; + mappings[185] = ItemType.RedWool; + mappings[618] = ItemType.Redstone; + mappings[620] = ItemType.RedstoneBlock; + mappings[640] = ItemType.RedstoneLamp; + mappings[53] = ItemType.RedstoneOre; + mappings[619] = ItemType.RedstoneTorch; + mappings[314] = ItemType.ReinforcedDeepslate; + mappings[621] = ItemType.Repeater; + mappings[476] = ItemType.RepeatingCommandBlock; + mappings[1158] = ItemType.RespawnAnchor; + mappings[18] = ItemType.RootedDirt; + mappings[429] = ItemType.RoseBush; + mappings[924] = ItemType.RottenFlesh; + mappings[704] = ItemType.Saddle; + mappings[869] = ItemType.Salmon; + mappings[849] = ItemType.SalmonBucket; + mappings[986] = ItemType.SalmonSpawnEgg; + mappings[42] = ItemType.Sand; + mappings[160] = ItemType.Sandstone; + mappings[231] = ItemType.SandstoneSlab; + mappings[343] = ItemType.SandstoneStairs; + mappings[371] = ItemType.SandstoneWall; + mappings[617] = ItemType.Scaffolding; + mappings[334] = ItemType.Sculk; + mappings[336] = ItemType.SculkCatalyst; + mappings[636] = ItemType.SculkSensor; + mappings[337] = ItemType.SculkShrieker; + mappings[335] = ItemType.SculkVein; + mappings[732] = ItemType.Scute; + mappings[471] = ItemType.SeaLantern; + mappings[170] = ItemType.SeaPickle; + mappings[169] = ItemType.Seagrass; + mappings[915] = ItemType.Shears; + mappings[987] = ItemType.SheepSpawnEgg; + mappings[1086] = ItemType.Shield; + mappings[1138] = ItemType.Shroomlight; + mappings[484] = ItemType.ShulkerBox; + mappings[1088] = ItemType.ShulkerShell; + mappings[988] = ItemType.ShulkerSpawnEgg; + mappings[989] = ItemType.SilverfishSpawnEgg; + mappings[991] = ItemType.SkeletonHorseSpawnEgg; + mappings[1029] = ItemType.SkeletonSkull; + mappings[990] = ItemType.SkeletonSpawnEgg; + mappings[1117] = ItemType.SkullBannerPattern; + mappings[859] = ItemType.SlimeBall; + mappings[625] = ItemType.SlimeBlock; + mappings[992] = ItemType.SlimeSpawnEgg; + mappings[1176] = ItemType.SmallAmethystBud; + mappings[216] = ItemType.SmallDripleaf; + mappings[1129] = ItemType.SmithingTable; + mappings[1124] = ItemType.Smoker; + mappings[293] = ItemType.SmoothBasalt; + mappings[246] = ItemType.SmoothQuartz; + mappings[607] = ItemType.SmoothQuartzSlab; + mappings[590] = ItemType.SmoothQuartzStairs; + mappings[247] = ItemType.SmoothRedSandstone; + mappings[601] = ItemType.SmoothRedSandstoneSlab; + mappings[583] = ItemType.SmoothRedSandstoneStairs; + mappings[248] = ItemType.SmoothSandstone; + mappings[606] = ItemType.SmoothSandstoneSlab; + mappings[589] = ItemType.SmoothSandstoneStairs; + mappings[249] = ItemType.SmoothStone; + mappings[230] = ItemType.SmoothStoneSlab; + mappings[269] = ItemType.Snow; + mappings[271] = ItemType.SnowBlock; + mappings[993] = ItemType.SnowGolemSpawnEgg; + mappings[845] = ItemType.Snowball; + mappings[1137] = ItemType.SoulCampfire; + mappings[1133] = ItemType.SoulLantern; + mappings[289] = ItemType.SoulSand; + mappings[290] = ItemType.SoulSoil; + mappings[294] = ItemType.SoulTorch; + mappings[262] = ItemType.Spawner; + mappings[1083] = ItemType.SpectralArrow; + mappings[932] = ItemType.SpiderEye; + mappings[994] = ItemType.SpiderSpawnEgg; + mappings[1082] = ItemType.SplashPotion; + mappings[155] = ItemType.Sponge; + mappings[200] = ItemType.SporeBlossom; + mappings[715] = ItemType.SpruceBoat; + mappings[645] = ItemType.SpruceButton; + mappings[716] = ItemType.SpruceChestBoat; + mappings[670] = ItemType.SpruceDoor; + mappings[276] = ItemType.SpruceFence; + mappings[691] = ItemType.SpruceFenceGate; + mappings[832] = ItemType.SpruceHangingSign; + mappings[147] = ItemType.SpruceLeaves; + mappings[107] = ItemType.SpruceLog; + mappings[24] = ItemType.SprucePlanks; + mappings[659] = ItemType.SprucePressurePlate; + mappings[35] = ItemType.SpruceSapling; + mappings[822] = ItemType.SpruceSign; + mappings[219] = ItemType.SpruceSlab; + mappings[347] = ItemType.SpruceStairs; + mappings[681] = ItemType.SpruceTrapdoor; + mappings[138] = ItemType.SpruceWood; + mappings[866] = ItemType.Spyglass; + mappings[995] = ItemType.SquidSpawnEgg; + mappings[782] = ItemType.Stick; + mappings[624] = ItemType.StickyPiston; + mappings[1] = ItemType.Stone; + mappings[760] = ItemType.StoneAxe; + mappings[236] = ItemType.StoneBrickSlab; + mappings[325] = ItemType.StoneBrickStairs; + mappings[366] = ItemType.StoneBrickWall; + mappings[303] = ItemType.StoneBricks; + mappings[642] = ItemType.StoneButton; + mappings[761] = ItemType.StoneHoe; + mappings[759] = ItemType.StonePickaxe; + mappings[654] = ItemType.StonePressurePlate; + mappings[758] = ItemType.StoneShovel; + mappings[229] = ItemType.StoneSlab; + mappings[588] = ItemType.StoneStairs; + mappings[757] = ItemType.StoneSword; + mappings[1130] = ItemType.Stonecutter; + mappings[996] = ItemType.StraySpawnEgg; + mappings[997] = ItemType.StriderSpawnEgg; + mappings[785] = ItemType.String; + mappings[122] = ItemType.StrippedAcaciaLog; + mappings[131] = ItemType.StrippedAcaciaWood; + mappings[136] = ItemType.StrippedBambooBlock; + mappings[120] = ItemType.StrippedBirchLog; + mappings[129] = ItemType.StrippedBirchWood; + mappings[134] = ItemType.StrippedCrimsonHyphae; + mappings[125] = ItemType.StrippedCrimsonStem; + mappings[123] = ItemType.StrippedDarkOakLog; + mappings[132] = ItemType.StrippedDarkOakWood; + mappings[121] = ItemType.StrippedJungleLog; + mappings[130] = ItemType.StrippedJungleWood; + mappings[124] = ItemType.StrippedMangroveLog; + mappings[133] = ItemType.StrippedMangroveWood; + mappings[118] = ItemType.StrippedOakLog; + mappings[127] = ItemType.StrippedOakWood; + mappings[119] = ItemType.StrippedSpruceLog; + mappings[128] = ItemType.StrippedSpruceWood; + mappings[135] = ItemType.StrippedWarpedHyphae; + mappings[126] = ItemType.StrippedWarpedStem; + mappings[729] = ItemType.StructureBlock; + mappings[483] = ItemType.StructureVoid; + mappings[895] = ItemType.Sugar; + mappings[210] = ItemType.SugarCane; + mappings[427] = ItemType.Sunflower; + mappings[1113] = ItemType.SuspiciousStew; + mappings[1134] = ItemType.SweetBerries; + mappings[853] = ItemType.TadpoleBucket; + mappings[998] = ItemType.TadpoleSpawnEgg; + mappings[431] = ItemType.TallGrass; + mappings[632] = ItemType.Target; + mappings[424] = ItemType.Terracotta; + mappings[158] = ItemType.TintedGlass; + mappings[1084] = ItemType.TippedArrow; + mappings[639] = ItemType.Tnt; + mappings[708] = ItemType.TntMinecart; + mappings[255] = ItemType.Torch; + mappings[1087] = ItemType.TotemOfUndying; + mappings[999] = ItemType.TraderLlamaSpawnEgg; + mappings[638] = ItemType.TrappedChest; + mappings[1108] = ItemType.Trident; + mappings[637] = ItemType.TripwireHook; + mappings[870] = ItemType.TropicalFish; + mappings[851] = ItemType.TropicalFishBucket; + mappings[1000] = ItemType.TropicalFishSpawnEgg; + mappings[560] = ItemType.TubeCoral; + mappings[555] = ItemType.TubeCoralBlock; + mappings[570] = ItemType.TubeCoralFan; + mappings[12] = ItemType.Tuff; + mappings[549] = ItemType.TurtleEgg; + mappings[731] = ItemType.TurtleHelmet; + mappings[1001] = ItemType.TurtleSpawnEgg; + mappings[209] = ItemType.TwistingVines; + mappings[1182] = ItemType.VerdantFroglight; + mappings[1002] = ItemType.VexSpawnEgg; + mappings[1003] = ItemType.VillagerSpawnEgg; + mappings[1004] = ItemType.VindicatorSpawnEgg; + mappings[322] = ItemType.Vine; + mappings[1005] = ItemType.WanderingTraderSpawnEgg; + mappings[1006] = ItemType.WardenSpawnEgg; + mappings[653] = ItemType.WarpedButton; + mappings[678] = ItemType.WarpedDoor; + mappings[284] = ItemType.WarpedFence; + mappings[699] = ItemType.WarpedFenceGate; + mappings[204] = ItemType.WarpedFungus; + mappings[711] = ItemType.WarpedFungusOnAStick; + mappings[840] = ItemType.WarpedHangingSign; + mappings[145] = ItemType.WarpedHyphae; + mappings[21] = ItemType.WarpedNylium; + mappings[32] = ItemType.WarpedPlanks; + mappings[667] = ItemType.WarpedPressurePlate; + mappings[206] = ItemType.WarpedRoots; + mappings[830] = ItemType.WarpedSign; + mappings[228] = ItemType.WarpedSlab; + mappings[356] = ItemType.WarpedStairs; + mappings[116] = ItemType.WarpedStem; + mappings[689] = ItemType.WarpedTrapdoor; + mappings[480] = ItemType.WarpedWartBlock; + mappings[842] = ItemType.WaterBucket; + mappings[90] = ItemType.WaxedCopperBlock; + mappings[94] = ItemType.WaxedCutCopper; + mappings[102] = ItemType.WaxedCutCopperSlab; + mappings[98] = ItemType.WaxedCutCopperStairs; + mappings[91] = ItemType.WaxedExposedCopper; + mappings[95] = ItemType.WaxedExposedCutCopper; + mappings[103] = ItemType.WaxedExposedCutCopperSlab; + mappings[99] = ItemType.WaxedExposedCutCopperStairs; + mappings[93] = ItemType.WaxedOxidizedCopper; + mappings[97] = ItemType.WaxedOxidizedCutCopper; + mappings[105] = ItemType.WaxedOxidizedCutCopperSlab; + mappings[101] = ItemType.WaxedOxidizedCutCopperStairs; + mappings[92] = ItemType.WaxedWeatheredCopper; + mappings[96] = ItemType.WaxedWeatheredCutCopper; + mappings[104] = ItemType.WaxedWeatheredCutCopperSlab; + mappings[100] = ItemType.WaxedWeatheredCutCopperStairs; + mappings[76] = ItemType.WeatheredCopper; + mappings[80] = ItemType.WeatheredCutCopper; + mappings[88] = ItemType.WeatheredCutCopperSlab; + mappings[84] = ItemType.WeatheredCutCopperStairs; + mappings[208] = ItemType.WeepingVines; + mappings[156] = ItemType.WetSponge; + mappings[789] = ItemType.Wheat; + mappings[788] = ItemType.WheatSeeds; + mappings[1059] = ItemType.WhiteBanner; + mappings[897] = ItemType.WhiteBed; + mappings[1160] = ItemType.WhiteCandle; + mappings[408] = ItemType.WhiteCarpet; + mappings[517] = ItemType.WhiteConcrete; + mappings[533] = ItemType.WhiteConcretePowder; + mappings[877] = ItemType.WhiteDye; + mappings[501] = ItemType.WhiteGlazedTerracotta; + mappings[485] = ItemType.WhiteShulkerBox; + mappings[433] = ItemType.WhiteStainedGlass; + mappings[449] = ItemType.WhiteStainedGlassPane; + mappings[389] = ItemType.WhiteTerracotta; + mappings[194] = ItemType.WhiteTulip; + mappings[171] = ItemType.WhiteWool; + mappings[1007] = ItemType.WitchSpawnEgg; + mappings[199] = ItemType.WitherRose; + mappings[1030] = ItemType.WitherSkeletonSkull; + mappings[1009] = ItemType.WitherSkeletonSpawnEgg; + mappings[1008] = ItemType.WitherSpawnEgg; + mappings[1010] = ItemType.WolfSpawnEgg; + mappings[755] = ItemType.WoodenAxe; + mappings[756] = ItemType.WoodenHoe; + mappings[754] = ItemType.WoodenPickaxe; + mappings[753] = ItemType.WoodenShovel; + mappings[752] = ItemType.WoodenSword; + mappings[1018] = ItemType.WritableBook; + mappings[1019] = ItemType.WrittenBook; + mappings[1063] = ItemType.YellowBanner; + mappings[901] = ItemType.YellowBed; + mappings[1164] = ItemType.YellowCandle; + mappings[412] = ItemType.YellowCarpet; + mappings[521] = ItemType.YellowConcrete; + mappings[537] = ItemType.YellowConcretePowder; + mappings[881] = ItemType.YellowDye; + mappings[505] = ItemType.YellowGlazedTerracotta; + mappings[489] = ItemType.YellowShulkerBox; + mappings[437] = ItemType.YellowStainedGlass; + mappings[453] = ItemType.YellowStainedGlassPane; + mappings[393] = ItemType.YellowTerracotta; + mappings[175] = ItemType.YellowWool; + mappings[1011] = ItemType.ZoglinSpawnEgg; + mappings[1032] = ItemType.ZombieHead; + mappings[1013] = ItemType.ZombieHorseSpawnEgg; + mappings[1012] = ItemType.ZombieSpawnEgg; + mappings[1014] = ItemType.ZombieVillagerSpawnEgg; + mappings[1015] = ItemType.ZombifiedPiglinSpawnEgg; + } + + protected override Dictionary GetDict() + { + return mappings; + } + } +} diff --git a/MinecraftClient/Inventory/ItemType.cs b/MinecraftClient/Inventory/ItemType.cs index 0e487d5b..11807ab7 100644 --- a/MinecraftClient/Inventory/ItemType.cs +++ b/MinecraftClient/Inventory/ItemType.cs @@ -20,6 +20,7 @@ AcaciaDoor, AcaciaFence, AcaciaFenceGate, + AcaciaHangingSign, AcaciaLeaves, AcaciaLog, AcaciaPlanks, @@ -53,6 +54,23 @@ AzureBluet, BakedPotato, Bamboo, + BambooBlock, + BambooButton, + BambooChestRaft, + BambooDoor, + BambooFence, + BambooFenceGate, + BambooHangingSign, + BambooMosaic, + BambooMosaicSlab, + BambooMosaicStairs, + BambooPlanks, + BambooPressurePlate, + BambooRaft, + BambooSign, + BambooSlab, + BambooStairs, + BambooTrapdoor, Barrel, Barrier, Basalt, @@ -74,6 +92,7 @@ BirchDoor, BirchFence, BirchFenceGate, + BirchHangingSign, BirchLeaves, BirchLog, BirchPlanks, @@ -161,6 +180,7 @@ Cactus, Cake, Calcite, + CamelSpawnEgg, Campfire, Candle, Carrot, @@ -182,6 +202,7 @@ Chicken, ChickenSpawnEgg, ChippedAnvil, + ChiseledBookshelf, ChiseledDeepslate, ChiseledNetherBricks, ChiseledPolishedBlackstone, @@ -245,6 +266,7 @@ CrimsonFence, CrimsonFenceGate, CrimsonFungus, + CrimsonHangingSign, CrimsonHyphae, CrimsonNylium, CrimsonPlanks, @@ -285,6 +307,7 @@ DarkOakDoor, DarkOakFence, DarkOakFenceGate, + DarkOakHangingSign, DarkOakLeaves, DarkOakLog, DarkOakPlanks, @@ -384,6 +407,7 @@ EndStoneBrickWall, EndStoneBricks, EnderChest, + EnderDragonSpawnEgg, EnderEye, EnderPearl, EndermanSpawnEgg, @@ -518,6 +542,7 @@ IronBoots, IronChestplate, IronDoor, + IronGolemSpawnEgg, IronHelmet, IronHoe, IronHorseArmor, @@ -539,6 +564,7 @@ JungleDoor, JungleFence, JungleFenceGate, + JungleHangingSign, JungleLeaves, JungleLog, JunglePlanks, @@ -639,6 +665,7 @@ MangroveDoor, MangroveFence, MangroveFenceGate, + MangroveHangingSign, MangroveLeaves, MangroveLog, MangrovePlanks, @@ -729,6 +756,7 @@ OakDoor, OakFence, OakFenceGate, + OakHangingSign, OakLeaves, OakLog, OakPlanks, @@ -776,6 +804,7 @@ PigSpawnEgg, PiglinBannerPattern, PiglinBruteSpawnEgg, + PiglinHead, PiglinSpawnEgg, PillagerSpawnEgg, PinkBanner, @@ -970,6 +999,7 @@ SmoothStoneSlab, Snow, SnowBlock, + SnowGolemSpawnEgg, Snowball, SoulCampfire, SoulLantern, @@ -989,6 +1019,7 @@ SpruceDoor, SpruceFence, SpruceFenceGate, + SpruceHangingSign, SpruceLeaves, SpruceLog, SprucePlanks, @@ -1023,6 +1054,7 @@ String, StrippedAcaciaLog, StrippedAcaciaWood, + StrippedBambooBlock, StrippedBirchLog, StrippedBirchWood, StrippedCrimsonHyphae, @@ -1085,6 +1117,7 @@ WarpedFenceGate, WarpedFungus, WarpedFungusOnAStick, + WarpedHangingSign, WarpedHyphae, WarpedNylium, WarpedPlanks, @@ -1139,6 +1172,7 @@ WitherRose, WitherSkeletonSkull, WitherSkeletonSpawnEgg, + WitherSpawnEgg, WolfSpawnEgg, WoodenAxe, WoodenHoe, diff --git a/MinecraftClient/Mapping/BlockPalettes/Palette1193.cs b/MinecraftClient/Mapping/BlockPalettes/Palette1193.cs new file mode 100644 index 00000000..eb1e61fb --- /dev/null +++ b/MinecraftClient/Mapping/BlockPalettes/Palette1193.cs @@ -0,0 +1,1605 @@ +using System.Collections.Generic; + +namespace MinecraftClient.Mapping.BlockPalettes +{ + public class Palette1193 : BlockPalette + { + private static readonly Dictionary materials = new(); + + static Palette1193() + { + for (int i = 8475; i <= 8498; i++) + materials[i] = Material.AcaciaButton; + for (int i = 11467; i <= 11530; i++) + materials[i] = Material.AcaciaDoor; + for (int i = 11147; i <= 11178; i++) + materials[i] = Material.AcaciaFence; + for (int i = 10923; i <= 10954; i++) + materials[i] = Material.AcaciaFenceGate; + for (int i = 4934; i <= 4997; i++) + materials[i] = Material.AcaciaHangingSign; + for (int i = 326; i <= 353; i++) + materials[i] = Material.AcaciaLeaves; + for (int i = 131; i <= 133; i++) + materials[i] = Material.AcaciaLog; + materials[19] = Material.AcaciaPlanks; + for (int i = 5560; i <= 5561; i++) + materials[i] = Material.AcaciaPressurePlate; + for (int i = 32; i <= 33; i++) + materials[i] = Material.AcaciaSapling; + for (int i = 4346; i <= 4377; i++) + materials[i] = Material.AcaciaSign; + for (int i = 10709; i <= 10714; i++) + materials[i] = Material.AcaciaSlab; + for (int i = 9488; i <= 9567; i++) + materials[i] = Material.AcaciaStairs; + for (int i = 6052; i <= 6115; i++) + materials[i] = Material.AcaciaTrapdoor; + for (int i = 5406; i <= 5413; i++) + materials[i] = Material.AcaciaWallHangingSign; + for (int i = 4702; i <= 4709; i++) + materials[i] = Material.AcaciaWallSign; + for (int i = 184; i <= 186; i++) + materials[i] = Material.AcaciaWood; + for (int i = 8924; i <= 8947; i++) + materials[i] = Material.ActivatorRail; + materials[0] = Material.Air; + materials[2027] = Material.Allium; + materials[20403] = Material.AmethystBlock; + for (int i = 20405; i <= 20416; i++) + materials[i] = Material.AmethystCluster; + materials[18820] = Material.AncientDebris; + materials[6] = Material.Andesite; + for (int i = 13508; i <= 13513; i++) + materials[i] = Material.AndesiteSlab; + for (int i = 13134; i <= 13213; i++) + materials[i] = Material.AndesiteStairs; + for (int i = 16124; i <= 16447; i++) + materials[i] = Material.AndesiteWall; + for (int i = 8711; i <= 8714; i++) + materials[i] = Material.Anvil; + for (int i = 6587; i <= 6590; i++) + materials[i] = Material.AttachedMelonStem; + for (int i = 6583; i <= 6586; i++) + materials[i] = Material.AttachedPumpkinStem; + materials[21498] = Material.Azalea; + for (int i = 410; i <= 437; i++) + materials[i] = Material.AzaleaLeaves; + materials[2028] = Material.AzureBluet; + for (int i = 12317; i <= 12328; i++) + materials[i] = Material.Bamboo; + for (int i = 145; i <= 147; i++) + materials[i] = Material.BambooBlock; + for (int i = 8547; i <= 8570; i++) + materials[i] = Material.BambooButton; + for (int i = 11659; i <= 11722; i++) + materials[i] = Material.BambooDoor; + for (int i = 11243; i <= 11274; i++) + materials[i] = Material.BambooFence; + for (int i = 11019; i <= 11050; i++) + materials[i] = Material.BambooFenceGate; + for (int i = 5318; i <= 5381; i++) + materials[i] = Material.BambooHangingSign; + materials[23] = Material.BambooMosaic; + for (int i = 10733; i <= 10738; i++) + materials[i] = Material.BambooMosaicSlab; + for (int i = 9808; i <= 9887; i++) + materials[i] = Material.BambooMosaicStairs; + materials[22] = Material.BambooPlanks; + for (int i = 5566; i <= 5567; i++) + materials[i] = Material.BambooPressurePlate; + materials[12316] = Material.BambooSapling; + for (int i = 4474; i <= 4505; i++) + materials[i] = Material.BambooSign; + for (int i = 10727; i <= 10732; i++) + materials[i] = Material.BambooSlab; + for (int i = 9728; i <= 9807; i++) + materials[i] = Material.BambooStairs; + for (int i = 6244; i <= 6307; i++) + materials[i] = Material.BambooTrapdoor; + for (int i = 5454; i <= 5461; i++) + materials[i] = Material.BambooWallHangingSign; + for (int i = 4734; i <= 4741; i++) + materials[i] = Material.BambooWallSign; + for (int i = 17780; i <= 17791; i++) + materials[i] = Material.Barrel; + materials[9889] = Material.Barrier; + for (int i = 5687; i <= 5689; i++) + materials[i] = Material.Basalt; + materials[7688] = Material.Beacon; + materials[76] = Material.Bedrock; + for (int i = 18769; i <= 18792; i++) + materials[i] = Material.BeeNest; + for (int i = 18793; i <= 18816; i++) + materials[i] = Material.Beehive; + for (int i = 11884; i <= 11887; i++) + materials[i] = Material.Beetroots; + for (int i = 17843; i <= 17874; i++) + materials[i] = Material.Bell; + for (int i = 21502; i <= 21533; i++) + materials[i] = Material.BigDripleaf; + for (int i = 21534; i <= 21541; i++) + materials[i] = Material.BigDripleafStem; + for (int i = 8427; i <= 8450; i++) + materials[i] = Material.BirchButton; + for (int i = 11339; i <= 11402; i++) + materials[i] = Material.BirchDoor; + for (int i = 11083; i <= 11114; i++) + materials[i] = Material.BirchFence; + for (int i = 10859; i <= 10890; i++) + materials[i] = Material.BirchFenceGate; + for (int i = 4870; i <= 4933; i++) + materials[i] = Material.BirchHangingSign; + for (int i = 270; i <= 297; i++) + materials[i] = Material.BirchLeaves; + for (int i = 125; i <= 127; i++) + materials[i] = Material.BirchLog; + materials[17] = Material.BirchPlanks; + for (int i = 5556; i <= 5557; i++) + materials[i] = Material.BirchPressurePlate; + for (int i = 28; i <= 29; i++) + materials[i] = Material.BirchSapling; + for (int i = 4314; i <= 4345; i++) + materials[i] = Material.BirchSign; + for (int i = 10697; i <= 10702; i++) + materials[i] = Material.BirchSlab; + for (int i = 7516; i <= 7595; i++) + materials[i] = Material.BirchStairs; + for (int i = 5924; i <= 5987; i++) + materials[i] = Material.BirchTrapdoor; + for (int i = 5398; i <= 5405; i++) + materials[i] = Material.BirchWallHangingSign; + for (int i = 4694; i <= 4701; i++) + materials[i] = Material.BirchWallSign; + for (int i = 178; i <= 180; i++) + materials[i] = Material.BirchWood; + for (int i = 10522; i <= 10537; i++) + materials[i] = Material.BlackBanner; + for (int i = 1877; i <= 1892; i++) + materials[i] = Material.BlackBed; + for (int i = 20353; i <= 20368; i++) + materials[i] = Material.BlackCandle; + for (int i = 20401; i <= 20402; i++) + materials[i] = Material.BlackCandleCake; + materials[10266] = Material.BlackCarpet; + materials[12118] = Material.BlackConcrete; + materials[12134] = Material.BlackConcretePowder; + for (int i = 12099; i <= 12102; i++) + materials[i] = Material.BlackGlazedTerracotta; + for (int i = 12033; i <= 12038; i++) + materials[i] = Material.BlackShulkerBox; + materials[5795] = Material.BlackStainedGlass; + for (int i = 9456; i <= 9487; i++) + materials[i] = Material.BlackStainedGlassPane; + materials[8975] = Material.BlackTerracotta; + for (int i = 10598; i <= 10601; i++) + materials[i] = Material.BlackWallBanner; + materials[2011] = Material.BlackWool; + materials[18832] = Material.Blackstone; + for (int i = 19237; i <= 19242; i++) + materials[i] = Material.BlackstoneSlab; + for (int i = 18833; i <= 18912; i++) + materials[i] = Material.BlackstoneStairs; + for (int i = 18913; i <= 19236; i++) + materials[i] = Material.BlackstoneWall; + for (int i = 17800; i <= 17807; i++) + materials[i] = Material.BlastFurnace; + for (int i = 10458; i <= 10473; i++) + materials[i] = Material.BlueBanner; + for (int i = 1813; i <= 1828; i++) + materials[i] = Material.BlueBed; + for (int i = 20289; i <= 20304; i++) + materials[i] = Material.BlueCandle; + for (int i = 20393; i <= 20394; i++) + materials[i] = Material.BlueCandleCake; + materials[10262] = Material.BlueCarpet; + materials[12114] = Material.BlueConcrete; + materials[12130] = Material.BlueConcretePowder; + for (int i = 12083; i <= 12086; i++) + materials[i] = Material.BlueGlazedTerracotta; + materials[12313] = Material.BlueIce; + materials[2026] = Material.BlueOrchid; + for (int i = 12009; i <= 12014; i++) + materials[i] = Material.BlueShulkerBox; + materials[5791] = Material.BlueStainedGlass; + for (int i = 9328; i <= 9359; i++) + materials[i] = Material.BlueStainedGlassPane; + materials[8971] = Material.BlueTerracotta; + for (int i = 10582; i <= 10585; i++) + materials[i] = Material.BlueWallBanner; + materials[2007] = Material.BlueWool; + for (int i = 11921; i <= 11923; i++) + materials[i] = Material.BoneBlock; + materials[2044] = Material.Bookshelf; + for (int i = 12197; i <= 12198; i++) + materials[i] = Material.BrainCoral; + materials[12181] = Material.BrainCoralBlock; + for (int i = 12217; i <= 12218; i++) + materials[i] = Material.BrainCoralFan; + for (int i = 12273; i <= 12280; i++) + materials[i] = Material.BrainCoralWallFan; + for (int i = 7160; i <= 7167; i++) + materials[i] = Material.BrewingStand; + for (int i = 10775; i <= 10780; i++) + materials[i] = Material.BrickSlab; + for (int i = 6799; i <= 6878; i++) + materials[i] = Material.BrickStairs; + for (int i = 13532; i <= 13855; i++) + materials[i] = Material.BrickWall; + materials[2041] = Material.Bricks; + for (int i = 10474; i <= 10489; i++) + materials[i] = Material.BrownBanner; + for (int i = 1829; i <= 1844; i++) + materials[i] = Material.BrownBed; + for (int i = 20305; i <= 20320; i++) + materials[i] = Material.BrownCandle; + for (int i = 20395; i <= 20396; i++) + materials[i] = Material.BrownCandleCake; + materials[10263] = Material.BrownCarpet; + materials[12115] = Material.BrownConcrete; + materials[12131] = Material.BrownConcretePowder; + for (int i = 12087; i <= 12090; i++) + materials[i] = Material.BrownGlazedTerracotta; + materials[2037] = Material.BrownMushroom; + for (int i = 6320; i <= 6383; i++) + materials[i] = Material.BrownMushroomBlock; + for (int i = 12015; i <= 12020; i++) + materials[i] = Material.BrownShulkerBox; + materials[5792] = Material.BrownStainedGlass; + for (int i = 9360; i <= 9391; i++) + materials[i] = Material.BrownStainedGlassPane; + materials[8972] = Material.BrownTerracotta; + for (int i = 10586; i <= 10589; i++) + materials[i] = Material.BrownWallBanner; + materials[2008] = Material.BrownWool; + for (int i = 12332; i <= 12333; i++) + materials[i] = Material.BubbleColumn; + for (int i = 12199; i <= 12200; i++) + materials[i] = Material.BubbleCoral; + materials[12182] = Material.BubbleCoralBlock; + for (int i = 12219; i <= 12220; i++) + materials[i] = Material.BubbleCoralFan; + for (int i = 12281; i <= 12288; i++) + materials[i] = Material.BubbleCoralWallFan; + materials[20404] = Material.BuddingAmethyst; + for (int i = 5616; i <= 5631; i++) + materials[i] = Material.Cactus; + for (int i = 5709; i <= 5715; i++) + materials[i] = Material.Cake; + materials[20454] = Material.Calcite; + for (int i = 17883; i <= 17914; i++) + materials[i] = Material.Campfire; + for (int i = 20097; i <= 20112; i++) + materials[i] = Material.Candle; + for (int i = 20369; i <= 20370; i++) + materials[i] = Material.CandleCake; + for (int i = 8363; i <= 8370; i++) + materials[i] = Material.Carrots; + materials[17808] = Material.CartographyTable; + for (int i = 5701; i <= 5704; i++) + materials[i] = Material.CarvedPumpkin; + materials[7168] = Material.Cauldron; + materials[12331] = Material.CaveAir; + for (int i = 21443; i <= 21494; i++) + materials[i] = Material.CaveVines; + for (int i = 21495; i <= 21496; i++) + materials[i] = Material.CaveVinesPlant; + for (int i = 6544; i <= 6549; i++) + materials[i] = Material.Chain; + for (int i = 11902; i <= 11913; i++) + materials[i] = Material.ChainCommandBlock; + for (int i = 2902; i <= 2925; i++) + materials[i] = Material.Chest; + for (int i = 8715; i <= 8718; i++) + materials[i] = Material.ChippedAnvil; + for (int i = 2045; i <= 2300; i++) + materials[i] = Material.ChiseledBookshelf; + materials[23209] = Material.ChiseledDeepslate; + materials[20094] = Material.ChiseledNetherBricks; + materials[19246] = Material.ChiseledPolishedBlackstone; + materials[8840] = Material.ChiseledQuartzBlock; + materials[10603] = Material.ChiseledRedSandstone; + materials[485] = Material.ChiseledSandstone; + materials[6311] = Material.ChiseledStoneBricks; + for (int i = 11793; i <= 11798; i++) + materials[i] = Material.ChorusFlower; + for (int i = 11729; i <= 11792; i++) + materials[i] = Material.ChorusPlant; + materials[5632] = Material.Clay; + materials[10268] = Material.CoalBlock; + materials[116] = Material.CoalOre; + materials[11] = Material.CoarseDirt; + materials[21565] = Material.CobbledDeepslate; + for (int i = 21646; i <= 21651; i++) + materials[i] = Material.CobbledDeepslateSlab; + for (int i = 21566; i <= 21645; i++) + materials[i] = Material.CobbledDeepslateStairs; + for (int i = 21652; i <= 21975; i++) + materials[i] = Material.CobbledDeepslateWall; + materials[14] = Material.Cobblestone; + for (int i = 10769; i <= 10774; i++) + materials[i] = Material.CobblestoneSlab; + for (int i = 4598; i <= 4677; i++) + materials[i] = Material.CobblestoneStairs; + for (int i = 7689; i <= 8012; i++) + materials[i] = Material.CobblestoneWall; + materials[1953] = Material.Cobweb; + for (int i = 7189; i <= 7200; i++) + materials[i] = Material.Cocoa; + for (int i = 7676; i <= 7687; i++) + materials[i] = Material.CommandBlock; + for (int i = 8779; i <= 8794; i++) + materials[i] = Material.Comparator; + for (int i = 18744; i <= 18752; i++) + materials[i] = Material.Composter; + for (int i = 12314; i <= 12315; i++) + materials[i] = Material.Conduit; + materials[20695] = Material.CopperBlock; + materials[20696] = Material.CopperOre; + materials[2034] = Material.Cornflower; + materials[23210] = Material.CrackedDeepslateBricks; + materials[23211] = Material.CrackedDeepslateTiles; + materials[20095] = Material.CrackedNetherBricks; + materials[19245] = Material.CrackedPolishedBlackstoneBricks; + materials[6310] = Material.CrackedStoneBricks; + materials[4225] = Material.CraftingTable; + for (int i = 8651; i <= 8666; i++) + materials[i] = Material.CreeperHead; + for (int i = 8667; i <= 8670; i++) + materials[i] = Material.CreeperWallHead; + for (int i = 18472; i <= 18495; i++) + materials[i] = Material.CrimsonButton; + for (int i = 18520; i <= 18583; i++) + materials[i] = Material.CrimsonDoor; + for (int i = 18056; i <= 18087; i++) + materials[i] = Material.CrimsonFence; + for (int i = 18248; i <= 18279; i++) + materials[i] = Material.CrimsonFenceGate; + materials[17981] = Material.CrimsonFungus; + for (int i = 5126; i <= 5189; i++) + materials[i] = Material.CrimsonHangingSign; + for (int i = 17974; i <= 17976; i++) + materials[i] = Material.CrimsonHyphae; + materials[17980] = Material.CrimsonNylium; + materials[18038] = Material.CrimsonPlanks; + for (int i = 18052; i <= 18053; i++) + materials[i] = Material.CrimsonPressurePlate; + materials[18037] = Material.CrimsonRoots; + for (int i = 18648; i <= 18679; i++) + materials[i] = Material.CrimsonSign; + for (int i = 18040; i <= 18045; i++) + materials[i] = Material.CrimsonSlab; + for (int i = 18312; i <= 18391; i++) + materials[i] = Material.CrimsonStairs; + for (int i = 17968; i <= 17970; i++) + materials[i] = Material.CrimsonStem; + for (int i = 18120; i <= 18183; i++) + materials[i] = Material.CrimsonTrapdoor; + for (int i = 5438; i <= 5445; i++) + materials[i] = Material.CrimsonWallHangingSign; + for (int i = 18712; i <= 18719; i++) + materials[i] = Material.CrimsonWallSign; + materials[18821] = Material.CryingObsidian; + materials[20701] = Material.CutCopper; + for (int i = 21040; i <= 21045; i++) + materials[i] = Material.CutCopperSlab; + for (int i = 20942; i <= 21021; i++) + materials[i] = Material.CutCopperStairs; + materials[10604] = Material.CutRedSandstone; + for (int i = 10811; i <= 10816; i++) + materials[i] = Material.CutRedSandstoneSlab; + materials[486] = Material.CutSandstone; + for (int i = 10757; i <= 10762; i++) + materials[i] = Material.CutSandstoneSlab; + for (int i = 10426; i <= 10441; i++) + materials[i] = Material.CyanBanner; + for (int i = 1781; i <= 1796; i++) + materials[i] = Material.CyanBed; + for (int i = 20257; i <= 20272; i++) + materials[i] = Material.CyanCandle; + for (int i = 20389; i <= 20390; i++) + materials[i] = Material.CyanCandleCake; + materials[10260] = Material.CyanCarpet; + materials[12112] = Material.CyanConcrete; + materials[12128] = Material.CyanConcretePowder; + for (int i = 12075; i <= 12078; i++) + materials[i] = Material.CyanGlazedTerracotta; + for (int i = 11997; i <= 12002; i++) + materials[i] = Material.CyanShulkerBox; + materials[5789] = Material.CyanStainedGlass; + for (int i = 9264; i <= 9295; i++) + materials[i] = Material.CyanStainedGlassPane; + materials[8969] = Material.CyanTerracotta; + for (int i = 10574; i <= 10577; i++) + materials[i] = Material.CyanWallBanner; + materials[2005] = Material.CyanWool; + for (int i = 8719; i <= 8722; i++) + materials[i] = Material.DamagedAnvil; + materials[2024] = Material.Dandelion; + for (int i = 8499; i <= 8522; i++) + materials[i] = Material.DarkOakButton; + for (int i = 11531; i <= 11594; i++) + materials[i] = Material.DarkOakDoor; + for (int i = 11179; i <= 11210; i++) + materials[i] = Material.DarkOakFence; + for (int i = 10955; i <= 10986; i++) + materials[i] = Material.DarkOakFenceGate; + for (int i = 5062; i <= 5125; i++) + materials[i] = Material.DarkOakHangingSign; + for (int i = 354; i <= 381; i++) + materials[i] = Material.DarkOakLeaves; + for (int i = 134; i <= 136; i++) + materials[i] = Material.DarkOakLog; + materials[20] = Material.DarkOakPlanks; + for (int i = 5562; i <= 5563; i++) + materials[i] = Material.DarkOakPressurePlate; + for (int i = 34; i <= 35; i++) + materials[i] = Material.DarkOakSapling; + for (int i = 4410; i <= 4441; i++) + materials[i] = Material.DarkOakSign; + for (int i = 10715; i <= 10720; i++) + materials[i] = Material.DarkOakSlab; + for (int i = 9568; i <= 9647; i++) + materials[i] = Material.DarkOakStairs; + for (int i = 6116; i <= 6179; i++) + materials[i] = Material.DarkOakTrapdoor; + for (int i = 5422; i <= 5429; i++) + materials[i] = Material.DarkOakWallHangingSign; + for (int i = 4718; i <= 4725; i++) + materials[i] = Material.DarkOakWallSign; + for (int i = 187; i <= 189; i++) + materials[i] = Material.DarkOakWood; + materials[9988] = Material.DarkPrismarine; + for (int i = 10241; i <= 10246; i++) + materials[i] = Material.DarkPrismarineSlab; + for (int i = 10149; i <= 10228; i++) + materials[i] = Material.DarkPrismarineStairs; + for (int i = 8795; i <= 8826; i++) + materials[i] = Material.DaylightDetector; + for (int i = 12187; i <= 12188; i++) + materials[i] = Material.DeadBrainCoral; + materials[12176] = Material.DeadBrainCoralBlock; + for (int i = 12207; i <= 12208; i++) + materials[i] = Material.DeadBrainCoralFan; + for (int i = 12233; i <= 12240; i++) + materials[i] = Material.DeadBrainCoralWallFan; + for (int i = 12189; i <= 12190; i++) + materials[i] = Material.DeadBubbleCoral; + materials[12177] = Material.DeadBubbleCoralBlock; + for (int i = 12209; i <= 12210; i++) + materials[i] = Material.DeadBubbleCoralFan; + for (int i = 12241; i <= 12248; i++) + materials[i] = Material.DeadBubbleCoralWallFan; + materials[1956] = Material.DeadBush; + for (int i = 12191; i <= 12192; i++) + materials[i] = Material.DeadFireCoral; + materials[12178] = Material.DeadFireCoralBlock; + for (int i = 12211; i <= 12212; i++) + materials[i] = Material.DeadFireCoralFan; + for (int i = 12249; i <= 12256; i++) + materials[i] = Material.DeadFireCoralWallFan; + for (int i = 12193; i <= 12194; i++) + materials[i] = Material.DeadHornCoral; + materials[12179] = Material.DeadHornCoralBlock; + for (int i = 12213; i <= 12214; i++) + materials[i] = Material.DeadHornCoralFan; + for (int i = 12257; i <= 12264; i++) + materials[i] = Material.DeadHornCoralWallFan; + for (int i = 12185; i <= 12186; i++) + materials[i] = Material.DeadTubeCoral; + materials[12175] = Material.DeadTubeCoralBlock; + for (int i = 12205; i <= 12206; i++) + materials[i] = Material.DeadTubeCoralFan; + for (int i = 12225; i <= 12232; i++) + materials[i] = Material.DeadTubeCoralWallFan; + for (int i = 21562; i <= 21564; i++) + materials[i] = Material.Deepslate; + for (int i = 22879; i <= 22884; i++) + materials[i] = Material.DeepslateBrickSlab; + for (int i = 22799; i <= 22878; i++) + materials[i] = Material.DeepslateBrickStairs; + for (int i = 22885; i <= 23208; i++) + materials[i] = Material.DeepslateBrickWall; + materials[22798] = Material.DeepslateBricks; + materials[117] = Material.DeepslateCoalOre; + materials[20697] = Material.DeepslateCopperOre; + materials[4223] = Material.DeepslateDiamondOre; + materials[7282] = Material.DeepslateEmeraldOre; + materials[113] = Material.DeepslateGoldOre; + materials[115] = Material.DeepslateIronOre; + materials[470] = Material.DeepslateLapisOre; + for (int i = 5570; i <= 5571; i++) + materials[i] = Material.DeepslateRedstoneOre; + for (int i = 22468; i <= 22473; i++) + materials[i] = Material.DeepslateTileSlab; + for (int i = 22388; i <= 22467; i++) + materials[i] = Material.DeepslateTileStairs; + for (int i = 22474; i <= 22797; i++) + materials[i] = Material.DeepslateTileWall; + materials[22387] = Material.DeepslateTiles; + for (int i = 1917; i <= 1940; i++) + materials[i] = Material.DetectorRail; + materials[4224] = Material.DiamondBlock; + materials[4222] = Material.DiamondOre; + materials[4] = Material.Diorite; + for (int i = 13526; i <= 13531; i++) + materials[i] = Material.DioriteSlab; + for (int i = 13374; i <= 13453; i++) + materials[i] = Material.DioriteStairs; + for (int i = 17420; i <= 17743; i++) + materials[i] = Material.DioriteWall; + materials[10] = Material.Dirt; + materials[11888] = Material.DirtPath; + for (int i = 472; i <= 483; i++) + materials[i] = Material.Dispenser; + materials[7186] = Material.DragonEgg; + for (int i = 8671; i <= 8686; i++) + materials[i] = Material.DragonHead; + for (int i = 8687; i <= 8690; i++) + materials[i] = Material.DragonWallHead; + materials[12162] = Material.DriedKelpBlock; + materials[21442] = Material.DripstoneBlock; + for (int i = 8948; i <= 8959; i++) + materials[i] = Material.Dropper; + materials[7435] = Material.EmeraldBlock; + materials[7281] = Material.EmeraldOre; + materials[7159] = Material.EnchantingTable; + materials[11889] = Material.EndGateway; + materials[7176] = Material.EndPortal; + for (int i = 7177; i <= 7184; i++) + materials[i] = Material.EndPortalFrame; + for (int i = 11723; i <= 11728; i++) + materials[i] = Material.EndRod; + materials[7185] = Material.EndStone; + for (int i = 13484; i <= 13489; i++) + materials[i] = Material.EndStoneBrickSlab; + for (int i = 12734; i <= 12813; i++) + materials[i] = Material.EndStoneBrickStairs; + for (int i = 17096; i <= 17419; i++) + materials[i] = Material.EndStoneBrickWall; + materials[11883] = Material.EndStoneBricks; + for (int i = 7283; i <= 7290; i++) + materials[i] = Material.EnderChest; + materials[20694] = Material.ExposedCopper; + materials[20700] = Material.ExposedCutCopper; + for (int i = 21034; i <= 21039; i++) + materials[i] = Material.ExposedCutCopperSlab; + for (int i = 20862; i <= 20941; i++) + materials[i] = Material.ExposedCutCopperStairs; + for (int i = 4234; i <= 4241; i++) + materials[i] = Material.Farmland; + materials[1955] = Material.Fern; + for (int i = 2308; i <= 2819; i++) + materials[i] = Material.Fire; + for (int i = 12201; i <= 12202; i++) + materials[i] = Material.FireCoral; + materials[12183] = Material.FireCoralBlock; + for (int i = 12221; i <= 12222; i++) + materials[i] = Material.FireCoralFan; + for (int i = 12289; i <= 12296; i++) + materials[i] = Material.FireCoralWallFan; + materials[17809] = Material.FletchingTable; + materials[8337] = Material.FlowerPot; + materials[21499] = Material.FloweringAzalea; + for (int i = 438; i <= 465; i++) + materials[i] = Material.FloweringAzaleaLeaves; + materials[23230] = Material.Frogspawn; + for (int i = 11914; i <= 11917; i++) + materials[i] = Material.FrostedIce; + for (int i = 4242; i <= 4249; i++) + materials[i] = Material.Furnace; + materials[19657] = Material.GildedBlackstone; + materials[468] = Material.Glass; + for (int i = 6550; i <= 6581; i++) + materials[i] = Material.GlassPane; + for (int i = 6639; i <= 6766; i++) + materials[i] = Material.GlowLichen; + materials[5698] = Material.Glowstone; + materials[2039] = Material.GoldBlock; + materials[112] = Material.GoldOre; + materials[2] = Material.Granite; + for (int i = 13502; i <= 13507; i++) + materials[i] = Material.GraniteSlab; + for (int i = 13054; i <= 13133; i++) + materials[i] = Material.GraniteStairs; + for (int i = 14828; i <= 15151; i++) + materials[i] = Material.GraniteWall; + materials[1954] = Material.Grass; + for (int i = 8; i <= 9; i++) + materials[i] = Material.GrassBlock; + materials[111] = Material.Gravel; + for (int i = 10394; i <= 10409; i++) + materials[i] = Material.GrayBanner; + for (int i = 1749; i <= 1764; i++) + materials[i] = Material.GrayBed; + for (int i = 20225; i <= 20240; i++) + materials[i] = Material.GrayCandle; + for (int i = 20385; i <= 20386; i++) + materials[i] = Material.GrayCandleCake; + materials[10258] = Material.GrayCarpet; + materials[12110] = Material.GrayConcrete; + materials[12126] = Material.GrayConcretePowder; + for (int i = 12067; i <= 12070; i++) + materials[i] = Material.GrayGlazedTerracotta; + for (int i = 11985; i <= 11990; i++) + materials[i] = Material.GrayShulkerBox; + materials[5787] = Material.GrayStainedGlass; + for (int i = 9200; i <= 9231; i++) + materials[i] = Material.GrayStainedGlassPane; + materials[8967] = Material.GrayTerracotta; + for (int i = 10566; i <= 10569; i++) + materials[i] = Material.GrayWallBanner; + materials[2003] = Material.GrayWool; + for (int i = 10490; i <= 10505; i++) + materials[i] = Material.GreenBanner; + for (int i = 1845; i <= 1860; i++) + materials[i] = Material.GreenBed; + for (int i = 20321; i <= 20336; i++) + materials[i] = Material.GreenCandle; + for (int i = 20397; i <= 20398; i++) + materials[i] = Material.GreenCandleCake; + materials[10264] = Material.GreenCarpet; + materials[12116] = Material.GreenConcrete; + materials[12132] = Material.GreenConcretePowder; + for (int i = 12091; i <= 12094; i++) + materials[i] = Material.GreenGlazedTerracotta; + for (int i = 12021; i <= 12026; i++) + materials[i] = Material.GreenShulkerBox; + materials[5793] = Material.GreenStainedGlass; + for (int i = 9392; i <= 9423; i++) + materials[i] = Material.GreenStainedGlassPane; + materials[8973] = Material.GreenTerracotta; + for (int i = 10590; i <= 10593; i++) + materials[i] = Material.GreenWallBanner; + materials[2009] = Material.GreenWool; + for (int i = 17810; i <= 17821; i++) + materials[i] = Material.Grindstone; + for (int i = 21558; i <= 21559; i++) + materials[i] = Material.HangingRoots; + for (int i = 10248; i <= 10250; i++) + materials[i] = Material.HayBlock; + for (int i = 8763; i <= 8778; i++) + materials[i] = Material.HeavyWeightedPressurePlate; + materials[18817] = Material.HoneyBlock; + materials[18818] = Material.HoneycombBlock; + for (int i = 8829; i <= 8838; i++) + materials[i] = Material.Hopper; + for (int i = 12203; i <= 12204; i++) + materials[i] = Material.HornCoral; + materials[12184] = Material.HornCoralBlock; + for (int i = 12223; i <= 12224; i++) + materials[i] = Material.HornCoralFan; + for (int i = 12297; i <= 12304; i++) + materials[i] = Material.HornCoralWallFan; + materials[5614] = Material.Ice; + materials[6319] = Material.InfestedChiseledStoneBricks; + materials[6315] = Material.InfestedCobblestone; + materials[6318] = Material.InfestedCrackedStoneBricks; + for (int i = 23212; i <= 23214; i++) + materials[i] = Material.InfestedDeepslate; + materials[6317] = Material.InfestedMossyStoneBricks; + materials[6314] = Material.InfestedStone; + materials[6316] = Material.InfestedStoneBricks; + for (int i = 6512; i <= 6543; i++) + materials[i] = Material.IronBars; + materials[2040] = Material.IronBlock; + for (int i = 5488; i <= 5551; i++) + materials[i] = Material.IronDoor; + materials[114] = Material.IronOre; + for (int i = 9922; i <= 9985; i++) + materials[i] = Material.IronTrapdoor; + for (int i = 5705; i <= 5708; i++) + materials[i] = Material.JackOLantern; + for (int i = 18732; i <= 18743; i++) + materials[i] = Material.Jigsaw; + for (int i = 5649; i <= 5650; i++) + materials[i] = Material.Jukebox; + for (int i = 8451; i <= 8474; i++) + materials[i] = Material.JungleButton; + for (int i = 11403; i <= 11466; i++) + materials[i] = Material.JungleDoor; + for (int i = 11115; i <= 11146; i++) + materials[i] = Material.JungleFence; + for (int i = 10891; i <= 10922; i++) + materials[i] = Material.JungleFenceGate; + for (int i = 4998; i <= 5061; i++) + materials[i] = Material.JungleHangingSign; + for (int i = 298; i <= 325; i++) + materials[i] = Material.JungleLeaves; + for (int i = 128; i <= 130; i++) + materials[i] = Material.JungleLog; + materials[18] = Material.JunglePlanks; + for (int i = 5558; i <= 5559; i++) + materials[i] = Material.JunglePressurePlate; + for (int i = 30; i <= 31; i++) + materials[i] = Material.JungleSapling; + for (int i = 4378; i <= 4409; i++) + materials[i] = Material.JungleSign; + for (int i = 10703; i <= 10708; i++) + materials[i] = Material.JungleSlab; + for (int i = 7596; i <= 7675; i++) + materials[i] = Material.JungleStairs; + for (int i = 5988; i <= 6051; i++) + materials[i] = Material.JungleTrapdoor; + for (int i = 5414; i <= 5421; i++) + materials[i] = Material.JungleWallHangingSign; + for (int i = 4710; i <= 4717; i++) + materials[i] = Material.JungleWallSign; + for (int i = 181; i <= 183; i++) + materials[i] = Material.JungleWood; + for (int i = 12135; i <= 12160; i++) + materials[i] = Material.Kelp; + materials[12161] = Material.KelpPlant; + for (int i = 4570; i <= 4577; i++) + materials[i] = Material.Ladder; + for (int i = 17875; i <= 17878; i++) + materials[i] = Material.Lantern; + materials[471] = Material.LapisBlock; + materials[469] = Material.LapisOre; + for (int i = 20417; i <= 20428; i++) + materials[i] = Material.LargeAmethystBud; + for (int i = 10280; i <= 10281; i++) + materials[i] = Material.LargeFern; + for (int i = 93; i <= 108; i++) + materials[i] = Material.Lava; + materials[7172] = Material.LavaCauldron; + for (int i = 17822; i <= 17837; i++) + materials[i] = Material.Lectern; + for (int i = 5462; i <= 5485; i++) + materials[i] = Material.Lever; + for (int i = 9890; i <= 9921; i++) + materials[i] = Material.Light; + for (int i = 10330; i <= 10345; i++) + materials[i] = Material.LightBlueBanner; + for (int i = 1685; i <= 1700; i++) + materials[i] = Material.LightBlueBed; + for (int i = 20161; i <= 20176; i++) + materials[i] = Material.LightBlueCandle; + for (int i = 20377; i <= 20378; i++) + materials[i] = Material.LightBlueCandleCake; + materials[10254] = Material.LightBlueCarpet; + materials[12106] = Material.LightBlueConcrete; + materials[12122] = Material.LightBlueConcretePowder; + for (int i = 12051; i <= 12054; i++) + materials[i] = Material.LightBlueGlazedTerracotta; + for (int i = 11961; i <= 11966; i++) + materials[i] = Material.LightBlueShulkerBox; + materials[5783] = Material.LightBlueStainedGlass; + for (int i = 9072; i <= 9103; i++) + materials[i] = Material.LightBlueStainedGlassPane; + materials[8963] = Material.LightBlueTerracotta; + for (int i = 10550; i <= 10553; i++) + materials[i] = Material.LightBlueWallBanner; + materials[1999] = Material.LightBlueWool; + for (int i = 10410; i <= 10425; i++) + materials[i] = Material.LightGrayBanner; + for (int i = 1765; i <= 1780; i++) + materials[i] = Material.LightGrayBed; + for (int i = 20241; i <= 20256; i++) + materials[i] = Material.LightGrayCandle; + for (int i = 20387; i <= 20388; i++) + materials[i] = Material.LightGrayCandleCake; + materials[10259] = Material.LightGrayCarpet; + materials[12111] = Material.LightGrayConcrete; + materials[12127] = Material.LightGrayConcretePowder; + for (int i = 12071; i <= 12074; i++) + materials[i] = Material.LightGrayGlazedTerracotta; + for (int i = 11991; i <= 11996; i++) + materials[i] = Material.LightGrayShulkerBox; + materials[5788] = Material.LightGrayStainedGlass; + for (int i = 9232; i <= 9263; i++) + materials[i] = Material.LightGrayStainedGlassPane; + materials[8968] = Material.LightGrayTerracotta; + for (int i = 10570; i <= 10573; i++) + materials[i] = Material.LightGrayWallBanner; + materials[2004] = Material.LightGrayWool; + for (int i = 8747; i <= 8762; i++) + materials[i] = Material.LightWeightedPressurePlate; + for (int i = 21398; i <= 21421; i++) + materials[i] = Material.LightningRod; + for (int i = 10272; i <= 10273; i++) + materials[i] = Material.Lilac; + materials[2036] = Material.LilyOfTheValley; + materials[7041] = Material.LilyPad; + for (int i = 10362; i <= 10377; i++) + materials[i] = Material.LimeBanner; + for (int i = 1717; i <= 1732; i++) + materials[i] = Material.LimeBed; + for (int i = 20193; i <= 20208; i++) + materials[i] = Material.LimeCandle; + for (int i = 20381; i <= 20382; i++) + materials[i] = Material.LimeCandleCake; + materials[10256] = Material.LimeCarpet; + materials[12108] = Material.LimeConcrete; + materials[12124] = Material.LimeConcretePowder; + for (int i = 12059; i <= 12062; i++) + materials[i] = Material.LimeGlazedTerracotta; + for (int i = 11973; i <= 11978; i++) + materials[i] = Material.LimeShulkerBox; + materials[5785] = Material.LimeStainedGlass; + for (int i = 9136; i <= 9167; i++) + materials[i] = Material.LimeStainedGlassPane; + materials[8965] = Material.LimeTerracotta; + for (int i = 10558; i <= 10561; i++) + materials[i] = Material.LimeWallBanner; + materials[2001] = Material.LimeWool; + materials[18831] = Material.Lodestone; + for (int i = 17776; i <= 17779; i++) + materials[i] = Material.Loom; + for (int i = 10314; i <= 10329; i++) + materials[i] = Material.MagentaBanner; + for (int i = 1669; i <= 1684; i++) + materials[i] = Material.MagentaBed; + for (int i = 20145; i <= 20160; i++) + materials[i] = Material.MagentaCandle; + for (int i = 20375; i <= 20376; i++) + materials[i] = Material.MagentaCandleCake; + materials[10253] = Material.MagentaCarpet; + materials[12105] = Material.MagentaConcrete; + materials[12121] = Material.MagentaConcretePowder; + for (int i = 12047; i <= 12050; i++) + materials[i] = Material.MagentaGlazedTerracotta; + for (int i = 11955; i <= 11960; i++) + materials[i] = Material.MagentaShulkerBox; + materials[5782] = Material.MagentaStainedGlass; + for (int i = 9040; i <= 9071; i++) + materials[i] = Material.MagentaStainedGlassPane; + materials[8962] = Material.MagentaTerracotta; + for (int i = 10546; i <= 10549; i++) + materials[i] = Material.MagentaWallBanner; + materials[1998] = Material.MagentaWool; + materials[11918] = Material.MagmaBlock; + for (int i = 8523; i <= 8546; i++) + materials[i] = Material.MangroveButton; + for (int i = 11595; i <= 11658; i++) + materials[i] = Material.MangroveDoor; + for (int i = 11211; i <= 11242; i++) + materials[i] = Material.MangroveFence; + for (int i = 10987; i <= 11018; i++) + materials[i] = Material.MangroveFenceGate; + for (int i = 5254; i <= 5317; i++) + materials[i] = Material.MangroveHangingSign; + for (int i = 382; i <= 409; i++) + materials[i] = Material.MangroveLeaves; + for (int i = 137; i <= 139; i++) + materials[i] = Material.MangroveLog; + materials[21] = Material.MangrovePlanks; + for (int i = 5564; i <= 5565; i++) + materials[i] = Material.MangrovePressurePlate; + for (int i = 36; i <= 75; i++) + materials[i] = Material.MangrovePropagule; + for (int i = 140; i <= 141; i++) + materials[i] = Material.MangroveRoots; + for (int i = 4442; i <= 4473; i++) + materials[i] = Material.MangroveSign; + for (int i = 10721; i <= 10726; i++) + materials[i] = Material.MangroveSlab; + for (int i = 9648; i <= 9727; i++) + materials[i] = Material.MangroveStairs; + for (int i = 6180; i <= 6243; i++) + materials[i] = Material.MangroveTrapdoor; + for (int i = 5430; i <= 5437; i++) + materials[i] = Material.MangroveWallHangingSign; + for (int i = 4726; i <= 4733; i++) + materials[i] = Material.MangroveWallSign; + for (int i = 190; i <= 192; i++) + materials[i] = Material.MangroveWood; + for (int i = 20429; i <= 20440; i++) + materials[i] = Material.MediumAmethystBud; + materials[6582] = Material.Melon; + for (int i = 6599; i <= 6606; i++) + materials[i] = Material.MelonStem; + materials[21501] = Material.MossBlock; + materials[21500] = Material.MossCarpet; + materials[2301] = Material.MossyCobblestone; + for (int i = 13478; i <= 13483; i++) + materials[i] = Material.MossyCobblestoneSlab; + for (int i = 12654; i <= 12733; i++) + materials[i] = Material.MossyCobblestoneStairs; + for (int i = 8013; i <= 8336; i++) + materials[i] = Material.MossyCobblestoneWall; + for (int i = 13466; i <= 13471; i++) + materials[i] = Material.MossyStoneBrickSlab; + for (int i = 12494; i <= 12573; i++) + materials[i] = Material.MossyStoneBrickStairs; + for (int i = 14504; i <= 14827; i++) + materials[i] = Material.MossyStoneBrickWall; + materials[6309] = Material.MossyStoneBricks; + for (int i = 2012; i <= 2023; i++) + materials[i] = Material.MovingPiston; + materials[21561] = Material.Mud; + for (int i = 10787; i <= 10792; i++) + materials[i] = Material.MudBrickSlab; + for (int i = 6959; i <= 7038; i++) + materials[i] = Material.MudBrickStairs; + for (int i = 15476; i <= 15799; i++) + materials[i] = Material.MudBrickWall; + materials[6313] = Material.MudBricks; + for (int i = 142; i <= 144; i++) + materials[i] = Material.MuddyMangroveRoots; + for (int i = 6448; i <= 6511; i++) + materials[i] = Material.MushroomStem; + for (int i = 7039; i <= 7040; i++) + materials[i] = Material.Mycelium; + for (int i = 7043; i <= 7074; i++) + materials[i] = Material.NetherBrickFence; + for (int i = 10793; i <= 10798; i++) + materials[i] = Material.NetherBrickSlab; + for (int i = 7075; i <= 7154; i++) + materials[i] = Material.NetherBrickStairs; + for (int i = 15800; i <= 16123; i++) + materials[i] = Material.NetherBrickWall; + materials[7042] = Material.NetherBricks; + materials[118] = Material.NetherGoldOre; + for (int i = 5699; i <= 5700; i++) + materials[i] = Material.NetherPortal; + materials[8828] = Material.NetherQuartzOre; + materials[17967] = Material.NetherSprouts; + for (int i = 7155; i <= 7158; i++) + materials[i] = Material.NetherWart; + materials[11919] = Material.NetherWartBlock; + materials[18819] = Material.NetheriteBlock; + materials[5684] = Material.Netherrack; + for (int i = 487; i <= 1636; i++) + materials[i] = Material.NoteBlock; + for (int i = 8379; i <= 8402; i++) + materials[i] = Material.OakButton; + for (int i = 4506; i <= 4569; i++) + materials[i] = Material.OakDoor; + for (int i = 5651; i <= 5682; i++) + materials[i] = Material.OakFence; + for (int i = 6767; i <= 6798; i++) + materials[i] = Material.OakFenceGate; + for (int i = 4742; i <= 4805; i++) + materials[i] = Material.OakHangingSign; + for (int i = 214; i <= 241; i++) + materials[i] = Material.OakLeaves; + for (int i = 119; i <= 121; i++) + materials[i] = Material.OakLog; + materials[15] = Material.OakPlanks; + for (int i = 5552; i <= 5553; i++) + materials[i] = Material.OakPressurePlate; + for (int i = 24; i <= 25; i++) + materials[i] = Material.OakSapling; + for (int i = 4250; i <= 4281; i++) + materials[i] = Material.OakSign; + for (int i = 10685; i <= 10690; i++) + materials[i] = Material.OakSlab; + for (int i = 2822; i <= 2901; i++) + materials[i] = Material.OakStairs; + for (int i = 5796; i <= 5859; i++) + materials[i] = Material.OakTrapdoor; + for (int i = 5382; i <= 5389; i++) + materials[i] = Material.OakWallHangingSign; + for (int i = 4678; i <= 4685; i++) + materials[i] = Material.OakWallSign; + for (int i = 172; i <= 174; i++) + materials[i] = Material.OakWood; + for (int i = 11925; i <= 11936; i++) + materials[i] = Material.Observer; + materials[2302] = Material.Obsidian; + for (int i = 23221; i <= 23223; i++) + materials[i] = Material.OchreFroglight; + for (int i = 10298; i <= 10313; i++) + materials[i] = Material.OrangeBanner; + for (int i = 1653; i <= 1668; i++) + materials[i] = Material.OrangeBed; + for (int i = 20129; i <= 20144; i++) + materials[i] = Material.OrangeCandle; + for (int i = 20373; i <= 20374; i++) + materials[i] = Material.OrangeCandleCake; + materials[10252] = Material.OrangeCarpet; + materials[12104] = Material.OrangeConcrete; + materials[12120] = Material.OrangeConcretePowder; + for (int i = 12043; i <= 12046; i++) + materials[i] = Material.OrangeGlazedTerracotta; + for (int i = 11949; i <= 11954; i++) + materials[i] = Material.OrangeShulkerBox; + materials[5781] = Material.OrangeStainedGlass; + for (int i = 9008; i <= 9039; i++) + materials[i] = Material.OrangeStainedGlassPane; + materials[8961] = Material.OrangeTerracotta; + materials[2030] = Material.OrangeTulip; + for (int i = 10542; i <= 10545; i++) + materials[i] = Material.OrangeWallBanner; + materials[1997] = Material.OrangeWool; + materials[2033] = Material.OxeyeDaisy; + materials[20692] = Material.OxidizedCopper; + materials[20698] = Material.OxidizedCutCopper; + for (int i = 21022; i <= 21027; i++) + materials[i] = Material.OxidizedCutCopperSlab; + for (int i = 20702; i <= 20781; i++) + materials[i] = Material.OxidizedCutCopperStairs; + materials[10269] = Material.PackedIce; + materials[6312] = Material.PackedMud; + for (int i = 23227; i <= 23229; i++) + materials[i] = Material.PearlescentFroglight; + for (int i = 10276; i <= 10277; i++) + materials[i] = Material.Peony; + for (int i = 10763; i <= 10768; i++) + materials[i] = Material.PetrifiedOakSlab; + for (int i = 8691; i <= 8706; i++) + materials[i] = Material.PiglinHead; + for (int i = 8707; i <= 8710; i++) + materials[i] = Material.PiglinWallHead; + for (int i = 10378; i <= 10393; i++) + materials[i] = Material.PinkBanner; + for (int i = 1733; i <= 1748; i++) + materials[i] = Material.PinkBed; + for (int i = 20209; i <= 20224; i++) + materials[i] = Material.PinkCandle; + for (int i = 20383; i <= 20384; i++) + materials[i] = Material.PinkCandleCake; + materials[10257] = Material.PinkCarpet; + materials[12109] = Material.PinkConcrete; + materials[12125] = Material.PinkConcretePowder; + for (int i = 12063; i <= 12066; i++) + materials[i] = Material.PinkGlazedTerracotta; + for (int i = 11979; i <= 11984; i++) + materials[i] = Material.PinkShulkerBox; + materials[5786] = Material.PinkStainedGlass; + for (int i = 9168; i <= 9199; i++) + materials[i] = Material.PinkStainedGlassPane; + materials[8966] = Material.PinkTerracotta; + materials[2032] = Material.PinkTulip; + for (int i = 10562; i <= 10565; i++) + materials[i] = Material.PinkWallBanner; + materials[2002] = Material.PinkWool; + for (int i = 1960; i <= 1971; i++) + materials[i] = Material.Piston; + for (int i = 1972; i <= 1995; i++) + materials[i] = Material.PistonHead; + for (int i = 8631; i <= 8646; i++) + materials[i] = Material.PlayerHead; + for (int i = 8647; i <= 8650; i++) + materials[i] = Material.PlayerWallHead; + for (int i = 12; i <= 13; i++) + materials[i] = Material.Podzol; + for (int i = 21422; i <= 21441; i++) + materials[i] = Material.PointedDripstone; + materials[7] = Material.PolishedAndesite; + for (int i = 13520; i <= 13525; i++) + materials[i] = Material.PolishedAndesiteSlab; + for (int i = 13294; i <= 13373; i++) + materials[i] = Material.PolishedAndesiteStairs; + for (int i = 5690; i <= 5692; i++) + materials[i] = Material.PolishedBasalt; + materials[19243] = Material.PolishedBlackstone; + for (int i = 19247; i <= 19252; i++) + materials[i] = Material.PolishedBlackstoneBrickSlab; + for (int i = 19253; i <= 19332; i++) + materials[i] = Material.PolishedBlackstoneBrickStairs; + for (int i = 19333; i <= 19656; i++) + materials[i] = Material.PolishedBlackstoneBrickWall; + materials[19244] = Material.PolishedBlackstoneBricks; + for (int i = 19746; i <= 19769; i++) + materials[i] = Material.PolishedBlackstoneButton; + for (int i = 19744; i <= 19745; i++) + materials[i] = Material.PolishedBlackstonePressurePlate; + for (int i = 19738; i <= 19743; i++) + materials[i] = Material.PolishedBlackstoneSlab; + for (int i = 19658; i <= 19737; i++) + materials[i] = Material.PolishedBlackstoneStairs; + for (int i = 19770; i <= 20093; i++) + materials[i] = Material.PolishedBlackstoneWall; + materials[21976] = Material.PolishedDeepslate; + for (int i = 22057; i <= 22062; i++) + materials[i] = Material.PolishedDeepslateSlab; + for (int i = 21977; i <= 22056; i++) + materials[i] = Material.PolishedDeepslateStairs; + for (int i = 22063; i <= 22386; i++) + materials[i] = Material.PolishedDeepslateWall; + materials[5] = Material.PolishedDiorite; + for (int i = 13472; i <= 13477; i++) + materials[i] = Material.PolishedDioriteSlab; + for (int i = 12574; i <= 12653; i++) + materials[i] = Material.PolishedDioriteStairs; + materials[3] = Material.PolishedGranite; + for (int i = 13454; i <= 13459; i++) + materials[i] = Material.PolishedGraniteSlab; + for (int i = 12334; i <= 12413; i++) + materials[i] = Material.PolishedGraniteStairs; + materials[2025] = Material.Poppy; + for (int i = 8371; i <= 8378; i++) + materials[i] = Material.Potatoes; + materials[8342] = Material.PottedAcaciaSapling; + materials[8349] = Material.PottedAllium; + materials[23219] = Material.PottedAzaleaBush; + materials[8350] = Material.PottedAzureBluet; + materials[12329] = Material.PottedBamboo; + materials[8340] = Material.PottedBirchSapling; + materials[8348] = Material.PottedBlueOrchid; + materials[8360] = Material.PottedBrownMushroom; + materials[8362] = Material.PottedCactus; + materials[8356] = Material.PottedCornflower; + materials[18827] = Material.PottedCrimsonFungus; + materials[18829] = Material.PottedCrimsonRoots; + materials[8346] = Material.PottedDandelion; + materials[8343] = Material.PottedDarkOakSapling; + materials[8361] = Material.PottedDeadBush; + materials[8345] = Material.PottedFern; + materials[23220] = Material.PottedFloweringAzaleaBush; + materials[8341] = Material.PottedJungleSapling; + materials[8357] = Material.PottedLilyOfTheValley; + materials[8344] = Material.PottedMangrovePropagule; + materials[8338] = Material.PottedOakSapling; + materials[8352] = Material.PottedOrangeTulip; + materials[8355] = Material.PottedOxeyeDaisy; + materials[8354] = Material.PottedPinkTulip; + materials[8347] = Material.PottedPoppy; + materials[8359] = Material.PottedRedMushroom; + materials[8351] = Material.PottedRedTulip; + materials[8339] = Material.PottedSpruceSapling; + materials[18828] = Material.PottedWarpedFungus; + materials[18830] = Material.PottedWarpedRoots; + materials[8353] = Material.PottedWhiteTulip; + materials[8358] = Material.PottedWitherRose; + materials[20456] = Material.PowderSnow; + for (int i = 7173; i <= 7175; i++) + materials[i] = Material.PowderSnowCauldron; + for (int i = 1893; i <= 1916; i++) + materials[i] = Material.PoweredRail; + materials[9986] = Material.Prismarine; + for (int i = 10235; i <= 10240; i++) + materials[i] = Material.PrismarineBrickSlab; + for (int i = 10069; i <= 10148; i++) + materials[i] = Material.PrismarineBrickStairs; + materials[9987] = Material.PrismarineBricks; + for (int i = 10229; i <= 10234; i++) + materials[i] = Material.PrismarineSlab; + for (int i = 9989; i <= 10068; i++) + materials[i] = Material.PrismarineStairs; + for (int i = 13856; i <= 14179; i++) + materials[i] = Material.PrismarineWall; + materials[5683] = Material.Pumpkin; + for (int i = 6591; i <= 6598; i++) + materials[i] = Material.PumpkinStem; + for (int i = 10442; i <= 10457; i++) + materials[i] = Material.PurpleBanner; + for (int i = 1797; i <= 1812; i++) + materials[i] = Material.PurpleBed; + for (int i = 20273; i <= 20288; i++) + materials[i] = Material.PurpleCandle; + for (int i = 20391; i <= 20392; i++) + materials[i] = Material.PurpleCandleCake; + materials[10261] = Material.PurpleCarpet; + materials[12113] = Material.PurpleConcrete; + materials[12129] = Material.PurpleConcretePowder; + for (int i = 12079; i <= 12082; i++) + materials[i] = Material.PurpleGlazedTerracotta; + for (int i = 12003; i <= 12008; i++) + materials[i] = Material.PurpleShulkerBox; + materials[5790] = Material.PurpleStainedGlass; + for (int i = 9296; i <= 9327; i++) + materials[i] = Material.PurpleStainedGlassPane; + materials[8970] = Material.PurpleTerracotta; + for (int i = 10578; i <= 10581; i++) + materials[i] = Material.PurpleWallBanner; + materials[2006] = Material.PurpleWool; + materials[11799] = Material.PurpurBlock; + for (int i = 11800; i <= 11802; i++) + materials[i] = Material.PurpurPillar; + for (int i = 10817; i <= 10822; i++) + materials[i] = Material.PurpurSlab; + for (int i = 11803; i <= 11882; i++) + materials[i] = Material.PurpurStairs; + materials[8839] = Material.QuartzBlock; + materials[20096] = Material.QuartzBricks; + for (int i = 8841; i <= 8843; i++) + materials[i] = Material.QuartzPillar; + for (int i = 10799; i <= 10804; i++) + materials[i] = Material.QuartzSlab; + for (int i = 8844; i <= 8923; i++) + materials[i] = Material.QuartzStairs; + for (int i = 4578; i <= 4597; i++) + materials[i] = Material.Rail; + materials[23217] = Material.RawCopperBlock; + materials[23218] = Material.RawGoldBlock; + materials[23216] = Material.RawIronBlock; + for (int i = 10506; i <= 10521; i++) + materials[i] = Material.RedBanner; + for (int i = 1861; i <= 1876; i++) + materials[i] = Material.RedBed; + for (int i = 20337; i <= 20352; i++) + materials[i] = Material.RedCandle; + for (int i = 20399; i <= 20400; i++) + materials[i] = Material.RedCandleCake; + materials[10265] = Material.RedCarpet; + materials[12117] = Material.RedConcrete; + materials[12133] = Material.RedConcretePowder; + for (int i = 12095; i <= 12098; i++) + materials[i] = Material.RedGlazedTerracotta; + materials[2038] = Material.RedMushroom; + for (int i = 6384; i <= 6447; i++) + materials[i] = Material.RedMushroomBlock; + for (int i = 13514; i <= 13519; i++) + materials[i] = Material.RedNetherBrickSlab; + for (int i = 13214; i <= 13293; i++) + materials[i] = Material.RedNetherBrickStairs; + for (int i = 16448; i <= 16771; i++) + materials[i] = Material.RedNetherBrickWall; + materials[11920] = Material.RedNetherBricks; + materials[110] = Material.RedSand; + materials[10602] = Material.RedSandstone; + for (int i = 10805; i <= 10810; i++) + materials[i] = Material.RedSandstoneSlab; + for (int i = 10605; i <= 10684; i++) + materials[i] = Material.RedSandstoneStairs; + for (int i = 14180; i <= 14503; i++) + materials[i] = Material.RedSandstoneWall; + for (int i = 12027; i <= 12032; i++) + materials[i] = Material.RedShulkerBox; + materials[5794] = Material.RedStainedGlass; + for (int i = 9424; i <= 9455; i++) + materials[i] = Material.RedStainedGlassPane; + materials[8974] = Material.RedTerracotta; + materials[2029] = Material.RedTulip; + for (int i = 10594; i <= 10597; i++) + materials[i] = Material.RedWallBanner; + materials[2010] = Material.RedWool; + materials[8827] = Material.RedstoneBlock; + for (int i = 7187; i <= 7188; i++) + materials[i] = Material.RedstoneLamp; + for (int i = 5568; i <= 5569; i++) + materials[i] = Material.RedstoneOre; + for (int i = 5572; i <= 5573; i++) + materials[i] = Material.RedstoneTorch; + for (int i = 5574; i <= 5581; i++) + materials[i] = Material.RedstoneWallTorch; + for (int i = 2926; i <= 4221; i++) + materials[i] = Material.RedstoneWire; + materials[23231] = Material.ReinforcedDeepslate; + for (int i = 5716; i <= 5779; i++) + materials[i] = Material.Repeater; + for (int i = 11890; i <= 11901; i++) + materials[i] = Material.RepeatingCommandBlock; + for (int i = 18822; i <= 18826; i++) + materials[i] = Material.RespawnAnchor; + materials[21560] = Material.RootedDirt; + for (int i = 10274; i <= 10275; i++) + materials[i] = Material.RoseBush; + materials[109] = Material.Sand; + materials[484] = Material.Sandstone; + for (int i = 10751; i <= 10756; i++) + materials[i] = Material.SandstoneSlab; + for (int i = 7201; i <= 7280; i++) + materials[i] = Material.SandstoneStairs; + for (int i = 16772; i <= 17095; i++) + materials[i] = Material.SandstoneWall; + for (int i = 17744; i <= 17775; i++) + materials[i] = Material.Scaffolding; + materials[20553] = Material.Sculk; + for (int i = 20682; i <= 20683; i++) + materials[i] = Material.SculkCatalyst; + for (int i = 20457; i <= 20552; i++) + materials[i] = Material.SculkSensor; + for (int i = 20684; i <= 20691; i++) + materials[i] = Material.SculkShrieker; + for (int i = 20554; i <= 20681; i++) + materials[i] = Material.SculkVein; + materials[10247] = Material.SeaLantern; + for (int i = 12305; i <= 12312; i++) + materials[i] = Material.SeaPickle; + materials[1957] = Material.Seagrass; + materials[17982] = Material.Shroomlight; + for (int i = 11937; i <= 11942; i++) + materials[i] = Material.ShulkerBox; + for (int i = 8571; i <= 8586; i++) + materials[i] = Material.SkeletonSkull; + for (int i = 8587; i <= 8590; i++) + materials[i] = Material.SkeletonWallSkull; + materials[9888] = Material.SlimeBlock; + for (int i = 20441; i <= 20452; i++) + materials[i] = Material.SmallAmethystBud; + for (int i = 21542; i <= 21557; i++) + materials[i] = Material.SmallDripleaf; + materials[17838] = Material.SmithingTable; + for (int i = 17792; i <= 17799; i++) + materials[i] = Material.Smoker; + materials[23215] = Material.SmoothBasalt; + materials[10825] = Material.SmoothQuartz; + for (int i = 13496; i <= 13501; i++) + materials[i] = Material.SmoothQuartzSlab; + for (int i = 12974; i <= 13053; i++) + materials[i] = Material.SmoothQuartzStairs; + materials[10826] = Material.SmoothRedSandstone; + for (int i = 13460; i <= 13465; i++) + materials[i] = Material.SmoothRedSandstoneSlab; + for (int i = 12414; i <= 12493; i++) + materials[i] = Material.SmoothRedSandstoneStairs; + materials[10824] = Material.SmoothSandstone; + for (int i = 13490; i <= 13495; i++) + materials[i] = Material.SmoothSandstoneSlab; + for (int i = 12894; i <= 12973; i++) + materials[i] = Material.SmoothSandstoneStairs; + materials[10823] = Material.SmoothStone; + for (int i = 10745; i <= 10750; i++) + materials[i] = Material.SmoothStoneSlab; + for (int i = 5606; i <= 5613; i++) + materials[i] = Material.Snow; + materials[5615] = Material.SnowBlock; + for (int i = 17915; i <= 17946; i++) + materials[i] = Material.SoulCampfire; + materials[2820] = Material.SoulFire; + for (int i = 17879; i <= 17882; i++) + materials[i] = Material.SoulLantern; + materials[5685] = Material.SoulSand; + materials[5686] = Material.SoulSoil; + materials[5693] = Material.SoulTorch; + for (int i = 5694; i <= 5697; i++) + materials[i] = Material.SoulWallTorch; + materials[2821] = Material.Spawner; + materials[466] = Material.Sponge; + materials[21497] = Material.SporeBlossom; + for (int i = 8403; i <= 8426; i++) + materials[i] = Material.SpruceButton; + for (int i = 11275; i <= 11338; i++) + materials[i] = Material.SpruceDoor; + for (int i = 11051; i <= 11082; i++) + materials[i] = Material.SpruceFence; + for (int i = 10827; i <= 10858; i++) + materials[i] = Material.SpruceFenceGate; + for (int i = 4806; i <= 4869; i++) + materials[i] = Material.SpruceHangingSign; + for (int i = 242; i <= 269; i++) + materials[i] = Material.SpruceLeaves; + for (int i = 122; i <= 124; i++) + materials[i] = Material.SpruceLog; + materials[16] = Material.SprucePlanks; + for (int i = 5554; i <= 5555; i++) + materials[i] = Material.SprucePressurePlate; + for (int i = 26; i <= 27; i++) + materials[i] = Material.SpruceSapling; + for (int i = 4282; i <= 4313; i++) + materials[i] = Material.SpruceSign; + for (int i = 10691; i <= 10696; i++) + materials[i] = Material.SpruceSlab; + for (int i = 7436; i <= 7515; i++) + materials[i] = Material.SpruceStairs; + for (int i = 5860; i <= 5923; i++) + materials[i] = Material.SpruceTrapdoor; + for (int i = 5390; i <= 5397; i++) + materials[i] = Material.SpruceWallHangingSign; + for (int i = 4686; i <= 4693; i++) + materials[i] = Material.SpruceWallSign; + for (int i = 175; i <= 177; i++) + materials[i] = Material.SpruceWood; + for (int i = 1941; i <= 1952; i++) + materials[i] = Material.StickyPiston; + materials[1] = Material.Stone; + for (int i = 10781; i <= 10786; i++) + materials[i] = Material.StoneBrickSlab; + for (int i = 6879; i <= 6958; i++) + materials[i] = Material.StoneBrickStairs; + for (int i = 15152; i <= 15475; i++) + materials[i] = Material.StoneBrickWall; + materials[6308] = Material.StoneBricks; + for (int i = 5582; i <= 5605; i++) + materials[i] = Material.StoneButton; + for (int i = 5486; i <= 5487; i++) + materials[i] = Material.StonePressurePlate; + for (int i = 10739; i <= 10744; i++) + materials[i] = Material.StoneSlab; + for (int i = 12814; i <= 12893; i++) + materials[i] = Material.StoneStairs; + for (int i = 17839; i <= 17842; i++) + materials[i] = Material.Stonecutter; + for (int i = 157; i <= 159; i++) + materials[i] = Material.StrippedAcaciaLog; + for (int i = 205; i <= 207; i++) + materials[i] = Material.StrippedAcaciaWood; + for (int i = 169; i <= 171; i++) + materials[i] = Material.StrippedBambooBlock; + for (int i = 151; i <= 153; i++) + materials[i] = Material.StrippedBirchLog; + for (int i = 199; i <= 201; i++) + materials[i] = Material.StrippedBirchWood; + for (int i = 17977; i <= 17979; i++) + materials[i] = Material.StrippedCrimsonHyphae; + for (int i = 17971; i <= 17973; i++) + materials[i] = Material.StrippedCrimsonStem; + for (int i = 160; i <= 162; i++) + materials[i] = Material.StrippedDarkOakLog; + for (int i = 208; i <= 210; i++) + materials[i] = Material.StrippedDarkOakWood; + for (int i = 154; i <= 156; i++) + materials[i] = Material.StrippedJungleLog; + for (int i = 202; i <= 204; i++) + materials[i] = Material.StrippedJungleWood; + for (int i = 166; i <= 168; i++) + materials[i] = Material.StrippedMangroveLog; + for (int i = 211; i <= 213; i++) + materials[i] = Material.StrippedMangroveWood; + for (int i = 163; i <= 165; i++) + materials[i] = Material.StrippedOakLog; + for (int i = 193; i <= 195; i++) + materials[i] = Material.StrippedOakWood; + for (int i = 148; i <= 150; i++) + materials[i] = Material.StrippedSpruceLog; + for (int i = 196; i <= 198; i++) + materials[i] = Material.StrippedSpruceWood; + for (int i = 17960; i <= 17962; i++) + materials[i] = Material.StrippedWarpedHyphae; + for (int i = 17954; i <= 17956; i++) + materials[i] = Material.StrippedWarpedStem; + for (int i = 18728; i <= 18731; i++) + materials[i] = Material.StructureBlock; + materials[11924] = Material.StructureVoid; + for (int i = 5633; i <= 5648; i++) + materials[i] = Material.SugarCane; + for (int i = 10270; i <= 10271; i++) + materials[i] = Material.Sunflower; + for (int i = 17947; i <= 17950; i++) + materials[i] = Material.SweetBerryBush; + for (int i = 10278; i <= 10279; i++) + materials[i] = Material.TallGrass; + for (int i = 1958; i <= 1959; i++) + materials[i] = Material.TallSeagrass; + for (int i = 18753; i <= 18768; i++) + materials[i] = Material.Target; + materials[10267] = Material.Terracotta; + materials[20455] = Material.TintedGlass; + for (int i = 2042; i <= 2043; i++) + materials[i] = Material.Tnt; + materials[2303] = Material.Torch; + for (int i = 8723; i <= 8746; i++) + materials[i] = Material.TrappedChest; + for (int i = 7307; i <= 7434; i++) + materials[i] = Material.Tripwire; + for (int i = 7291; i <= 7306; i++) + materials[i] = Material.TripwireHook; + for (int i = 12195; i <= 12196; i++) + materials[i] = Material.TubeCoral; + materials[12180] = Material.TubeCoralBlock; + for (int i = 12215; i <= 12216; i++) + materials[i] = Material.TubeCoralFan; + for (int i = 12265; i <= 12272; i++) + materials[i] = Material.TubeCoralWallFan; + materials[20453] = Material.Tuff; + for (int i = 12163; i <= 12174; i++) + materials[i] = Material.TurtleEgg; + for (int i = 18010; i <= 18035; i++) + materials[i] = Material.TwistingVines; + materials[18036] = Material.TwistingVinesPlant; + for (int i = 23224; i <= 23226; i++) + materials[i] = Material.VerdantFroglight; + for (int i = 6607; i <= 6638; i++) + materials[i] = Material.Vine; + materials[12330] = Material.VoidAir; + for (int i = 2304; i <= 2307; i++) + materials[i] = Material.WallTorch; + for (int i = 18496; i <= 18519; i++) + materials[i] = Material.WarpedButton; + for (int i = 18584; i <= 18647; i++) + materials[i] = Material.WarpedDoor; + for (int i = 18088; i <= 18119; i++) + materials[i] = Material.WarpedFence; + for (int i = 18280; i <= 18311; i++) + materials[i] = Material.WarpedFenceGate; + materials[17964] = Material.WarpedFungus; + for (int i = 5190; i <= 5253; i++) + materials[i] = Material.WarpedHangingSign; + for (int i = 17957; i <= 17959; i++) + materials[i] = Material.WarpedHyphae; + materials[17963] = Material.WarpedNylium; + materials[18039] = Material.WarpedPlanks; + for (int i = 18054; i <= 18055; i++) + materials[i] = Material.WarpedPressurePlate; + materials[17966] = Material.WarpedRoots; + for (int i = 18680; i <= 18711; i++) + materials[i] = Material.WarpedSign; + for (int i = 18046; i <= 18051; i++) + materials[i] = Material.WarpedSlab; + for (int i = 18392; i <= 18471; i++) + materials[i] = Material.WarpedStairs; + for (int i = 17951; i <= 17953; i++) + materials[i] = Material.WarpedStem; + for (int i = 18184; i <= 18247; i++) + materials[i] = Material.WarpedTrapdoor; + for (int i = 5446; i <= 5453; i++) + materials[i] = Material.WarpedWallHangingSign; + for (int i = 18720; i <= 18727; i++) + materials[i] = Material.WarpedWallSign; + materials[17965] = Material.WarpedWartBlock; + for (int i = 77; i <= 92; i++) + materials[i] = Material.Water; + for (int i = 7169; i <= 7171; i++) + materials[i] = Material.WaterCauldron; + materials[21046] = Material.WaxedCopperBlock; + materials[21053] = Material.WaxedCutCopper; + for (int i = 21392; i <= 21397; i++) + materials[i] = Material.WaxedCutCopperSlab; + for (int i = 21294; i <= 21373; i++) + materials[i] = Material.WaxedCutCopperStairs; + materials[21048] = Material.WaxedExposedCopper; + materials[21052] = Material.WaxedExposedCutCopper; + for (int i = 21386; i <= 21391; i++) + materials[i] = Material.WaxedExposedCutCopperSlab; + for (int i = 21214; i <= 21293; i++) + materials[i] = Material.WaxedExposedCutCopperStairs; + materials[21049] = Material.WaxedOxidizedCopper; + materials[21050] = Material.WaxedOxidizedCutCopper; + for (int i = 21374; i <= 21379; i++) + materials[i] = Material.WaxedOxidizedCutCopperSlab; + for (int i = 21054; i <= 21133; i++) + materials[i] = Material.WaxedOxidizedCutCopperStairs; + materials[21047] = Material.WaxedWeatheredCopper; + materials[21051] = Material.WaxedWeatheredCutCopper; + for (int i = 21380; i <= 21385; i++) + materials[i] = Material.WaxedWeatheredCutCopperSlab; + for (int i = 21134; i <= 21213; i++) + materials[i] = Material.WaxedWeatheredCutCopperStairs; + materials[20693] = Material.WeatheredCopper; + materials[20699] = Material.WeatheredCutCopper; + for (int i = 21028; i <= 21033; i++) + materials[i] = Material.WeatheredCutCopperSlab; + for (int i = 20782; i <= 20861; i++) + materials[i] = Material.WeatheredCutCopperStairs; + for (int i = 17983; i <= 18008; i++) + materials[i] = Material.WeepingVines; + materials[18009] = Material.WeepingVinesPlant; + materials[467] = Material.WetSponge; + for (int i = 4226; i <= 4233; i++) + materials[i] = Material.Wheat; + for (int i = 10282; i <= 10297; i++) + materials[i] = Material.WhiteBanner; + for (int i = 1637; i <= 1652; i++) + materials[i] = Material.WhiteBed; + for (int i = 20113; i <= 20128; i++) + materials[i] = Material.WhiteCandle; + for (int i = 20371; i <= 20372; i++) + materials[i] = Material.WhiteCandleCake; + materials[10251] = Material.WhiteCarpet; + materials[12103] = Material.WhiteConcrete; + materials[12119] = Material.WhiteConcretePowder; + for (int i = 12039; i <= 12042; i++) + materials[i] = Material.WhiteGlazedTerracotta; + for (int i = 11943; i <= 11948; i++) + materials[i] = Material.WhiteShulkerBox; + materials[5780] = Material.WhiteStainedGlass; + for (int i = 8976; i <= 9007; i++) + materials[i] = Material.WhiteStainedGlassPane; + materials[8960] = Material.WhiteTerracotta; + materials[2031] = Material.WhiteTulip; + for (int i = 10538; i <= 10541; i++) + materials[i] = Material.WhiteWallBanner; + materials[1996] = Material.WhiteWool; + materials[2035] = Material.WitherRose; + for (int i = 8591; i <= 8606; i++) + materials[i] = Material.WitherSkeletonSkull; + for (int i = 8607; i <= 8610; i++) + materials[i] = Material.WitherSkeletonWallSkull; + for (int i = 10346; i <= 10361; i++) + materials[i] = Material.YellowBanner; + for (int i = 1701; i <= 1716; i++) + materials[i] = Material.YellowBed; + for (int i = 20177; i <= 20192; i++) + materials[i] = Material.YellowCandle; + for (int i = 20379; i <= 20380; i++) + materials[i] = Material.YellowCandleCake; + materials[10255] = Material.YellowCarpet; + materials[12107] = Material.YellowConcrete; + materials[12123] = Material.YellowConcretePowder; + for (int i = 12055; i <= 12058; i++) + materials[i] = Material.YellowGlazedTerracotta; + for (int i = 11967; i <= 11972; i++) + materials[i] = Material.YellowShulkerBox; + materials[5784] = Material.YellowStainedGlass; + for (int i = 9104; i <= 9135; i++) + materials[i] = Material.YellowStainedGlassPane; + materials[8964] = Material.YellowTerracotta; + for (int i = 10554; i <= 10557; i++) + materials[i] = Material.YellowWallBanner; + materials[2000] = Material.YellowWool; + for (int i = 8611; i <= 8626; i++) + materials[i] = Material.ZombieHead; + for (int i = 8627; i <= 8630; i++) + materials[i] = Material.ZombieWallHead; + } + + protected override Dictionary GetDict() + { + return materials; + } + } +} diff --git a/MinecraftClient/Mapping/EntityPalettes/EntityPalette1193.cs b/MinecraftClient/Mapping/EntityPalettes/EntityPalette1193.cs new file mode 100644 index 00000000..d02e09a7 --- /dev/null +++ b/MinecraftClient/Mapping/EntityPalettes/EntityPalette1193.cs @@ -0,0 +1,137 @@ +using System.Collections.Generic; + +namespace MinecraftClient.Mapping.EntityPalettes +{ + public class EntityPalette1193 : EntityPalette + { + private static readonly Dictionary mappings = new(); + + static EntityPalette1193() + { + mappings[0] = EntityType.Allay; + mappings[1] = EntityType.AreaEffectCloud; + mappings[2] = EntityType.ArmorStand; + mappings[3] = EntityType.Arrow; + mappings[4] = EntityType.Axolotl; + mappings[5] = EntityType.Bat; + mappings[6] = EntityType.Bee; + mappings[7] = EntityType.Blaze; + mappings[8] = EntityType.Boat; + mappings[11] = EntityType.Camel; + mappings[10] = EntityType.Cat; + mappings[12] = EntityType.CaveSpider; + mappings[9] = EntityType.ChestBoat; + mappings[55] = EntityType.ChestMinecart; + mappings[13] = EntityType.Chicken; + mappings[14] = EntityType.Cod; + mappings[56] = EntityType.CommandBlockMinecart; + mappings[15] = EntityType.Cow; + mappings[16] = EntityType.Creeper; + mappings[17] = EntityType.Dolphin; + mappings[18] = EntityType.Donkey; + mappings[19] = EntityType.DragonFireball; + mappings[20] = EntityType.Drowned; + mappings[94] = EntityType.Egg; + mappings[21] = EntityType.ElderGuardian; + mappings[22] = EntityType.EndCrystal; + mappings[23] = EntityType.EnderDragon; + mappings[95] = EntityType.EnderPearl; + mappings[24] = EntityType.Enderman; + mappings[25] = EntityType.Endermite; + mappings[26] = EntityType.Evoker; + mappings[27] = EntityType.EvokerFangs; + mappings[96] = EntityType.ExperienceBottle; + mappings[28] = EntityType.ExperienceOrb; + mappings[29] = EntityType.EyeOfEnder; + mappings[30] = EntityType.FallingBlock; + mappings[47] = EntityType.Fireball; + mappings[31] = EntityType.FireworkRocket; + mappings[118] = EntityType.FishingBobber; + mappings[32] = EntityType.Fox; + mappings[33] = EntityType.Frog; + mappings[57] = EntityType.FurnaceMinecart; + mappings[34] = EntityType.Ghast; + mappings[35] = EntityType.Giant; + mappings[36] = EntityType.GlowItemFrame; + mappings[37] = EntityType.GlowSquid; + mappings[38] = EntityType.Goat; + mappings[39] = EntityType.Guardian; + mappings[40] = EntityType.Hoglin; + mappings[58] = EntityType.HopperMinecart; + mappings[41] = EntityType.Horse; + mappings[42] = EntityType.Husk; + mappings[43] = EntityType.Illusioner; + mappings[44] = EntityType.IronGolem; + mappings[45] = EntityType.Item; + mappings[46] = EntityType.ItemFrame; + mappings[48] = EntityType.LeashKnot; + mappings[49] = EntityType.LightningBolt; + mappings[50] = EntityType.Llama; + mappings[51] = EntityType.LlamaSpit; + mappings[52] = EntityType.MagmaCube; + mappings[53] = EntityType.Marker; + mappings[54] = EntityType.Minecart; + mappings[62] = EntityType.Mooshroom; + mappings[61] = EntityType.Mule; + mappings[63] = EntityType.Ocelot; + mappings[64] = EntityType.Painting; + mappings[65] = EntityType.Panda; + mappings[66] = EntityType.Parrot; + mappings[67] = EntityType.Phantom; + mappings[68] = EntityType.Pig; + mappings[69] = EntityType.Piglin; + mappings[70] = EntityType.PiglinBrute; + mappings[71] = EntityType.Pillager; + mappings[117] = EntityType.Player; + mappings[72] = EntityType.PolarBear; + mappings[97] = EntityType.Potion; + mappings[74] = EntityType.Pufferfish; + mappings[75] = EntityType.Rabbit; + mappings[76] = EntityType.Ravager; + mappings[77] = EntityType.Salmon; + mappings[78] = EntityType.Sheep; + mappings[79] = EntityType.Shulker; + mappings[80] = EntityType.ShulkerBullet; + mappings[81] = EntityType.Silverfish; + mappings[82] = EntityType.Skeleton; + mappings[83] = EntityType.SkeletonHorse; + mappings[84] = EntityType.Slime; + mappings[85] = EntityType.SmallFireball; + mappings[86] = EntityType.SnowGolem; + mappings[87] = EntityType.Snowball; + mappings[59] = EntityType.SpawnerMinecart; + mappings[88] = EntityType.SpectralArrow; + mappings[89] = EntityType.Spider; + mappings[90] = EntityType.Squid; + mappings[91] = EntityType.Stray; + mappings[92] = EntityType.Strider; + mappings[93] = EntityType.Tadpole; + mappings[73] = EntityType.Tnt; + mappings[60] = EntityType.TntMinecart; + mappings[99] = EntityType.TraderLlama; + mappings[98] = EntityType.Trident; + mappings[100] = EntityType.TropicalFish; + mappings[101] = EntityType.Turtle; + mappings[102] = EntityType.Vex; + mappings[103] = EntityType.Villager; + mappings[104] = EntityType.Vindicator; + mappings[105] = EntityType.WanderingTrader; + mappings[106] = EntityType.Warden; + mappings[107] = EntityType.Witch; + mappings[108] = EntityType.Wither; + mappings[109] = EntityType.WitherSkeleton; + mappings[110] = EntityType.WitherSkull; + mappings[111] = EntityType.Wolf; + mappings[112] = EntityType.Zoglin; + mappings[113] = EntityType.Zombie; + mappings[114] = EntityType.ZombieHorse; + mappings[115] = EntityType.ZombieVillager; + mappings[116] = EntityType.ZombifiedPiglin; + } + + protected override Dictionary GetDict() + { + return mappings; + } + } +} diff --git a/MinecraftClient/Mapping/EntityType.cs b/MinecraftClient/Mapping/EntityType.cs index ddb8a6b2..4351de3c 100644 --- a/MinecraftClient/Mapping/EntityType.cs +++ b/MinecraftClient/Mapping/EntityType.cs @@ -23,6 +23,7 @@ Bee, Blaze, Boat, + Camel, Cat, CaveSpider, ChestBoat, diff --git a/MinecraftClient/Mapping/Material.cs b/MinecraftClient/Mapping/Material.cs index 507dcc56..f0023009 100644 --- a/MinecraftClient/Mapping/Material.cs +++ b/MinecraftClient/Mapping/Material.cs @@ -18,6 +18,7 @@ AcaciaDoor, AcaciaFence, AcaciaFenceGate, + AcaciaHangingSign, AcaciaLeaves, AcaciaLog, AcaciaPlanks, @@ -27,6 +28,7 @@ AcaciaSlab, AcaciaStairs, AcaciaTrapdoor, + AcaciaWallHangingSign, AcaciaWallSign, AcaciaWood, ActivatorRail, @@ -46,7 +48,24 @@ AzaleaLeaves, AzureBluet, Bamboo, + BambooBlock, + BambooButton, + BambooDoor, + BambooFence, + BambooFenceGate, + BambooHangingSign, + BambooMosaic, + BambooMosaicSlab, + BambooMosaicStairs, + BambooPlanks, + BambooPressurePlate, BambooSapling, + BambooSign, + BambooSlab, + BambooStairs, + BambooTrapdoor, + BambooWallHangingSign, + BambooWallSign, Barrel, Barrier, Basalt, @@ -62,6 +81,7 @@ BirchDoor, BirchFence, BirchFenceGate, + BirchHangingSign, BirchLeaves, BirchLog, BirchPlanks, @@ -71,6 +91,7 @@ BirchSlab, BirchStairs, BirchTrapdoor, + BirchWallHangingSign, BirchWallSign, BirchWood, BlackBanner, @@ -158,6 +179,7 @@ ChainCommandBlock, Chest, ChippedAnvil, + ChiseledBookshelf, ChiseledDeepslate, ChiseledNetherBricks, ChiseledPolishedBlackstone, @@ -201,6 +223,7 @@ CrimsonFence, CrimsonFenceGate, CrimsonFungus, + CrimsonHangingSign, CrimsonHyphae, CrimsonNylium, CrimsonPlanks, @@ -211,6 +234,7 @@ CrimsonStairs, CrimsonStem, CrimsonTrapdoor, + CrimsonWallHangingSign, CrimsonWallSign, CryingObsidian, CutCopper, @@ -240,6 +264,7 @@ DarkOakDoor, DarkOakFence, DarkOakFenceGate, + DarkOakHangingSign, DarkOakLeaves, DarkOakLog, DarkOakPlanks, @@ -249,6 +274,7 @@ DarkOakSlab, DarkOakStairs, DarkOakTrapdoor, + DarkOakWallHangingSign, DarkOakWallSign, DarkOakWood, DarkPrismarine, @@ -413,6 +439,7 @@ JungleDoor, JungleFence, JungleFenceGate, + JungleHangingSign, JungleLeaves, JungleLog, JunglePlanks, @@ -422,6 +449,7 @@ JungleSlab, JungleStairs, JungleTrapdoor, + JungleWallHangingSign, JungleWallSign, JungleWood, Kelp, @@ -505,6 +533,7 @@ MangroveDoor, MangroveFence, MangroveFenceGate, + MangroveHangingSign, MangroveLeaves, MangroveLog, MangrovePlanks, @@ -515,6 +544,7 @@ MangroveSlab, MangroveStairs, MangroveTrapdoor, + MangroveWallHangingSign, MangroveWallSign, MangroveWood, MediumAmethystBud, @@ -557,6 +587,7 @@ OakDoor, OakFence, OakFenceGate, + OakHangingSign, OakLeaves, OakLog, OakPlanks, @@ -566,6 +597,7 @@ OakSlab, OakStairs, OakTrapdoor, + OakWallHangingSign, OakWallSign, OakWood, Observer, @@ -596,6 +628,8 @@ PearlescentFroglight, Peony, PetrifiedOakSlab, + PiglinHead, + PiglinWallHead, PinkBanner, PinkBed, PinkCandle, @@ -803,6 +837,7 @@ SpruceDoor, SpruceFence, SpruceFenceGate, + SpruceHangingSign, SpruceLeaves, SpruceLog, SprucePlanks, @@ -812,6 +847,7 @@ SpruceSlab, SpruceStairs, SpruceTrapdoor, + SpruceWallHangingSign, SpruceWallSign, SpruceWood, StickyPiston, @@ -827,6 +863,7 @@ Stonecutter, StrippedAcaciaLog, StrippedAcaciaWood, + StrippedBambooBlock, StrippedBirchLog, StrippedBirchWood, StrippedCrimsonHyphae, @@ -875,6 +912,7 @@ WarpedFence, WarpedFenceGate, WarpedFungus, + WarpedHangingSign, WarpedHyphae, WarpedNylium, WarpedPlanks, @@ -885,6 +923,7 @@ WarpedStairs, WarpedStem, WarpedTrapdoor, + WarpedWallHangingSign, WarpedWallSign, WarpedWartBlock, Water, diff --git a/MinecraftClient/Mapping/MessageFilterType.cs b/MinecraftClient/Mapping/MessageFilterType.cs new file mode 100644 index 00000000..9c3cfe1d --- /dev/null +++ b/MinecraftClient/Mapping/MessageFilterType.cs @@ -0,0 +1,9 @@ +namespace MinecraftClient.Mapping +{ + public enum MessageFilterType + { + PassThrough = 0, + FullyFiltered, + PartiallyFiltered + } +} diff --git a/MinecraftClient/McClient.cs b/MinecraftClient/McClient.cs index 003dcbc2..afd78df0 100644 --- a/MinecraftClient/McClient.cs +++ b/MinecraftClient/McClient.cs @@ -13,6 +13,7 @@ using MinecraftClient.Inventory; using MinecraftClient.Logger; using MinecraftClient.Mapping; using MinecraftClient.Protocol; +using MinecraftClient.Protocol.Handlers; using MinecraftClient.Protocol.Handlers.Forge; using MinecraftClient.Protocol.Message; using MinecraftClient.Protocol.ProfileKey; @@ -67,6 +68,7 @@ namespace MinecraftClient private double motionY; public enum MovementType { Sneak, Walk, Sprint } private int sequenceId; // User for player block synchronization (Aka. digging, placing blocks, etc..) + private bool CanSendMessage = false; private readonly string host; private readonly int port; @@ -85,6 +87,10 @@ namespace MinecraftClient private int playerEntityID; + private object DigLock = new(); + private Tuple? LastDigPosition; + private int RemainingDiggingTime = 0; + // player health and hunger private float playerHealth; private int playerFoodSaturation; @@ -290,6 +296,9 @@ namespace MinecraftClient /// private void TrySendMessageToServer() { + if (!CanSendMessage) + return; + while (chatQueue.Count > 0 && nextMessageSendTime < DateTime.Now) { string text = chatQueue.Dequeue(); @@ -375,6 +384,22 @@ namespace MinecraftClient taskToRun(); } } + + lock (DigLock) + { + if (RemainingDiggingTime > 0) + { + if (--RemainingDiggingTime == 0 && LastDigPosition != null) + { + handler.SendPlayerDigging(2, LastDigPosition.Item1, LastDigPosition.Item2, sequenceId++); + Log.Info(string.Format(Translations.cmd_dig_end, LastDigPosition.Item1)); + } + else + { + DoAnimation((int)Hand.MainHand); + } + } + } } #region Connection Lost and Disconnect from Server @@ -1102,13 +1127,15 @@ namespace MinecraftClient /// Player info public PlayerInfo? GetPlayerInfo(Guid uuid) { - lock (onlinePlayers) - { - if (onlinePlayers.ContainsKey(uuid)) - return onlinePlayers[uuid]; - else - return null; - } + if (onlinePlayers.TryGetValue(uuid, out PlayerInfo? player)) + return player; + else + return null; + } + + public PlayerKeyPair? GetPlayerKeyPair() + { + return playerKeyPair; } #endregion @@ -1292,7 +1319,7 @@ namespace MinecraftClient /// TRUE if the item was successfully used public bool UseItemOnHand() { - return InvokeOnMainThread(() => handler.SendUseItem(0, sequenceId)); + return InvokeOnMainThread(() => handler.SendUseItem(0, sequenceId++)); } /// @@ -1301,7 +1328,7 @@ namespace MinecraftClient /// TRUE if the item was successfully used public bool UseItemOnLeftHand() { - return InvokeOnMainThread(() => handler.SendUseItem(1, sequenceId)); + return InvokeOnMainThread(() => handler.SendUseItem(1, sequenceId++)); } /// @@ -2186,7 +2213,7 @@ namespace MinecraftClient /// TRUE if successfully placed public bool PlaceBlock(Location location, Direction blockFace, Hand hand = Hand.MainHand) { - return InvokeOnMainThread(() => handler.SendPlayerBlockPlacement((int)hand, location, blockFace, sequenceId)); + return InvokeOnMainThread(() => handler.SendPlayerBlockPlacement((int)hand, location, blockFace, sequenceId++)); } /// @@ -2195,26 +2222,44 @@ namespace MinecraftClient /// Location of block to dig /// Also perform the "arm swing" animation /// Also look at the block before digging - public bool DigBlock(Location location, bool swingArms = true, bool lookAtBlock = true) + public bool DigBlock(Location location, bool swingArms = true, bool lookAtBlock = true, double duration = 0) { if (!GetTerrainEnabled()) return false; if (InvokeRequired) - return InvokeOnMainThread(() => DigBlock(location, swingArms, lookAtBlock)); + return InvokeOnMainThread(() => DigBlock(location, swingArms, lookAtBlock, duration)); // TODO select best face from current player location Direction blockFace = Direction.Down; - // Look at block before attempting to break it - if (lookAtBlock) - UpdateLocation(GetCurrentLocation(), location); + lock (DigLock) + { + if (RemainingDiggingTime > 0 && LastDigPosition != null) + { + handler.SendPlayerDigging(1, LastDigPosition.Item1, LastDigPosition.Item2, sequenceId++); + Log.Info(string.Format(Translations.cmd_dig_cancel, LastDigPosition.Item1)); + } - // Send dig start and dig end, will need to wait for server response to know dig result - // See https://wiki.vg/How_to_Write_a_Client#Digging for more details - return handler.SendPlayerDigging(0, location, blockFace, sequenceId) - && (!swingArms || DoAnimation((int)Hand.MainHand)) - && handler.SendPlayerDigging(2, location, blockFace, sequenceId); + // Look at block before attempting to break it + if (lookAtBlock) + UpdateLocation(GetCurrentLocation(), location); + + // Send dig start and dig end, will need to wait for server response to know dig result + // See https://wiki.vg/How_to_Write_a_Client#Digging for more details + bool result = handler.SendPlayerDigging(0, location, blockFace, sequenceId++) + && (!swingArms || DoAnimation((int)Hand.MainHand)); + + if (duration <= 0) + result &= handler.SendPlayerDigging(2, location, blockFace, sequenceId++); + else + { + LastDigPosition = new(location, blockFace); + RemainingDiggingTime = Settings.DoubleToTick(duration); + } + + return result; + } } /// @@ -2370,7 +2415,7 @@ namespace MinecraftClient /// /// Called when a server was successfully joined /// - public void OnGameJoined() + public void OnGameJoined(bool isOnlineMode) { string? bandString = Config.Main.Advanced.BrandInfo.ToBrandString(); if (!String.IsNullOrWhiteSpace(bandString)) @@ -2386,6 +2431,12 @@ namespace MinecraftClient Config.MCSettings.Skin.GetByte(), (byte)Config.MCSettings.MainHand); + if (protocolversion >= Protocol18Handler.MC_1_19_3_Version + && playerKeyPair != null && isOnlineMode) + handler.SendPlayerSession(playerKeyPair); + + if (protocolversion < Protocol18Handler.MC_1_19_3_Version) + CanSendMessage = true; if (inventoryHandlingRequested) { @@ -3431,6 +3482,11 @@ namespace MinecraftClient ConsoleIO.OnAutoCompleteDone(transactionId, result); } + public void OnDeclareCommands() + { + CanSendMessage = true; + } + /// /// Send a click container button packet to the server. /// Used for Enchanting table, Lectern, stone cutter and loom diff --git a/MinecraftClient/Program.cs b/MinecraftClient/Program.cs index 7eaaafa8..dd9dcbc0 100644 --- a/MinecraftClient/Program.cs +++ b/MinecraftClient/Program.cs @@ -46,7 +46,7 @@ namespace MinecraftClient public const string Version = MCHighestVersion; public const string MCLowestVersion = "1.4.6"; - public const string MCHighestVersion = "1.19.2"; + public const string MCHighestVersion = "1.19.3"; public static readonly string? BuildInfo = null; private static Tuple? offlinePrompt = null; @@ -621,7 +621,16 @@ namespace MinecraftClient { HandleFailure(Translations.error_unsupported, true); } - catch (Exception) { } + catch (NotImplementedException) + { + throw; + } + catch (Exception e) + { + ConsoleIO.WriteLine(e.Message); + ConsoleIO.WriteLine(e.StackTrace ?? ""); + HandleFailure(); // Other error + } } else HandleFailure(Translations.error_determine, true); } diff --git a/MinecraftClient/Protocol/Handlers/DataTypes.cs b/MinecraftClient/Protocol/Handlers/DataTypes.cs index ecc86bce..716312ec 100644 --- a/MinecraftClient/Protocol/Handlers/DataTypes.cs +++ b/MinecraftClient/Protocol/Handlers/DataTypes.cs @@ -240,6 +240,18 @@ namespace MinecraftClient.Protocol.Handlers return ReadData(len, cache); } + /// + /// Read a byte array with given length from a cache of bytes and remove it from the cache + /// + /// Cache of bytes to read from + /// Length of the bytes array + /// The byte array + [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] + public byte[] ReadNextByteArray(Queue cache, int length) + { + return ReadData(length, cache); + } + /// /// Reads a length-prefixed array of unsigned long integers and removes it from the cache /// @@ -579,6 +591,9 @@ namespace MinecraftClient.Protocol.Handlers { int type = ReadNextVarInt(cache); + // Value's data type is depended on Type + object? value = null; + // starting from 1.13, Optional Chat is inserted as number 5 in 1.13 and IDs after 5 got shifted. // Increase type ID by 1 if // - below 1.13 @@ -586,20 +601,29 @@ namespace MinecraftClient.Protocol.Handlers if (protocolversion < Protocol18Handler.MC_1_13_Version) { if (type > 4) + ++type; + } + else if (protocolversion >= Protocol18Handler.MC_1_19_3_Version) + { + if (type == 2) { - type += 1; + value = ReadNextVarLong(cache); + type = -1; + } + else if (type >= 3) + { + --type; } } - // Value's data type is depended on Type - object? value = null; - // This is backward compatible since new type is appended to the end // Version upgrade note // - Check type ID got shifted or not // - Add new type if any switch (type) { + case -1: // already readed + break; case 0: // byte value = ReadNextByte(cache); break; @@ -660,23 +684,73 @@ namespace MinecraftClient.Protocol.Handlers case 15: // Particle // Currecutly not handled. Reading data only int ParticleID = ReadNextVarInt(cache); - switch (ParticleID) + // Need to check the exact version where the change occurred!!!!! + if (protocolversion >= Protocol18Handler.MC_1_19_3_Version) { - case 3: - ReadNextVarInt(cache); - break; - case 14: - ReadNextFloat(cache); - ReadNextFloat(cache); - ReadNextFloat(cache); - ReadNextFloat(cache); - break; - case 23: - ReadNextVarInt(cache); - break; - case 32: - ReadNextItemSlot(cache, itemPalette); - break; + switch (ParticleID) + { + case 2: + ReadNextVarInt(cache); + break; + case 3: + ReadNextVarInt(cache); + break; + case 14: + ReadNextFloat(cache); + ReadNextFloat(cache); + ReadNextFloat(cache); + ReadNextFloat(cache); + break; + case 15: + ReadNextFloat(cache); + ReadNextFloat(cache); + ReadNextFloat(cache); + ReadNextFloat(cache); + ReadNextFloat(cache); + ReadNextFloat(cache); + ReadNextFloat(cache); + break; + case 24: + ReadNextVarInt(cache); + break; + case 35: + ReadNextItemSlot(cache, itemPalette); + break; + case 36: + string positionSourceType = ReadNextString(cache); + if (positionSourceType == "minecraft:block") + { + ReadNextLocation(cache); + } + else if (positionSourceType == "minecraft:entity") + { + ReadNextVarInt(cache); + ReadNextFloat(cache); + } + ReadNextVarInt(cache); + break; + } + } + else + { + switch (ParticleID) + { + case 3: + ReadNextVarInt(cache); + break; + case 14: + ReadNextFloat(cache); + ReadNextFloat(cache); + ReadNextFloat(cache); + ReadNextFloat(cache); + break; + case 23: + ReadNextVarInt(cache); + break; + case 32: + ReadNextItemSlot(cache, itemPalette); + break; + } } break; case 16: // Villager Data (3x VarInt) @@ -706,7 +780,10 @@ namespace MinecraftClient.Protocol.Handlers if (protocolversion <= Protocol18Handler.MC_1_19_Version) value = ReadNextVarInt(cache); else - value = null; // Dimension and blockPos, currently not in use + { + // Dimension and blockPos, currently not in use + value = new Tuple(ReadNextString(cache), ReadNextLocation(cache)); + } break; case 22: // Painting Variant value = ReadNextVarInt(cache); @@ -728,11 +805,17 @@ namespace MinecraftClient.Protocol.Handlers { Item inputItem1 = ReadNextItemSlot(cache, itemPalette)!; Item outputItem = ReadNextItemSlot(cache, itemPalette)!; + Item? inputItem2 = null; - if (ReadNextBool(cache)) //check if villager has second item - { + + if (protocolversion >= Protocol18Handler.MC_1_19_3_Version) inputItem2 = ReadNextItemSlot(cache, itemPalette); + else + { + if (ReadNextBool(cache)) //check if villager has second item + inputItem2 = ReadNextItemSlot(cache, itemPalette); } + bool tradeDisabled = ReadNextBool(cache); int numberOfTradeUses = ReadNextInt(cache); int maximumNumberOfTradeUses = ReadNextInt(cache); @@ -917,7 +1000,7 @@ namespace MinecraftClient.Protocol.Handlers /// /// Integer to encode /// Byte array for this integer - public byte[] GetVarInt(int paramInt) + public static byte[] GetVarInt(int paramInt) { List bytes = new(); while ((paramInt & -128) != 0) @@ -948,7 +1031,19 @@ namespace MinecraftClient.Protocol.Handlers /// /// Long to process /// Array ready to send - public byte[] GetLong(long number) + public static byte[] GetLong(long number) + { + byte[] theLong = BitConverter.GetBytes(number); + Array.Reverse(theLong); + return theLong; + } + + /// + /// Get byte array representing a long integer + /// + /// Long to process + /// Array ready to send + public static byte[] GetULong(ulong number) { byte[] theLong = BitConverter.GetBytes(number); Array.Reverse(theLong); @@ -960,7 +1055,7 @@ namespace MinecraftClient.Protocol.Handlers /// /// Integer to process /// Array ready to send - public byte[] GetInt(int number) + public static byte[] GetInt(int number) { byte[] theInt = BitConverter.GetBytes(number); Array.Reverse(theInt); @@ -1143,7 +1238,7 @@ namespace MinecraftClient.Protocol.Handlers /// /// UUID of Player/Entity /// UUID representation - public byte[] GetUUID(Guid UUID) + public static byte[] GetUUID(Guid UUID) { return UUID.ToBigEndianBytes(); } @@ -1188,11 +1283,11 @@ namespace MinecraftClient.Protocol.Handlers { List fields = new(); fields.AddRange(GetVarInt(msgList.entries.Length)); // Message list size - foreach (Message.LastSeenMessageList.Entry entry in msgList.entries) + foreach (Message.LastSeenMessageList.AcknowledgedMessage entry in msgList.entries) { fields.AddRange(entry.profileId.ToBigEndianBytes()); // UUID - fields.AddRange(GetVarInt(entry.lastSignature.Length)); // Signature length - fields.AddRange(entry.lastSignature); // Signature data + fields.AddRange(GetVarInt(entry.signature.Length)); // Signature length + fields.AddRange(entry.signature); // Signature data } return fields.ToArray(); } @@ -1214,8 +1309,8 @@ namespace MinecraftClient.Protocol.Handlers { fields.AddRange(GetBool(true)); fields.AddRange(ack.lastReceived.profileId.ToBigEndianBytes()); // Has last received message - fields.AddRange(GetVarInt(ack.lastReceived.lastSignature.Length)); // Last received message signature length - fields.AddRange(ack.lastReceived.lastSignature); // Last received message signature data + fields.AddRange(GetVarInt(ack.lastReceived.signature.Length)); // Last received message signature length + fields.AddRange(ack.lastReceived.signature); // Last received message signature data } return fields.ToArray(); } diff --git a/MinecraftClient/Protocol/Handlers/Packet/s2c/DeclareCommands.cs b/MinecraftClient/Protocol/Handlers/Packet/s2c/DeclareCommands.cs index 22835b61..b2a9600c 100644 --- a/MinecraftClient/Protocol/Handlers/Packet/s2c/DeclareCommands.cs +++ b/MinecraftClient/Protocol/Handlers/Packet/s2c/DeclareCommands.cs @@ -8,7 +8,7 @@ namespace MinecraftClient.Protocol.Handlers.packet.s2c private static int RootIdx; private static CommandNode[] Nodes = Array.Empty(); - public static void Read(DataTypes dataTypes, Queue packetData) + public static void Read(DataTypes dataTypes, Queue packetData, int protocolVersion) { int count = dataTypes.ReadNextVarInt(packetData); Nodes = new CommandNode[count]; @@ -21,7 +21,7 @@ namespace MinecraftClient.Protocol.Handlers.packet.s2c for (int j = 0; j < childCount; ++j) childs[j] = dataTypes.ReadNextVarInt(packetData); - int redirectNode = ((flags & 0x08) > 0) ? dataTypes.ReadNextVarInt(packetData) : -1; + int redirectNode = ((flags & 0x08) == 0x08) ? dataTypes.ReadNextVarInt(packetData) : -1; string? name = ((flags & 0x03) == 1 || (flags & 0x03) == 2) ? dataTypes.ReadNextString(packetData) : null; @@ -29,28 +29,51 @@ namespace MinecraftClient.Protocol.Handlers.packet.s2c Paser? paser = null; if ((flags & 0x03) == 2) { - paser = paserId switch - { - 1 => new PaserFloat(dataTypes, packetData), - 2 => new PaserDouble(dataTypes, packetData), - 3 => new PaserInteger(dataTypes, packetData), - 4 => new PaserLong(dataTypes, packetData), - 5 => new PaserString(dataTypes, packetData), - 6 => new PaserEntity(dataTypes, packetData), - 8 => new PaserBlockPos(dataTypes, packetData), - 9 => new PaserColumnPos(dataTypes, packetData), - 10 => new PaserVec3(dataTypes, packetData), - 11 => new PaserVec2(dataTypes, packetData), - 18 => new PaserMessage(dataTypes, packetData), - 27 => new PaserRotation(dataTypes, packetData), - 29 => new PaserScoreHolder(dataTypes, packetData), - 43 => new PaserResourceOrTag(dataTypes, packetData), - 44 => new PaserResource(dataTypes, packetData), - _ => new PaserEmpty(dataTypes, packetData), - }; + if (protocolVersion <= Protocol18Handler.MC_1_19_2_Version) + paser = paserId switch + { + 1 => new PaserFloat(dataTypes, packetData), + 2 => new PaserDouble(dataTypes, packetData), + 3 => new PaserInteger(dataTypes, packetData), + 4 => new PaserLong(dataTypes, packetData), + 5 => new PaserString(dataTypes, packetData), + 6 => new PaserEntity(dataTypes, packetData), + 8 => new PaserBlockPos(dataTypes, packetData), + 9 => new PaserColumnPos(dataTypes, packetData), + 10 => new PaserVec3(dataTypes, packetData), + 11 => new PaserVec2(dataTypes, packetData), + 18 => new PaserMessage(dataTypes, packetData), + 27 => new PaserRotation(dataTypes, packetData), + 29 => new PaserScoreHolder(dataTypes, packetData), + 43 => new PaserResourceOrTag(dataTypes, packetData), + 44 => new PaserResource(dataTypes, packetData), + _ => new PaserEmpty(dataTypes, packetData), + }; + else // protocolVersion >= MC_1_19_3_Version + paser = paserId switch + { + 1 => new PaserFloat(dataTypes, packetData), + 2 => new PaserDouble(dataTypes, packetData), + 3 => new PaserInteger(dataTypes, packetData), + 4 => new PaserLong(dataTypes, packetData), + 5 => new PaserString(dataTypes, packetData), + 6 => new PaserEntity(dataTypes, packetData), + 8 => new PaserBlockPos(dataTypes, packetData), + 9 => new PaserColumnPos(dataTypes, packetData), + 10 => new PaserVec3(dataTypes, packetData), + 11 => new PaserVec2(dataTypes, packetData), + 18 => new PaserMessage(dataTypes, packetData), + 27 => new PaserRotation(dataTypes, packetData), + 29 => new PaserScoreHolder(dataTypes, packetData), + 41 => new PaserResourceOrTag(dataTypes, packetData), + 42 => new PaserResourceOrTag(dataTypes, packetData), + 43 => new PaserResource(dataTypes, packetData), + 44 => new PaserResource(dataTypes, packetData), + _ => new PaserEmpty(dataTypes, packetData), + }; } - string? suggestionsType = ((flags & 0x10) > 0) ? dataTypes.ReadNextString(packetData) : null; + string? suggestionsType = ((flags & 0x10) == 0x10) ? dataTypes.ReadNextString(packetData) : null; Nodes[i] = new(flags, childs, redirectNode, name, paser, suggestionsType); } diff --git a/MinecraftClient/Protocol/Handlers/PacketPalettes/PacketPalette119.cs b/MinecraftClient/Protocol/Handlers/PacketPalettes/PacketPalette119.cs index 6ec16097..6c16552b 100644 --- a/MinecraftClient/Protocol/Handlers/PacketPalettes/PacketPalette119.cs +++ b/MinecraftClient/Protocol/Handlers/PacketPalettes/PacketPalette119.cs @@ -6,12 +6,12 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes { private readonly Dictionary typeIn = new() { - { 0x00, PacketTypesIn.SpawnEntity }, // Changed in 1.19 (Wiki name: Spawn Entity) - DONE + { 0x00, PacketTypesIn.SpawnEntity }, // Changed in 1.19 (Wiki name: Spawn Entity) { 0x01, PacketTypesIn.SpawnExperienceOrb }, // (Wiki name: Spawn Exeprience Orb) { 0x02, PacketTypesIn.SpawnPlayer }, // { 0x03, PacketTypesIn.EntityAnimation }, // (Wiki name: Entity Animation (clientbound)) { 0x04, PacketTypesIn.Statistics }, // (Wiki name: Award Statistics) - { 0x05, PacketTypesIn.BlockChangedAck }, // Added 1.19 (Wiki name: Acknowledge Block Change) - DONE + { 0x05, PacketTypesIn.BlockChangedAck }, // Added 1.19 (Wiki name: Acknowledge Block Change) { 0x06, PacketTypesIn.BlockBreakAnimation }, // (Wiki name: Set Block Destroy Stage) { 0x07, PacketTypesIn.BlockEntityData }, // { 0x08, PacketTypesIn.BlockAction }, // @@ -28,10 +28,10 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes { 0x13, PacketTypesIn.SetSlot }, // (Wiki name: Set Container Slot) { 0x14, PacketTypesIn.SetCooldown }, // { 0x15, PacketTypesIn.PluginMessage }, // (Wiki name: Plugin Message (clientbound)) - { 0x16, PacketTypesIn.NamedSoundEffect }, // Changed in 1.19 (Added "Speed" field) (Wiki name: Custom Sound Effect) - DONE (No need to be implemented) + { 0x16, PacketTypesIn.NamedSoundEffect }, // Changed in 1.19 (Added "Speed" field) (Wiki name: Custom Sound Effect) (No need to be implemented) { 0x17, PacketTypesIn.Disconnect }, // { 0x18, PacketTypesIn.EntityStatus }, // (Wiki name: Entity Event) - { 0x19, PacketTypesIn.Explosion }, // Changed in 1.19 (Location fields are now Double instead of Float) (Wiki name: Explosion) - DONE + { 0x19, PacketTypesIn.Explosion }, // Changed in 1.19 (Location fields are now Double instead of Float) (Wiki name: Explosion) { 0x1A, PacketTypesIn.UnloadChunk }, // (Wiki name: Forget Chunk) { 0x1B, PacketTypesIn.ChangeGameState }, // (Wiki name: Game Event) { 0x1C, PacketTypesIn.OpenHorseWindow }, // (Wiki name: Horse Screen Open) @@ -39,9 +39,9 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes { 0x1E, PacketTypesIn.KeepAlive }, // { 0x1F, PacketTypesIn.ChunkData }, // { 0x20, PacketTypesIn.Effect }, // (Wiki name: Level Event) - { 0x21, PacketTypesIn.Particle }, // Changed in 1.19 ("Particle Data" field is now "Max Speed", it's the same Float data type) (Wiki name: Level Particle) - DONE (No need to be implemented) + { 0x21, PacketTypesIn.Particle }, // Changed in 1.19 ("Particle Data" field is now "Max Speed", it's the same Float data type) (Wiki name: Level Particle) (No need to be implemented) { 0x22, PacketTypesIn.UpdateLight }, // (Wiki name: Light Update) - { 0x23, PacketTypesIn.JoinGame }, // Changed in 1.19 (lot's of changes) (Wiki name: Login (play)) - DONE + { 0x23, PacketTypesIn.JoinGame }, // Changed in 1.19 (lot's of changes) (Wiki name: Login (play)) { 0x24, PacketTypesIn.MapData }, // (Wiki name: Map Item Data) { 0x25, PacketTypesIn.TradeList }, // (Wiki name: Merchant Offers) { 0x26, PacketTypesIn.EntityPosition }, // (Wiki name: Move Entity Position) @@ -58,14 +58,14 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes { 0x31, PacketTypesIn.EndCombatEvent }, // (Wiki name: Player Combat End) { 0x32, PacketTypesIn.EnterCombatEvent }, // (Wiki name: Player Combat Enter) { 0x33, PacketTypesIn.DeathCombatEvent }, // (Wiki name: Player Combat Kill) - { 0x34, PacketTypesIn.PlayerInfo }, // Changed in 1.19 (Heavy changes) - DONE + { 0x34, PacketTypesIn.PlayerInfo }, // Changed in 1.19 (Heavy changes) { 0x35, PacketTypesIn.FacePlayer }, // (Wiki name: Player Look At) { 0x36, PacketTypesIn.PlayerPositionAndLook }, // (Wiki name: Player Position) { 0x37, PacketTypesIn.UnlockRecipes }, // (Wiki name: Recipe) { 0x38, PacketTypesIn.DestroyEntities }, // (Wiki name: Remove Entites) { 0x39, PacketTypesIn.RemoveEntityEffect }, // { 0x3A, PacketTypesIn.ResourcePackSend }, // (Wiki name: Resource Pack) - { 0x3B, PacketTypesIn.Respawn }, // Changed in 1.19 (Heavy changes) - DONE + { 0x3B, PacketTypesIn.Respawn }, // Changed in 1.19 (Heavy changes) { 0x3C, PacketTypesIn.EntityHeadLook }, // (Wiki name: Rotate Head) { 0x3D, PacketTypesIn.MultiBlockChange }, // (Wiki name: Sections Block Update) { 0x3E, PacketTypesIn.SelectAdvancementTab }, // @@ -99,7 +99,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes { 0x5A, PacketTypesIn.SetTitleText }, // (Wiki name: Set Title) { 0x5B, PacketTypesIn.SetTitleTime }, // (Wiki name: Set Titles Animation) { 0x5C, PacketTypesIn.EntitySoundEffect }, // (Wiki name: Sound Entity) - { 0x5D, PacketTypesIn.SoundEffect }, // Changed in 1.19 (Added "Seed" field) (Wiki name: Sound Effect) - DONE (No need to be implemented) + { 0x5D, PacketTypesIn.SoundEffect }, // Changed in 1.19 (Added "Seed" field) (Wiki name: Sound Effect) (No need to be implemented) { 0x5E, PacketTypesIn.StopSound }, // { 0x5F, PacketTypesIn.SystemChat }, // Added in 1.19 (Wiki name: System Chat Message) { 0x60, PacketTypesIn.PlayerListHeaderAndFooter }, // (Wiki name: Tab List) @@ -108,7 +108,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes { 0x63, PacketTypesIn.EntityTeleport }, // (Wiki name: Teleport Entity) { 0x64, PacketTypesIn.Advancements }, // (Wiki name: Update Advancements) { 0x65, PacketTypesIn.EntityProperties }, // (Wiki name: Update Attributes) - { 0x66, PacketTypesIn.EntityEffect }, // Changed in 1.19 (Added "Has Factor Data" and "Factor Codec" fields) (Wiki name: Entity Effect) - DONE + { 0x66, PacketTypesIn.EntityEffect }, // Changed in 1.19 (Added "Has Factor Data" and "Factor Codec" fields) (Wiki name: Entity Effect) { 0x67, PacketTypesIn.DeclareRecipes }, // (Wiki name: Update Recipes) { 0x68, PacketTypesIn.Tags }, // (Wiki name: Update Tags) }; @@ -118,9 +118,9 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes { 0x00, PacketTypesOut.TeleportConfirm }, // (Wiki name: Confirm Teleportation) { 0x01, PacketTypesOut.QueryBlockNBT }, // (Wiki name: Query Block Entity Tag) { 0x02, PacketTypesOut.SetDifficulty }, // (Wiki name: Change Difficutly) - { 0x03, PacketTypesOut.ChatCommand }, // Added in 1.19 - { 0x04, PacketTypesOut.ChatMessage }, // Changed in 1.19 (Completely changed) (Wiki name: Chat) - { 0x05, PacketTypesOut.ChatPreview }, // Added in 1.19 (Wiki name: Chat Preview (serverbound)) + { 0x03, PacketTypesOut.MessageAcknowledgment }, // TODO + { 0x04, PacketTypesOut.ChatCommand }, // Added in 1.19 + { 0x05, PacketTypesOut.ChatMessage }, // Changed in 1.19 (Completely changed) (Wiki name: Chat) { 0x06, PacketTypesOut.ClientStatus }, // (Wiki name: Client Command) { 0x07, PacketTypesOut.ClientSettings }, // (Wiki name: Client Information) { 0x08, PacketTypesOut.TabComplete }, // (Wiki name: Command Suggestions Request) @@ -143,28 +143,29 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes { 0x19, PacketTypesOut.PickItem }, // { 0x1A, PacketTypesOut.CraftRecipeRequest }, // (Wiki name: Place recipe) { 0x1B, PacketTypesOut.PlayerAbilities }, // - { 0x1C, PacketTypesOut.PlayerDigging }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Player Action) - DONE + { 0x1C, PacketTypesOut.PlayerDigging }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Player Action) { 0x1D, PacketTypesOut.EntityAction }, // (Wiki name: Player Command) { 0x1E, PacketTypesOut.SteerVehicle }, // (Wiki name: Player Input) { 0x1F, PacketTypesOut.Pong }, // (Wiki name: Pong (play)) - { 0x20, PacketTypesOut.SetDisplayedRecipe }, // (Wiki name: Recipe Book Change Settings) - { 0x21, PacketTypesOut.SetRecipeBookState }, // (Wiki name: Recipe Book Seen Recipe) - { 0x22, PacketTypesOut.NameItem }, // (Wiki name: Rename Item) - { 0x23, PacketTypesOut.ResourcePackStatus }, // (Wiki name: Resource Pack (serverbound)) - { 0x24, PacketTypesOut.AdvancementTab }, // (Wiki name: Seen Advancements) - { 0x25, PacketTypesOut.SelectTrade }, // - { 0x26, PacketTypesOut.SetBeaconEffect }, // Changed in 1.19 (Added a "Secondary Effect Present" and "Secondary Effect" fields) (Wiki name: Set Beacon) - DONE - (No need to be implemented) - { 0x27, PacketTypesOut.HeldItemChange }, // (Wiki name: Set Carried Item (serverbound)) - { 0x28, PacketTypesOut.UpdateCommandBlock }, // (Wiki name: Set Command Block) - { 0x29, PacketTypesOut.UpdateCommandBlockMinecart }, // - { 0x2A, PacketTypesOut.CreativeInventoryAction }, // (Wiki name: Set Creative Mode Slot) - { 0x2B, PacketTypesOut.UpdateJigsawBlock }, // (Wiki name: Set Jigsaw Block) - { 0x2C, PacketTypesOut.UpdateStructureBlock }, // (Wiki name: Set Structure Block) - { 0x2D, PacketTypesOut.UpdateSign }, // (Wiki name: Sign Update) - { 0x2E, PacketTypesOut.Animation }, // (Wiki name: Swing) - { 0x2F, PacketTypesOut.Spectate }, // (Wiki name: Teleport To Entity) - { 0x30, PacketTypesOut.PlayerBlockPlacement }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item On) - DONE - { 0x31, PacketTypesOut.UseItem }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item) - DONE + { 0x20, PacketTypesOut.PlayerSession }, // Added in 1.19.3 TODO + { 0x21, PacketTypesOut.SetDisplayedRecipe }, // (Wiki name: Recipe Book Change Settings) + { 0x22, PacketTypesOut.SetRecipeBookState }, // (Wiki name: Recipe Book Seen Recipe) + { 0x23, PacketTypesOut.NameItem }, // (Wiki name: Rename Item) + { 0x24, PacketTypesOut.ResourcePackStatus }, // (Wiki name: Resource Pack (serverbound)) + { 0x25, PacketTypesOut.AdvancementTab }, // (Wiki name: Seen Advancements) + { 0x26, PacketTypesOut.SelectTrade }, // + { 0x27, PacketTypesOut.SetBeaconEffect }, // Changed in 1.19 (Added a "Secondary Effect Present" and "Secondary Effect" fields) (Wiki name: Set Beacon) - (No need to be implemented) + { 0x28, PacketTypesOut.HeldItemChange }, // (Wiki name: Set Carried Item (serverbound)) + { 0x29, PacketTypesOut.UpdateCommandBlock }, // (Wiki name: Set Command Block) + { 0x2A, PacketTypesOut.UpdateCommandBlockMinecart }, // + { 0x2B, PacketTypesOut.CreativeInventoryAction }, // (Wiki name: Set Creative Mode Slot) + { 0x2C, PacketTypesOut.UpdateJigsawBlock }, // (Wiki name: Set Jigsaw Block) + { 0x2D, PacketTypesOut.UpdateStructureBlock }, // (Wiki name: Set Structure Block) + { 0x2E, PacketTypesOut.UpdateSign }, // (Wiki name: Sign Update) + { 0x2F, PacketTypesOut.Animation }, // (Wiki name: Swing) + { 0x30, PacketTypesOut.Spectate }, // (Wiki name: Teleport To Entity) + { 0x31, PacketTypesOut.PlayerBlockPlacement }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item On) + { 0x32, PacketTypesOut.UseItem }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item) }; protected override Dictionary GetListIn() diff --git a/MinecraftClient/Protocol/Handlers/PacketPalettes/PacketPalette1192.cs b/MinecraftClient/Protocol/Handlers/PacketPalettes/PacketPalette1192.cs index f497917e..1f743945 100644 --- a/MinecraftClient/Protocol/Handlers/PacketPalettes/PacketPalette1192.cs +++ b/MinecraftClient/Protocol/Handlers/PacketPalettes/PacketPalette1192.cs @@ -6,12 +6,12 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes { private readonly Dictionary typeIn = new() { - { 0x00, PacketTypesIn.SpawnEntity }, // Changed in 1.19 (Wiki name: Spawn Entity) - DONE + { 0x00, PacketTypesIn.SpawnEntity }, // Changed in 1.19 (Wiki name: Spawn Entity) { 0x01, PacketTypesIn.SpawnExperienceOrb }, // (Wiki name: Spawn Exeprience Orb) { 0x02, PacketTypesIn.SpawnPlayer }, // { 0x03, PacketTypesIn.EntityAnimation }, // (Wiki name: Entity Animation (clientbound)) { 0x04, PacketTypesIn.Statistics }, // (Wiki name: Award Statistics) - { 0x05, PacketTypesIn.BlockChangedAck }, // Added 1.19 (Wiki name: Acknowledge Block Change) - DONE + { 0x05, PacketTypesIn.BlockChangedAck }, // Added 1.19 (Wiki name: Acknowledge Block Change) { 0x06, PacketTypesIn.BlockBreakAnimation }, // (Wiki name: Set Block Destroy Stage) { 0x07, PacketTypesIn.BlockEntityData }, // { 0x08, PacketTypesIn.BlockAction }, // @@ -29,11 +29,11 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes { 0x14, PacketTypesIn.SetCooldown }, // { 0x15, PacketTypesIn.ChatSuggestions }, // Added 1.19.1 { 0x16, PacketTypesIn.PluginMessage }, // (Wiki name: Plugin Message (clientbound)) - { 0x17, PacketTypesIn.NamedSoundEffect }, // Changed in 1.19 (Added "Speed" field) (Wiki name: Custom Sound Effect) - DONE (No need to be implemented) + { 0x17, PacketTypesIn.NamedSoundEffect }, // Changed in 1.19 (Added "Speed" field) (Wiki name: Custom Sound Effect) (No need to be implemented) { 0x18, PacketTypesIn.HideMessage }, // Added 1.19.1 { 0x19, PacketTypesIn.Disconnect }, // { 0x1A, PacketTypesIn.EntityStatus }, // (Wiki name: Entity Event) - { 0x1B, PacketTypesIn.Explosion }, // Changed in 1.19 (Location fields are now Double instead of Float) (Wiki name: Explosion) - DONE + { 0x1B, PacketTypesIn.Explosion }, // Changed in 1.19 (Location fields are now Double instead of Float) (Wiki name: Explosion) { 0x1C, PacketTypesIn.UnloadChunk }, // (Wiki name: Forget Chunk) { 0x1D, PacketTypesIn.ChangeGameState }, // (Wiki name: Game Event) { 0x1E, PacketTypesIn.OpenHorseWindow }, // (Wiki name: Horse Screen Open) @@ -41,9 +41,9 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes { 0x20, PacketTypesIn.KeepAlive }, // { 0x21, PacketTypesIn.ChunkData }, // { 0x22, PacketTypesIn.Effect }, // (Wiki name: Level Event) - { 0x23, PacketTypesIn.Particle }, // Changed in 1.19 ("Particle Data" field is now "Max Speed", it's the same Float data type) (Wiki name: Level Particle) - DONE (No need to be implemented) + { 0x23, PacketTypesIn.Particle }, // Changed in 1.19 ("Particle Data" field is now "Max Speed", it's the same Float data type) (Wiki name: Level Particle) (No need to be implemented) { 0x24, PacketTypesIn.UpdateLight }, // (Wiki name: Light Update) - { 0x25, PacketTypesIn.JoinGame }, // Changed in 1.19 (lot's of changes) (Wiki name: Login (play)) - DONE + { 0x25, PacketTypesIn.JoinGame }, // Changed in 1.19 (lot's of changes) (Wiki name: Login (play)) { 0x26, PacketTypesIn.MapData }, // (Wiki name: Map Item Data) { 0x27, PacketTypesIn.TradeList }, // (Wiki name: Merchant Offers) { 0x28, PacketTypesIn.EntityPosition }, // (Wiki name: Move Entity Position) @@ -61,14 +61,14 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes { 0x34, PacketTypesIn.EndCombatEvent }, // (Wiki name: Player Combat End) { 0x35, PacketTypesIn.EnterCombatEvent }, // (Wiki name: Player Combat Enter) { 0x36, PacketTypesIn.DeathCombatEvent }, // (Wiki name: Player Combat Kill) - { 0x37, PacketTypesIn.PlayerInfo }, // Changed in 1.19 (Heavy changes) - DONE + { 0x37, PacketTypesIn.PlayerInfo }, // Changed in 1.19 (Heavy changes) { 0x38, PacketTypesIn.FacePlayer }, // (Wiki name: Player Look At) { 0x39, PacketTypesIn.PlayerPositionAndLook }, // (Wiki name: Player Position) { 0x3A, PacketTypesIn.UnlockRecipes }, // (Wiki name: Recipe) { 0x3B, PacketTypesIn.DestroyEntities }, // (Wiki name: Remove Entites) { 0x3C, PacketTypesIn.RemoveEntityEffect }, // { 0x3D, PacketTypesIn.ResourcePackSend }, // (Wiki name: Resource Pack) - { 0x3E, PacketTypesIn.Respawn }, // Changed in 1.19 (Heavy changes) - DONE + { 0x3E, PacketTypesIn.Respawn }, // Changed in 1.19 (Heavy changes) { 0x3F, PacketTypesIn.EntityHeadLook }, // (Wiki name: Rotate Head) { 0x40, PacketTypesIn.MultiBlockChange }, // (Wiki name: Sections Block Update) { 0x41, PacketTypesIn.SelectAdvancementTab }, // @@ -102,7 +102,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes { 0x5D, PacketTypesIn.SetTitleText }, // (Wiki name: Set Title) { 0x5E, PacketTypesIn.SetTitleTime }, // (Wiki name: Set Titles Animation) { 0x5F, PacketTypesIn.EntitySoundEffect }, // (Wiki name: Sound Entity) - { 0x60, PacketTypesIn.SoundEffect }, // Changed in 1.19 (Added "Seed" field) (Wiki name: Sound Effect) - DONE (No need to be implemented) + { 0x60, PacketTypesIn.SoundEffect }, // Changed in 1.19 (Added "Seed" field) (Wiki name: Sound Effect) (No need to be implemented) { 0x61, PacketTypesIn.StopSound }, // { 0x62, PacketTypesIn.SystemChat }, // Added in 1.19 (Wiki name: System Chat Message) { 0x63, PacketTypesIn.PlayerListHeaderAndFooter }, // (Wiki name: Tab List) @@ -111,7 +111,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes { 0x66, PacketTypesIn.EntityTeleport }, // (Wiki name: Teleport Entity) { 0x67, PacketTypesIn.Advancements }, // (Wiki name: Update Advancements) { 0x68, PacketTypesIn.EntityProperties }, // (Wiki name: Update Attributes) - { 0x69, PacketTypesIn.EntityEffect }, // Changed in 1.19 (Added "Has Factor Data" and "Factor Codec" fields) (Wiki name: Entity Effect) - DONE + { 0x69, PacketTypesIn.EntityEffect }, // Changed in 1.19 (Added "Has Factor Data" and "Factor Codec" fields) (Wiki name: Entity Effect) { 0x6A, PacketTypesIn.DeclareRecipes }, // (Wiki name: Update Recipes) { 0x6B, PacketTypesIn.Tags }, // (Wiki name: Update Tags) }; @@ -147,7 +147,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes { 0x1A, PacketTypesOut.PickItem }, // { 0x1B, PacketTypesOut.CraftRecipeRequest }, // (Wiki name: Place recipe) { 0x1C, PacketTypesOut.PlayerAbilities }, // - { 0x1D, PacketTypesOut.PlayerDigging }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Player Action) - DONE + { 0x1D, PacketTypesOut.PlayerDigging }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Player Action) { 0x1E, PacketTypesOut.EntityAction }, // (Wiki name: Player Command) { 0x1F, PacketTypesOut.SteerVehicle }, // (Wiki name: Player Input) { 0x20, PacketTypesOut.Pong }, // (Wiki name: Pong (play)) @@ -157,7 +157,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes { 0x24, PacketTypesOut.ResourcePackStatus }, // (Wiki name: Resource Pack (serverbound)) { 0x25, PacketTypesOut.AdvancementTab }, // (Wiki name: Seen Advancements) { 0x26, PacketTypesOut.SelectTrade }, // - { 0x27, PacketTypesOut.SetBeaconEffect }, // Changed in 1.19 (Added a "Secondary Effect Present" and "Secondary Effect" fields) (Wiki name: Set Beacon) - DONE - (No need to be implemented) + { 0x27, PacketTypesOut.SetBeaconEffect }, // Changed in 1.19 (Added a "Secondary Effect Present" and "Secondary Effect" fields) (Wiki name: Set Beacon) - (No need to be implemented) { 0x28, PacketTypesOut.HeldItemChange }, // (Wiki name: Set Carried Item (serverbound)) { 0x29, PacketTypesOut.UpdateCommandBlock }, // (Wiki name: Set Command Block) { 0x2A, PacketTypesOut.UpdateCommandBlockMinecart }, // @@ -167,8 +167,8 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes { 0x2E, PacketTypesOut.UpdateSign }, // (Wiki name: Sign Update) { 0x2F, PacketTypesOut.Animation }, // (Wiki name: Swing) { 0x30, PacketTypesOut.Spectate }, // (Wiki name: Teleport To Entity) - { 0x31, PacketTypesOut.PlayerBlockPlacement }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item On) - DONE - { 0x32, PacketTypesOut.UseItem }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item) - DONE + { 0x31, PacketTypesOut.PlayerBlockPlacement }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item On) + { 0x32, PacketTypesOut.UseItem }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item) }; protected override Dictionary GetListIn() diff --git a/MinecraftClient/Protocol/Handlers/PacketPalettes/PacketPalette1193.cs b/MinecraftClient/Protocol/Handlers/PacketPalettes/PacketPalette1193.cs new file mode 100644 index 00000000..e1cae885 --- /dev/null +++ b/MinecraftClient/Protocol/Handlers/PacketPalettes/PacketPalette1193.cs @@ -0,0 +1,183 @@ +using System.Collections.Generic; + +namespace MinecraftClient.Protocol.Handlers.PacketPalettes +{ + public class PacketPalette1193 : PacketTypePalette + { + private readonly Dictionary typeIn = new() + { + { 0x00, PacketTypesIn.SpawnEntity }, // Changed in 1.19 (Wiki name: Spawn Entity) + { 0x01, PacketTypesIn.SpawnExperienceOrb }, // (Wiki name: Spawn Exeprience Orb) + { 0x02, PacketTypesIn.SpawnPlayer }, // + { 0x03, PacketTypesIn.EntityAnimation }, // (Wiki name: Entity Animation (clientbound)) + { 0x04, PacketTypesIn.Statistics }, // (Wiki name: Award Statistics) + { 0x05, PacketTypesIn.BlockChangedAck }, // Added 1.19 (Wiki name: Acknowledge Block Change) + { 0x06, PacketTypesIn.BlockBreakAnimation }, // (Wiki name: Set Block Destroy Stage) + { 0x07, PacketTypesIn.BlockEntityData }, // + { 0x08, PacketTypesIn.BlockAction }, // + { 0x09, PacketTypesIn.BlockChange }, // (Wiki name: Block Update) + { 0x0A, PacketTypesIn.BossBar }, // + { 0x0B, PacketTypesIn.ServerDifficulty }, // (Wiki name: Change Difficulty) + { 0x0C, PacketTypesIn.ClearTiles }, // + { 0x0D, PacketTypesIn.TabComplete }, // (Wiki name: Command Suggestions Response) + { 0x0E, PacketTypesIn.DeclareCommands }, // (Wiki name: Commands) + { 0x0F, PacketTypesIn.CloseWindow }, // (Wiki name: Close Container (clientbound)) + { 0x10, PacketTypesIn.WindowItems }, // (Wiki name: Set Container Content) + { 0x11, PacketTypesIn.WindowProperty }, // (Wiki name: Set Container Property) + { 0x12, PacketTypesIn.SetSlot }, // (Wiki name: Set Container Slot) + { 0x13, PacketTypesIn.SetCooldown }, // + { 0x14, PacketTypesIn.ChatSuggestions }, // Added in 1.19.1 + { 0x15, PacketTypesIn.PluginMessage }, // (Wiki name: Plugin Message (clientbound)) + { 0x16, PacketTypesIn.HideMessage }, // Added in 1.19.1 + { 0x17, PacketTypesIn.Disconnect }, // + { 0x18, PacketTypesIn.ProfilelessChatMessage }, // Added in 1.19.3 (Wiki name: Disguised Chat Message) + { 0x19, PacketTypesIn.EntityStatus }, // (Wiki name: Entity Event) + { 0x1A, PacketTypesIn.Explosion }, // Changed in 1.19 (Location fields are now Double instead of Float) (Wiki name: Explosion) + { 0x1B, PacketTypesIn.UnloadChunk }, // (Wiki name: Forget Chunk) + { 0x1C, PacketTypesIn.ChangeGameState }, // (Wiki name: Game Event) + { 0x1D, PacketTypesIn.OpenHorseWindow }, // (Wiki name: Horse Screen Open) + { 0x1E, PacketTypesIn.InitializeWorldBorder }, // + { 0x1F, PacketTypesIn.KeepAlive }, // + { 0x20, PacketTypesIn.ChunkData }, // + { 0x21, PacketTypesIn.Effect }, // (Wiki name: World Event) + { 0x22, PacketTypesIn.Particle }, // Changed in 1.19 ("Particle Data" field is now "Max Speed", it's the same Float data type) (Wiki name: Level Particle) (No need to be implemented) + { 0x23, PacketTypesIn.UpdateLight }, // (Wiki name: Light Update) + { 0x24, PacketTypesIn.JoinGame }, // Changed in 1.19 (lot's of changes) (Wiki name: Login (play)) + { 0x25, PacketTypesIn.MapData }, // (Wiki name: Map Item Data) + { 0x26, PacketTypesIn.TradeList }, // (Wiki name: Merchant Offers) + { 0x27, PacketTypesIn.EntityPosition }, // (Wiki name: Move Entity Position) + { 0x28, PacketTypesIn.EntityPositionAndRotation }, // (Wiki name: Move Entity Position and Rotation) + { 0x29, PacketTypesIn.EntityRotation }, // (Wiki name: Move Entity Rotation) + { 0x2A, PacketTypesIn.VehicleMove }, // (Wiki name: Move Vehicle) + { 0x2B, PacketTypesIn.OpenBook }, // + { 0x2C, PacketTypesIn.OpenWindow }, // (Wiki name: Open Screen) + { 0x2D, PacketTypesIn.OpenSignEditor }, // + { 0x2E, PacketTypesIn.Ping }, // (Wiki name: Ping (play)) + { 0x2F, PacketTypesIn.CraftRecipeResponse }, // (Wiki name: Place Ghost Recipe) + { 0x30, PacketTypesIn.PlayerAbilities }, // + { 0x31, PacketTypesIn.ChatMessage }, // Changed in 1.19 (Completely changed) (Wiki name: Player Chat Message) - TODO + { 0x32, PacketTypesIn.EndCombatEvent }, // (Wiki name: Player Combat End) + { 0x33, PacketTypesIn.EnterCombatEvent }, // (Wiki name: Player Combat Enter) + { 0x34, PacketTypesIn.DeathCombatEvent }, // (Wiki name: Player Combat Kill) + { 0x35, PacketTypesIn.PlayerRemove }, // Added in 1.19.3 (Not used) + { 0x36, PacketTypesIn.PlayerInfo }, // Changed in 1.19 (Heavy changes) + { 0x37, PacketTypesIn.FacePlayer }, // (Wiki name: Player Look At) + { 0x38, PacketTypesIn.PlayerPositionAndLook }, // (Wiki name: Player Position) + { 0x39, PacketTypesIn.UnlockRecipes }, // (Wiki name: Recipe) + { 0x3A, PacketTypesIn.DestroyEntities }, // (Wiki name: Remove Entites) + { 0x3B, PacketTypesIn.RemoveEntityEffect }, // + { 0x3C, PacketTypesIn.ResourcePackSend }, // (Wiki name: Resource Pack) + { 0x3D, PacketTypesIn.Respawn }, // Changed in 1.19 (Heavy changes) + { 0x3E, PacketTypesIn.EntityHeadLook }, // (Wiki name: Rotate Head) + { 0x3F, PacketTypesIn.MultiBlockChange }, // (Wiki name: Sections Block Update) + { 0x40, PacketTypesIn.SelectAdvancementTab }, // + { 0x41, PacketTypesIn.ServerData }, // Added in 1.19 + { 0x42, PacketTypesIn.ActionBar }, // (Wiki name: Set Action Bar Text) + { 0x43, PacketTypesIn.WorldBorderCenter }, // (Wiki name: Set Border Center) + { 0x44, PacketTypesIn.WorldBorderLerpSize }, // + { 0x45, PacketTypesIn.WorldBorderSize }, // (Wiki name: Set World Border Size) + { 0x46, PacketTypesIn.WorldBorderWarningDelay }, // (Wiki name: Set World Border Warning Delay) + { 0x47, PacketTypesIn.WorldBorderWarningReach }, // (Wiki name: Set Border Warning Distance) + { 0x48, PacketTypesIn.Camera }, // (Wiki name: Set Camera) + { 0x49, PacketTypesIn.HeldItemChange }, // (Wiki name: Set Carried Item (clientbound)) + { 0x4A, PacketTypesIn.UpdateViewPosition }, // (Wiki name: Set Chunk Cache Center) + { 0x4B, PacketTypesIn.UpdateViewDistance }, // (Wiki name: Set Chunk Cache Radius) + { 0x4C, PacketTypesIn.SpawnPosition }, // (Wiki name: Set Default Spawn Position) + { 0x4D, PacketTypesIn.DisplayScoreboard }, // (Wiki name: Set Display Objective) + { 0x4E, PacketTypesIn.EntityMetadata }, // (Wiki name: Set Entity Metadata) + { 0x4F, PacketTypesIn.AttachEntity }, // (Wiki name: Set Entity Link) + { 0x50, PacketTypesIn.EntityVelocity }, // (Wiki name: Set Entity Motion) + { 0x51, PacketTypesIn.EntityEquipment }, // (Wiki name: Set Equipment) + { 0x52, PacketTypesIn.SetExperience }, // + { 0x53, PacketTypesIn.UpdateHealth }, // (Wiki name: Set Health) + { 0x54, PacketTypesIn.ScoreboardObjective }, // (Wiki name: Set Objective) + { 0x55, PacketTypesIn.SetPassengers }, // + { 0x56, PacketTypesIn.Teams }, // (Wiki name: Set Player Team) + { 0x57, PacketTypesIn.UpdateScore }, // (Wiki name: Set Score) + { 0x58, PacketTypesIn.UpdateSimulationDistance }, // (Wiki name: Set Simulation Distance) + { 0x59, PacketTypesIn.SetTitleSubTitle }, // (Wiki name: Set Subtitle Test) + { 0x5A, PacketTypesIn.TimeUpdate }, // (Wiki name: Set Time) + { 0x5B, PacketTypesIn.SetTitleText }, // (Wiki name: Set Title) + { 0x5C, PacketTypesIn.SetTitleTime }, // (Wiki name: Set Titles Animation) + { 0x5D, PacketTypesIn.EntitySoundEffect }, // (Wiki name: Sound Entity) + { 0x5E, PacketTypesIn.SoundEffect }, // Changed in 1.19 (Added "Seed" field) (Wiki name: Sound Effect) (No need to be implemented) + { 0x5F, PacketTypesIn.StopSound }, // + { 0x60, PacketTypesIn.SystemChat }, // Added in 1.19 (Wiki name: System Chat Message) + { 0x61, PacketTypesIn.PlayerListHeaderAndFooter }, // (Wiki name: Tab List) + { 0x62, PacketTypesIn.NBTQueryResponse }, // (Wiki name: Tab Query) + { 0x63, PacketTypesIn.CollectItem }, // (Wiki name: Take Item Entity) + { 0x64, PacketTypesIn.EntityTeleport }, // (Wiki name: Teleport Entity) + { 0x65, PacketTypesIn.Advancements }, // (Wiki name: Update Advancements) + { 0x66, PacketTypesIn.EntityProperties }, // (Wiki name: Update Attributes) + { 0x67, PacketTypesIn.FeatureFlags }, // Added in 1.19.3 (Not yet clear what is the purpose of this packet) + { 0x68, PacketTypesIn.EntityEffect }, // Changed in 1.19 (Added "Has Factor Data" and "Factor Codec" fields) (Wiki name: Entity Effect) + { 0x69, PacketTypesIn.DeclareRecipes }, // (Wiki name: Update Recipes) + { 0x6A, PacketTypesIn.Tags }, // (Wiki name: Update Tags) + }; + + private readonly Dictionary typeOut = new() + { + { 0x00, PacketTypesOut.TeleportConfirm }, // (Wiki name: Confirm Teleportation) + { 0x01, PacketTypesOut.QueryBlockNBT }, // (Wiki name: Query Block Entity Tag) + { 0x02, PacketTypesOut.SetDifficulty }, // (Wiki name: Change Difficutly) + { 0x03, PacketTypesOut.MessageAcknowledgment }, // Added in 1.19.1 + { 0x04, PacketTypesOut.ChatCommand }, // Added in 1.19 + { 0x05, PacketTypesOut.ChatMessage }, // Changed in 1.19 (Completely changed) (Wiki name: Chat) + { 0x06, PacketTypesOut.ClientStatus }, // (Wiki name: Client Command) + { 0x07, PacketTypesOut.ClientSettings }, // (Wiki name: Client Information) + { 0x08, PacketTypesOut.TabComplete }, // (Wiki name: Command Suggestions Request) + { 0x09, PacketTypesOut.ClickWindowButton }, // (Wiki name: Click Container Button) + { 0x0A, PacketTypesOut.ClickWindow }, // (Wiki name: Click Container) + { 0x0B, PacketTypesOut.CloseWindow }, // (Wiki name: Close Container (serverbound)) + { 0x0C, PacketTypesOut.PluginMessage }, // (Wiki name: Plugin Message (serverbound)) + { 0x0D, PacketTypesOut.EditBook }, // + { 0x0E, PacketTypesOut.EntityNBTRequest }, // (Wiki name: Query Entity Tag) + { 0x0F, PacketTypesOut.InteractEntity }, // (Wiki name: Interact) + { 0x10, PacketTypesOut.GenerateStructure }, // (Wiki name: Jigsaw Generate) + { 0x11, PacketTypesOut.KeepAlive }, // + { 0x12, PacketTypesOut.LockDifficulty }, // + { 0x13, PacketTypesOut.PlayerPosition }, // (Wiki name: Move Player Position) + { 0x14, PacketTypesOut.PlayerPositionAndRotation }, // (Wiki name: Set Player Position and Rotation) + { 0x15, PacketTypesOut.PlayerRotation }, // (Wiki name: Set Player Rotation) + { 0x16, PacketTypesOut.PlayerMovement }, // (Wiki name: Set Player On Ground) + { 0x17, PacketTypesOut.VehicleMove }, // (Wiki name: Move Vehicle (serverbound)) + { 0x18, PacketTypesOut.SteerBoat }, // (Wiki name: Paddle Boat) + { 0x19, PacketTypesOut.PickItem }, // + { 0x1A, PacketTypesOut.CraftRecipeRequest }, // (Wiki name: Place recipe) + { 0x1B, PacketTypesOut.PlayerAbilities }, // + { 0x1C, PacketTypesOut.PlayerDigging }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Player Action) + { 0x1D, PacketTypesOut.EntityAction }, // (Wiki name: Player Command) + { 0x1E, PacketTypesOut.SteerVehicle }, // (Wiki name: Player Input) + { 0x1F, PacketTypesOut.Pong }, // (Wiki name: Pong (play)) + { 0x20, PacketTypesOut.PlayerSession }, // Added in 1.19.3 + { 0x21, PacketTypesOut.SetDisplayedRecipe }, // (Wiki name: Recipe Book Change Settings) + { 0x22, PacketTypesOut.SetRecipeBookState }, // (Wiki name: Recipe Book Seen Recipe) + { 0x23, PacketTypesOut.NameItem }, // (Wiki name: Rename Item) + { 0x24, PacketTypesOut.ResourcePackStatus }, // (Wiki name: Resource Pack (serverbound)) + { 0x25, PacketTypesOut.AdvancementTab }, // (Wiki name: Seen Advancements) + { 0x26, PacketTypesOut.SelectTrade }, // + { 0x27, PacketTypesOut.SetBeaconEffect }, // Changed in 1.19 (Added a "Secondary Effect Present" and "Secondary Effect" fields) (Wiki name: Set Beacon) - (No need to be implemented) + { 0x28, PacketTypesOut.HeldItemChange }, // (Wiki name: Set Carried Item (serverbound)) + { 0x29, PacketTypesOut.UpdateCommandBlock }, // (Wiki name: Set Command Block) + { 0x2A, PacketTypesOut.UpdateCommandBlockMinecart }, // + { 0x2B, PacketTypesOut.CreativeInventoryAction }, // (Wiki name: Set Creative Mode Slot) + { 0x2C, PacketTypesOut.UpdateJigsawBlock }, // (Wiki name: Set Jigsaw Block) + { 0x2D, PacketTypesOut.UpdateStructureBlock }, // (Wiki name: Set Structure Block) + { 0x2E, PacketTypesOut.UpdateSign }, // (Wiki name: Sign Update) + { 0x2F, PacketTypesOut.Animation }, // (Wiki name: Swing) + { 0x30, PacketTypesOut.Spectate }, // (Wiki name: Teleport To Entity) + { 0x31, PacketTypesOut.PlayerBlockPlacement }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item On) + { 0x32, PacketTypesOut.UseItem }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item) + }; + + protected override Dictionary GetListIn() + { + return typeIn; + } + + protected override Dictionary GetListOut() + { + return typeOut; + } + } +} \ No newline at end of file diff --git a/MinecraftClient/Protocol/Handlers/PacketType18Handler.cs b/MinecraftClient/Protocol/Handlers/PacketType18Handler.cs index 20e4ce02..110a1efc 100644 --- a/MinecraftClient/Protocol/Handlers/PacketType18Handler.cs +++ b/MinecraftClient/Protocol/Handlers/PacketType18Handler.cs @@ -47,7 +47,7 @@ namespace MinecraftClient.Protocol.Handlers public PacketTypePalette GetTypeHandler(int protocol) { PacketTypePalette p; - if (protocol > Protocol18Handler.MC_1_19_2_Version) + if (protocol > Protocol18Handler.MC_1_19_3_Version) throw new NotImplementedException(Translations.exception_palette_packet); if (protocol <= Protocol18Handler.MC_1_8_Version) @@ -74,8 +74,10 @@ namespace MinecraftClient.Protocol.Handlers p = new PacketPalette118(); else if (protocol <= Protocol18Handler.MC_1_19_Version) p = new PacketPalette119(); - else + else if (protocol <= Protocol18Handler.MC_1_19_2_Version) p = new PacketPalette1192(); + else + p = new PacketPalette1193(); p.SetForgeEnabled(forgeEnabled); return p; diff --git a/MinecraftClient/Protocol/Handlers/PacketTypesIn.cs b/MinecraftClient/Protocol/Handlers/PacketTypesIn.cs index 4f7c5326..8529fd0a 100644 --- a/MinecraftClient/Protocol/Handlers/PacketTypesIn.cs +++ b/MinecraftClient/Protocol/Handlers/PacketTypesIn.cs @@ -51,6 +51,7 @@ EntityVelocity, // Explosion, // FacePlayer, // + FeatureFlags, // Added in 1.19.3 HeldItemChange, // HideMessage, // Added in 1.19.1 (1.19.2) InitializeWorldBorder, // @@ -71,8 +72,10 @@ PlayerAbilities, // PlayerInfo, // PlayerListHeaderAndFooter, // + PlayerRemove, // Added in 1.19.3 (Not used) PlayerPositionAndLook, // PluginMessage, // + ProfilelessChatMessage, // Added in 1.19.3 RemoveEntityEffect, // ResourcePackSend, // Respawn, // diff --git a/MinecraftClient/Protocol/Handlers/PacketTypesOut.cs b/MinecraftClient/Protocol/Handlers/PacketTypesOut.cs index 4c1d3346..fd3fe7c9 100644 --- a/MinecraftClient/Protocol/Handlers/PacketTypesOut.cs +++ b/MinecraftClient/Protocol/Handlers/PacketTypesOut.cs @@ -36,6 +36,7 @@ PlayerPosition, // PlayerPositionAndRotation, // PlayerRotation, // + PlayerSession, // Added in 1.19.3 PluginMessage, // Pong, // PrepareCraftingGrid, // For 1.12 - 1.12.1 only diff --git a/MinecraftClient/Protocol/Handlers/Protocol16.cs b/MinecraftClient/Protocol/Handlers/Protocol16.cs index 9bb7efcf..b2e73863 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol16.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol16.cs @@ -118,7 +118,7 @@ namespace MinecraftClient.Protocol.Handlers case 0x02: ReadData(1); ReadNextString(); ReadNextString(); ReadData(4); break; case 0x03: string message = ReadNextString(); - handler.OnTextReceived(new ChatMessage(message, protocolversion >= 72, 0, Guid.Empty)); break; + handler.OnTextReceived(new ChatMessage(message, null, protocolversion >= 72, -1, Guid.Empty)); break; case 0x04: ReadData(16); break; case 0x05: ReadData(6); ReadNextItemSlot(); break; case 0x06: ReadData(12); break; @@ -909,5 +909,10 @@ namespace MinecraftClient.Protocol.Handlers { return false; //Currently not implemented } + + public bool SendPlayerSession(PlayerKeyPair? playerKeyPair) + { + return false; + } } } diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs index 1a3123c1..022aa14b 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs @@ -63,6 +63,7 @@ namespace MinecraftClient.Protocol.Handlers internal const int MC_1_18_2_Version = 758; internal const int MC_1_19_Version = 759; internal const int MC_1_19_2_Version = 760; + internal const int MC_1_19_3_Version = 761; private int compression_treshold = 0; private int autocomplete_transaction_id = 0; @@ -74,9 +75,11 @@ namespace MinecraftClient.Protocol.Handlers private readonly BlockingCollection>> packetQueue = new(); private float LastYaw, LastPitch; - private int pendingAcknowledgments = 0; - private readonly LastSeenMessagesCollector lastSeenMessagesCollector = new(5); - private LastSeenMessageList.Entry? lastReceivedMessage = null; + private object MessageSigningLock = new(); + private Guid chatUuid = Guid.Empty; + private int pendingAcknowledgments = 0, messageIndex = 0; + private LastSeenMessagesCollector lastSeenMessagesCollector; + private LastSeenMessageList.AcknowledgedMessage? lastReceivedMessage = null; readonly Protocol18Forge pForge; readonly Protocol18Terrain pTerrain; readonly IMinecraftComHandler handler; @@ -103,29 +106,32 @@ namespace MinecraftClient.Protocol.Handlers packetPalette = new PacketTypeHandler(protocolVersion, forgeInfo != null).GetTypeHandler(); log = handler.GetLogger(); randomGen = RandomNumberGenerator.Create(); + lastSeenMessagesCollector = protocolVersion >= MC_1_19_3_Version ? new(20) : new(5); - if (handler.GetTerrainEnabled() && protocolVersion > MC_1_19_2_Version) + if (handler.GetTerrainEnabled() && protocolVersion > MC_1_19_3_Version) { log.Error("§c" + Translations.extra_terrainandmovement_disabled); handler.SetTerrainEnabled(false); } - if (handler.GetInventoryEnabled() && (protocolVersion < MC_1_10_Version || protocolVersion > MC_1_19_2_Version)) + if (handler.GetInventoryEnabled() && (protocolVersion < MC_1_10_Version || protocolVersion > MC_1_19_3_Version)) { log.Error("§c" + Translations.extra_inventory_disabled); handler.SetInventoryEnabled(false); } - if (handler.GetEntityHandlingEnabled() && (protocolVersion < MC_1_10_Version || protocolVersion > MC_1_19_2_Version)) + if (handler.GetEntityHandlingEnabled() && (protocolVersion < MC_1_10_Version || protocolVersion > MC_1_19_3_Version)) { log.Error("§c" + Translations.extra_entity_disabled); handler.SetEntityHandlingEnabled(false); } // Block palette - if (protocolVersion > MC_1_19_2_Version && handler.GetTerrainEnabled()) + if (protocolVersion > MC_1_19_3_Version && handler.GetTerrainEnabled()) throw new NotImplementedException(Translations.exception_palette_block); - if (protocolVersion >= MC_1_19_Version) + if (protocolVersion >= MC_1_19_3_Version) + Block.Palette = new Palette1193(); + else if (protocolVersion >= MC_1_19_Version) Block.Palette = new Palette119(); else if (protocolVersion >= MC_1_17_Version) Block.Palette = new Palette117(); @@ -141,10 +147,12 @@ namespace MinecraftClient.Protocol.Handlers Block.Palette = new Palette112(); // Entity palette - if (protocolVersion > MC_1_19_2_Version && handler.GetEntityHandlingEnabled()) + if (protocolVersion > MC_1_19_3_Version && handler.GetEntityHandlingEnabled()) throw new NotImplementedException(Translations.exception_palette_entity); - if (protocolVersion >= MC_1_19_Version) + if (protocolVersion >= MC_1_19_3_Version) + entityPalette = new EntityPalette1193(); + else if (protocolVersion >= MC_1_19_Version) entityPalette = new EntityPalette119(); else if (protocolVersion >= MC_1_17_Version) entityPalette = new EntityPalette117(); @@ -162,10 +170,12 @@ namespace MinecraftClient.Protocol.Handlers entityPalette = new EntityPalette112(); // Item palette - if (protocolVersion > MC_1_19_2_Version && handler.GetInventoryEnabled()) + if (protocolVersion > MC_1_19_3_Version && handler.GetInventoryEnabled()) throw new NotImplementedException(Translations.exception_palette_item); - if (protocolVersion >= MC_1_19_Version) + if (protocolVersion >= MC_1_19_3_Version) + itemPalette = new ItemPalette1193(); + else if (protocolVersion >= MC_1_19_Version) itemPalette = new ItemPalette119(); else if (protocolVersion >= MC_1_18_1_Version) itemPalette = new ItemPalette118(); @@ -357,7 +367,7 @@ namespace MinecraftClient.Protocol.Handlers SendPacket(PacketTypesOut.Pong, packetData); break; case PacketTypesIn.JoinGame: - handler.OnGameJoined(); + handler.OnGameJoined(isOnlineMode); int playerEntityID = dataTypes.ReadNextInt(packetData); handler.OnReceivePlayerEntityID(playerEntityID); @@ -373,6 +383,8 @@ namespace MinecraftClient.Protocol.Handlers for (int i = 0; i < worldCount; i++) dataTypes.ReadNextString(packetData); // Dimension Names (World Names) - 1.16 and above var registryCodec = dataTypes.ReadNextNbt(packetData); // Registry Codec (Dimension Codec) - 1.16 and above + if (protocolVersion >= MC_1_19_Version) + ChatParser.ReadChatType(registryCodec); if (handler.GetTerrainEnabled()) World.StoreDimensionList(registryCodec); } @@ -450,10 +462,14 @@ namespace MinecraftClient.Protocol.Handlers dataTypes.ReadNextLocation(packetData); // Death location } } + break; case PacketTypesIn.DeclareCommands: if (protocolVersion >= MC_1_19_Version) - DeclareCommands.Read(dataTypes, packetData); + { + DeclareCommands.Read(dataTypes, packetData, protocolVersion); + handler.OnDeclareCommands(); + } break; case PacketTypesIn.ChatMessage: int messageType = 0; @@ -478,7 +494,7 @@ namespace MinecraftClient.Protocol.Handlers else senderUUID = Guid.Empty; - handler.OnTextReceived(new(message, true, messageType, senderUUID)); + handler.OnTextReceived(new(message, null, true, messageType, senderUUID)); } else if (protocolVersion == MC_1_19_Version) // 1.19 { @@ -518,8 +534,9 @@ namespace MinecraftClient.Protocol.Handlers ChatMessage chat = new(signedChat, true, messageType, senderUUID, unsignedChatContent, senderDisplayName, senderTeamName, timestamp, messageSignature, verifyResult); handler.OnTextReceived(chat); } - else // 1.19.1 + + else if (protocolVersion == MC_1_19_2_Version) { + // 1.19.1 - 1.19.2 byte[]? precedingSignature = dataTypes.ReadNextBool(packetData) ? dataTypes.ReadNextByteArray(packetData) : null; Guid senderUUID = dataTypes.ReadNextUUID(packetData); byte[] headerSignature = dataTypes.ReadNextByteArray(packetData); @@ -531,19 +548,19 @@ namespace MinecraftClient.Protocol.Handlers long salt = dataTypes.ReadNextLong(packetData); int lastSeenMessageListLen = dataTypes.ReadNextVarInt(packetData); - LastSeenMessageList.Entry[] lastSeenMessageList = new LastSeenMessageList.Entry[lastSeenMessageListLen]; + LastSeenMessageList.AcknowledgedMessage[] lastSeenMessageList = new LastSeenMessageList.AcknowledgedMessage[lastSeenMessageListLen]; for (int i = 0; i < lastSeenMessageListLen; ++i) { Guid user = dataTypes.ReadNextUUID(packetData); byte[] lastSignature = dataTypes.ReadNextByteArray(packetData); - lastSeenMessageList[i] = new(user, lastSignature); + lastSeenMessageList[i] = new(user, lastSignature, true); } LastSeenMessageList lastSeenMessages = new(lastSeenMessageList); string? unsignedChatContent = dataTypes.ReadNextBool(packetData) ? dataTypes.ReadNextString(packetData) : null; - int filterEnum = dataTypes.ReadNextVarInt(packetData); - if (filterEnum == 2) // PARTIALLY_FILTERED + MessageFilterType filterEnum = (MessageFilterType)dataTypes.ReadNextVarInt(packetData); + if (filterEnum == MessageFilterType.PartiallyFiltered) dataTypes.ReadNextULongArray(packetData); int chatTypeId = dataTypes.ReadNextVarInt(packetData); @@ -595,6 +612,136 @@ namespace MinecraftClient.Protocol.Handlers Acknowledge(chat); handler.OnTextReceived(chat); } + else if (protocolVersion >= MC_1_19_3_Version) + { + // 1.19.3+ + // Header section + // net.minecraft.network.packet.s2c.play.ChatMessageS2CPacket#write + Guid senderUUID = dataTypes.ReadNextUUID(packetData); + int index = dataTypes.ReadNextVarInt(packetData); + // Signature is fixed size of 256 bytes + byte[]? messageSignature = dataTypes.ReadNextBool(packetData) ? dataTypes.ReadNextByteArray(packetData, 256) : null; + + // Body + // net.minecraft.network.message.MessageBody.Serialized#write + string message = dataTypes.ReadNextString(packetData); + long timestamp = dataTypes.ReadNextLong(packetData); + long salt = dataTypes.ReadNextLong(packetData); + + // Previous Messages + // net.minecraft.network.message.LastSeenMessageList.Indexed#write + // net.minecraft.network.message.MessageSignatureData.Indexed#write + int totalPreviousMessages = dataTypes.ReadNextVarInt(packetData); + Tuple[] previousMessageSignatures = new Tuple[totalPreviousMessages]; + for (int i = 0; i < totalPreviousMessages; i++) + { + // net.minecraft.network.message.MessageSignatureData.Indexed#fromBuf + int messageId = dataTypes.ReadNextVarInt(packetData) - 1; + if (messageId == -1) + previousMessageSignatures[i] = new Tuple(messageId, dataTypes.ReadNextByteArray(packetData, 256)); + else + previousMessageSignatures[i] = new Tuple(messageId, null); + } + + // Other + string? unsignedChatContent = dataTypes.ReadNextBool(packetData) ? dataTypes.ReadNextString(packetData) : null; + + MessageFilterType filterType = (MessageFilterType)dataTypes.ReadNextVarInt(packetData); + + if (filterType == MessageFilterType.PartiallyFiltered) + dataTypes.ReadNextULongArray(packetData); + + // Network Target + // net.minecraft.network.message.MessageType.Serialized#write + int chatTypeId = dataTypes.ReadNextVarInt(packetData); + string chatName = dataTypes.ReadNextString(packetData); + string? targetName = dataTypes.ReadNextBool(packetData) ? dataTypes.ReadNextString(packetData) : null; + + ChatParser.MessageType messageTypeEnum = ChatParser.ChatId2Type!.GetValueOrDefault(chatTypeId, ChatParser.MessageType.CHAT); + + Dictionary chatInfo = Json.ParseJson(targetName ?? chatName).Properties; + string senderDisplayName = (chatInfo.ContainsKey("insertion") ? chatInfo["insertion"] : chatInfo["text"]).StringValue; + string? senderTeamName = null; + if (targetName != null && + (messageTypeEnum == ChatParser.MessageType.TEAM_MSG_COMMAND_INCOMING || messageTypeEnum == ChatParser.MessageType.TEAM_MSG_COMMAND_OUTGOING)) + senderTeamName = Json.ParseJson(targetName).Properties["with"].DataArray[0].Properties["text"].StringValue; + + if (string.IsNullOrWhiteSpace(senderDisplayName)) + { + PlayerInfo? player = handler.GetPlayerInfo(senderUUID); + if (player != null && (player.DisplayName != null || player.Name != null) && string.IsNullOrWhiteSpace(senderDisplayName)) + { + senderDisplayName = ChatParser.ParseText(player.DisplayName ?? player.Name); + if (string.IsNullOrWhiteSpace(senderDisplayName)) + senderDisplayName = player.DisplayName ?? player.Name; + else + senderDisplayName += "§r"; + } + } + + bool verifyResult; + if (!isOnlineMode || messageSignature == null) + verifyResult = false; + else + { + if (senderUUID == handler.GetUserUuid()) + verifyResult = true; + else + { + PlayerInfo? player = handler.GetPlayerInfo(senderUUID); + if (player == null || !player.IsMessageChainLegal()) + verifyResult = false; + else + { + verifyResult = false; + verifyResult = player.VerifyMessage(message, senderUUID, player.ChatUuid, index, timestamp, salt, ref messageSignature, previousMessageSignatures); + } + } + } + + ChatMessage chat = new(message, false, chatTypeId, senderUUID, unsignedChatContent, senderDisplayName, senderTeamName, timestamp, messageSignature, verifyResult); + lock (MessageSigningLock) + Acknowledge(chat); + handler.OnTextReceived(chat); + } + break; + case PacketTypesIn.HideMessage: + byte[] hideMessageSignature = dataTypes.ReadNextByteArray(packetData); + ConsoleIO.WriteLine($"HideMessage was not processed! (SigLen={hideMessageSignature.Length})"); + break; + case PacketTypesIn.SystemChat: + string systemMessage = dataTypes.ReadNextString(packetData); + if (protocolVersion >= MC_1_19_3_Version) + { + bool isOverlay = dataTypes.ReadNextBool(packetData); + if (isOverlay) + { + if (!Config.Main.Advanced.ShowXPBarMessages) + break; + } + else + { + if (!Config.Main.Advanced.ShowSystemMessages) + break; + } + handler.OnTextReceived(new(systemMessage, null, true, -1, Guid.Empty, true)); + } + else + { + int msgType = dataTypes.ReadNextVarInt(packetData); + if ((msgType == 1 && !Config.Main.Advanced.ShowSystemMessages)) + break; + handler.OnTextReceived(new(systemMessage, null, true, msgType, Guid.Empty, true)); + } + break; + case PacketTypesIn.ProfilelessChatMessage: + string message_ = dataTypes.ReadNextString(packetData); + int messageType_ = dataTypes.ReadNextVarInt(packetData); + string messageName = dataTypes.ReadNextString(packetData); + string? targetName_ = dataTypes.ReadNextBool(packetData) ? dataTypes.ReadNextString(packetData) : null; + ChatMessage profilelessChat = new(message_, targetName_ ?? messageName, true, messageType_, Guid.Empty, true); + profilelessChat.isSenderJson = true; + handler.OnTextReceived(profilelessChat); break; case PacketTypesIn.CombatEvent: // 1.8 - 1.16.5 @@ -623,8 +770,8 @@ namespace MinecraftClient.Protocol.Handlers ); break; - case PacketTypesIn.MessageHeader: - if (protocolVersion >= MC_1_19_2_Version) + case PacketTypesIn.MessageHeader: // 1.19.2 only + if (protocolVersion == MC_1_19_2_Version) { byte[]? precedingSignature = dataTypes.ReadNextBool(packetData) ? dataTypes.ReadNextByteArray(packetData) : null; Guid senderUUID = dataTypes.ReadNextUUID(packetData); @@ -652,6 +799,7 @@ namespace MinecraftClient.Protocol.Handlers } } } + break; case PacketTypesIn.Respawn: string? dimensionTypeNameRespawn = null; @@ -747,7 +895,7 @@ namespace MinecraftClient.Protocol.Handlers handler.UpdateLocation(location, yaw, pitch); // Teleport confirm packet - SendPacket(PacketTypesOut.TeleportConfirm, dataTypes.GetVarInt(teleportID)); + SendPacket(PacketTypesOut.TeleportConfirm, DataTypes.GetVarInt(teleportID)); if (Config.Main.Advanced.TemporaryFixBadpacket) { SendLocationUpdate(location, true, yaw, pitch, true); @@ -1102,7 +1250,9 @@ namespace MinecraftClient.Protocol.Handlers if (hasIcon) iconBase64 = dataTypes.ReadNextString(packetData); - bool previewsChat = dataTypes.ReadNextBool(packetData); + bool previewsChat = false; + if (protocolVersion < MC_1_19_3_Version) + previewsChat = dataTypes.ReadNextBool(packetData); handler.OnServerDataRecived(hasMotd, motd, hasIcon, iconBase64, previewsChat); break; @@ -1132,22 +1282,6 @@ namespace MinecraftClient.Protocol.Handlers case PacketTypesIn.SetDisplayChatPreview: bool previewsChatSetting = dataTypes.ReadNextBool(packetData); handler.OnChatPreviewSettingUpdate(previewsChatSetting); - break; - case PacketTypesIn.ChatPreview: - int queryID = dataTypes.ReadNextInt(packetData); - bool componentIsPresent = dataTypes.ReadNextBool(packetData); - - // Currently noy implemented - log.Debug("New chat preview: "); - log.Debug(">> Query ID: " + queryID); - log.Debug(">> Component is present: " + componentIsPresent); - if (componentIsPresent) - { - string message = dataTypes.ReadNextString(packetData); - log.Debug(">> Component: " + ChatParser.ParseText(message)); - //handler.OnTextReceived(message, true); - } - break; case PacketTypesIn.ChatSuggestions: break; @@ -1223,7 +1357,82 @@ namespace MinecraftClient.Protocol.Handlers } break; case PacketTypesIn.PlayerInfo: - if (protocolVersion >= MC_1_8_Version) + if (protocolVersion >= MC_1_19_3_Version) + { + byte actionBitset = dataTypes.ReadNextByte(packetData); + int numberOfActions = dataTypes.ReadNextVarInt(packetData); + for (int i = 0; i < numberOfActions; i++) + { + Guid playerUuid = dataTypes.ReadNextUUID(packetData); + + PlayerInfo player; + if ((actionBitset & (1 << 0)) > 0) // Actions bit 0: add player + { + string name = dataTypes.ReadNextString(packetData); + int numberOfProperties = dataTypes.ReadNextVarInt(packetData); + for (int j = 0; j < numberOfProperties; ++j) + { + dataTypes.SkipNextString(packetData); + dataTypes.SkipNextString(packetData); + if (dataTypes.ReadNextBool(packetData)) + dataTypes.SkipNextString(packetData); + } + player = new(name, playerUuid); + handler.OnPlayerJoin(player); + } + else + { + PlayerInfo? playerGet = handler.GetPlayerInfo(playerUuid); + if (playerGet == null) + { + player = new(string.Empty, playerUuid); + handler.OnPlayerJoin(player); + } + else + { + player = playerGet; + } + } + + if ((actionBitset & (1 << 1)) > 0) // Actions bit 1: initialize chat + { + bool hasSignatureData = dataTypes.ReadNextBool(packetData); + if (hasSignatureData) + { + Guid chatUuid = dataTypes.ReadNextUUID(packetData); + long publicKeyExpiryTime = dataTypes.ReadNextLong(packetData); + byte[] encodedPublicKey = dataTypes.ReadNextByteArray(packetData); + byte[] publicKeySignature = dataTypes.ReadNextByteArray(packetData); + player.SetPublicKey(chatUuid, publicKeyExpiryTime, encodedPublicKey, publicKeySignature); + } + else + { + player.ClearPublicKey(); + } + } + if ((actionBitset & 1 << 2) > 0) // Actions bit 2: update gamemode + { + handler.OnGamemodeUpdate(playerUuid, dataTypes.ReadNextVarInt(packetData)); + } + if ((actionBitset & (1 << 3)) > 0) // Actions bit 3: update listed + { + player.Listed = dataTypes.ReadNextBool(packetData); + } + if ((actionBitset & (1 << 4)) > 0) // Actions bit 4: update latency + { + int latency = dataTypes.ReadNextVarInt(packetData); + handler.OnLatencyUpdate(playerUuid, latency); //Update latency; + } + if ((actionBitset & (1 << 5)) > 0) // Actions bit 5: update display name + { + if (dataTypes.ReadNextBool(packetData)) + player.DisplayName = dataTypes.ReadNextString(packetData); + else + player.DisplayName = null; + } + } + } + else if (protocolVersion >= MC_1_8_Version) { int action = dataTypes.ReadNextVarInt(packetData); // Action Name int numberOfPlayers = dataTypes.ReadNextVarInt(packetData); // Number Of Players @@ -1323,6 +1532,14 @@ namespace MinecraftClient.Protocol.Handlers else handler.OnPlayerLeave(FakeUUID); } break; + case PacketTypesIn.PlayerRemove: + int numberOfLeavePlayers = dataTypes.ReadNextVarInt(packetData); + for (int i = 0; i < numberOfLeavePlayers; ++i) + { + Guid playerUuid = dataTypes.ReadNextUUID(packetData); + handler.OnPlayerLeave(playerUuid); + } + break; case PacketTypesIn.TabComplete: int old_transaction_id = autocomplete_transaction_id; if (protocolVersion >= MC_1_13_Version) @@ -1473,9 +1690,9 @@ namespace MinecraftClient.Protocol.Handlers //Send back "accepted" and "successfully loaded" responses for plugins or server config making use of resource pack mandatory byte[] responseHeader = Array.Empty(); if (protocolVersion < MC_1_10_Version) //MC 1.10 does not include resource pack hash in responses - responseHeader = dataTypes.ConcatBytes(dataTypes.GetVarInt(hash.Length), Encoding.UTF8.GetBytes(hash)); - SendPacket(PacketTypesOut.ResourcePackStatus, dataTypes.ConcatBytes(responseHeader, dataTypes.GetVarInt(3))); //Accepted pack - SendPacket(PacketTypesOut.ResourcePackStatus, dataTypes.ConcatBytes(responseHeader, dataTypes.GetVarInt(0))); //Successfully loaded + responseHeader = dataTypes.ConcatBytes(DataTypes.GetVarInt(hash.Length), Encoding.UTF8.GetBytes(hash)); + SendPacket(PacketTypesOut.ResourcePackStatus, dataTypes.ConcatBytes(responseHeader, DataTypes.GetVarInt(3))); //Accepted pack + SendPacket(PacketTypesOut.ResourcePackStatus, dataTypes.ConcatBytes(responseHeader, DataTypes.GetVarInt(0))); //Successfully loaded break; case PacketTypesIn.SpawnEntity: if (handler.GetEntityHandlingEnabled()) @@ -1648,7 +1865,7 @@ namespace MinecraftClient.Protocol.Handlers Dictionary metadata = dataTypes.ReadNextMetadata(packetData, itemPalette); int healthField; // See https://wiki.vg/Entity_metadata#Living_Entity - if (protocolVersion > MC_1_19_2_Version) + if (protocolVersion > MC_1_19_3_Version) throw new NotImplementedException(Translations.exception_palette_healthfield); else if (protocolVersion >= MC_1_17_Version) // 1.17 and above healthField = 9; @@ -1678,13 +1895,6 @@ namespace MinecraftClient.Protocol.Handlers long TimeOfday = dataTypes.ReadNextLong(packetData); handler.OnTimeUpdate(WorldAge, TimeOfday); break; - case PacketTypesIn.SystemChat: - string systemMessage = dataTypes.ReadNextString(packetData); - int msgType = dataTypes.ReadNextVarInt(packetData); - if ((msgType == 1 && !Config.Main.Advanced.ShowSystemMessages)) - break; - handler.OnTextReceived(new(systemMessage, true, msgType, Guid.Empty, true)); - break; case PacketTypesIn.EntityTeleport: if (handler.GetEntityHandlingEnabled()) { @@ -1710,12 +1920,27 @@ namespace MinecraftClient.Protocol.Handlers break; case PacketTypesIn.SetExperience: float experiencebar = dataTypes.ReadNextFloat(packetData); - int level = dataTypes.ReadNextVarInt(packetData); - int totalexperience = dataTypes.ReadNextVarInt(packetData); + int totalexperience, level; + + if (protocolVersion >= MC_1_19_3_Version) + { + totalexperience = dataTypes.ReadNextVarInt(packetData); + level = dataTypes.ReadNextVarInt(packetData); + } + else + { + level = dataTypes.ReadNextVarInt(packetData); + totalexperience = dataTypes.ReadNextVarInt(packetData); + } + handler.OnSetExperience(experiencebar, level, totalexperience); break; case PacketTypesIn.Explosion: - Location explosionLocation = new(dataTypes.ReadNextFloat(packetData), dataTypes.ReadNextFloat(packetData), dataTypes.ReadNextFloat(packetData)); + Location explosionLocation; + if (protocolVersion >= MC_1_19_3_Version) + explosionLocation = new(dataTypes.ReadNextDouble(packetData), dataTypes.ReadNextDouble(packetData), dataTypes.ReadNextDouble(packetData)); + else + explosionLocation = new(dataTypes.ReadNextFloat(packetData), dataTypes.ReadNextFloat(packetData), dataTypes.ReadNextFloat(packetData)); float explosionStrength = dataTypes.ReadNextFloat(packetData); int explosionBlockCount = protocolVersion >= MC_1_17_Version @@ -1785,6 +2010,7 @@ namespace MinecraftClient.Protocol.Handlers } return true; //Packet processed } +#if Release catch (Exception innerException) { if (innerException is ThreadAbortException || innerException is SocketException || innerException.InnerException is SocketException) @@ -1798,6 +2024,11 @@ namespace MinecraftClient.Protocol.Handlers innerException.GetType()), innerException); } +#else + catch (SocketException) { throw; } + catch (ThreadAbortException) { throw; } + catch (ObjectDisposedException) { throw; } +#endif } /// @@ -1874,24 +2105,24 @@ namespace MinecraftClient.Protocol.Handlers // log.Info("[C -> S] Sending packet " + packetID + " > " + dataTypes.ByteArrayToString(packetData.ToArray())); //The inner packet - byte[] the_packet = dataTypes.ConcatBytes(dataTypes.GetVarInt(packetID), packetData.ToArray()); + byte[] the_packet = dataTypes.ConcatBytes(DataTypes.GetVarInt(packetID), packetData.ToArray()); if (compression_treshold > 0) //Compression enabled? { if (the_packet.Length >= compression_treshold) //Packet long enough for compressing? { byte[] compressed_packet = ZlibUtils.Compress(the_packet); - the_packet = dataTypes.ConcatBytes(dataTypes.GetVarInt(the_packet.Length), compressed_packet); + the_packet = dataTypes.ConcatBytes(DataTypes.GetVarInt(the_packet.Length), compressed_packet); } else { - byte[] uncompressed_length = dataTypes.GetVarInt(0); //Not compressed (short packet) + byte[] uncompressed_length = DataTypes.GetVarInt(0); //Not compressed (short packet) the_packet = dataTypes.ConcatBytes(uncompressed_length, the_packet); } } //log.Debug("[C -> S] Sending packet " + packetID + " > " + dataTypes.ByteArrayToString(dataTypes.ConcatBytes(dataTypes.GetVarInt(the_packet.Length), the_packet))); - socketWrapper.SendDataRAW(dataTypes.ConcatBytes(dataTypes.GetVarInt(the_packet.Length), the_packet)); + socketWrapper.SendDataRAW(dataTypes.ConcatBytes(DataTypes.GetVarInt(the_packet.Length), the_packet)); } /// @@ -1900,23 +2131,25 @@ namespace MinecraftClient.Protocol.Handlers /// True if login successful public bool Login(PlayerKeyPair? playerKeyPair, SessionToken session) { - byte[] protocol_version = dataTypes.GetVarInt(protocolVersion); + byte[] protocol_version = DataTypes.GetVarInt(protocolVersion); string server_address = pForge.GetServerAddress(handler.GetServerHost()); byte[] server_port = dataTypes.GetUShort((ushort)handler.GetServerPort()); - byte[] next_state = dataTypes.GetVarInt(2); + byte[] next_state = DataTypes.GetVarInt(2); byte[] handshake_packet = dataTypes.ConcatBytes(protocol_version, dataTypes.GetString(server_address), server_port, next_state); SendPacket(0x00, handshake_packet); List fullLoginPacket = new(); fullLoginPacket.AddRange(dataTypes.GetString(handler.GetUsername())); // Username - if (protocolVersion >= MC_1_19_Version) + + // 1.19 - 1.19.2 + if (protocolVersion >= MC_1_19_Version && protocolVersion < MC_1_19_3_Version) { if (playerKeyPair == null) fullLoginPacket.AddRange(dataTypes.GetBool(false)); // Has Sig Data else { fullLoginPacket.AddRange(dataTypes.GetBool(true)); // Has Sig Data - fullLoginPacket.AddRange(dataTypes.GetLong(playerKeyPair.GetExpirationMilliseconds())); // Expiration time + fullLoginPacket.AddRange(DataTypes.GetLong(playerKeyPair.GetExpirationMilliseconds())); // Expiration time fullLoginPacket.AddRange(dataTypes.GetArray(playerKeyPair.PublicKey.Key)); // Public key received from Microsoft API if (protocolVersion >= MC_1_19_2_Version) fullLoginPacket.AddRange(dataTypes.GetArray(playerKeyPair.PublicKey.SignatureV2!)); // Public key signature received from Microsoft API @@ -1927,14 +2160,16 @@ namespace MinecraftClient.Protocol.Handlers if (protocolVersion >= MC_1_19_2_Version) { Guid uuid = handler.GetUserUuid(); + if (uuid == Guid.Empty) fullLoginPacket.AddRange(dataTypes.GetBool(false)); // Has UUID else { fullLoginPacket.AddRange(dataTypes.GetBool(true)); // Has UUID - fullLoginPacket.AddRange(dataTypes.GetUUID(uuid)); // UUID + fullLoginPacket.AddRange(DataTypes.GetUUID(uuid)); // UUID } } + SendPacket(0x00, fullLoginPacket); while (true) @@ -2016,7 +2251,9 @@ namespace MinecraftClient.Protocol.Handlers // Encryption Response packet List encryptionResponse = new(); encryptionResponse.AddRange(dataTypes.GetArray(RSAService.Encrypt(secretKey, false))); // Shared Secret - if (protocolVersion >= Protocol18Handler.MC_1_19_Version) + + // 1.19 - 1.19.2 + if (protocolVersion >= MC_1_19_Version && protocolVersion < MC_1_19_3_Version) { if (playerKeyPair == null) { @@ -2037,6 +2274,7 @@ namespace MinecraftClient.Protocol.Handlers { encryptionResponse.AddRange(dataTypes.GetArray(RSAService.Encrypt(token, false))); // Verify Token } + SendPacket(0x01, encryptionResponse); //Start client-side encryption @@ -2114,7 +2352,7 @@ namespace MinecraftClient.Protocol.Handlers if (string.IsNullOrEmpty(BehindCursor)) return -1; - byte[] transaction_id = dataTypes.GetVarInt(autocomplete_transaction_id); + byte[] transaction_id = DataTypes.GetVarInt(autocomplete_transaction_id); byte[] assume_command = new byte[] { 0x00 }; byte[] has_position = new byte[] { 0x00 }; @@ -2159,17 +2397,17 @@ namespace MinecraftClient.Protocol.Handlers SocketWrapper socketWrapper = new(tcp); DataTypes dataTypes = new(MC_1_8_Version); - byte[] packet_id = dataTypes.GetVarInt(0); - byte[] protocol_version = dataTypes.GetVarInt(-1); + byte[] packet_id = DataTypes.GetVarInt(0); + byte[] protocol_version = DataTypes.GetVarInt(-1); byte[] server_port = BitConverter.GetBytes((ushort)port); Array.Reverse(server_port); - byte[] next_state = dataTypes.GetVarInt(1); + byte[] next_state = DataTypes.GetVarInt(1); byte[] packet = dataTypes.ConcatBytes(packet_id, protocol_version, dataTypes.GetString(host), server_port, next_state); - byte[] tosend = dataTypes.ConcatBytes(dataTypes.GetVarInt(packet.Length), packet); + byte[] tosend = dataTypes.ConcatBytes(DataTypes.GetVarInt(packet.Length), packet); socketWrapper.SendDataRAW(tosend); - byte[] status_request = dataTypes.GetVarInt(0); - byte[] request_packet = dataTypes.ConcatBytes(dataTypes.GetVarInt(status_request.Length), status_request); + byte[] status_request = DataTypes.GetVarInt(0); + byte[] request_packet = dataTypes.ConcatBytes(DataTypes.GetVarInt(status_request.Length), status_request); socketWrapper.SendDataRAW(request_packet); @@ -2260,6 +2498,26 @@ namespace MinecraftClient.Protocol.Handlers catch (ObjectDisposedException) { return false; } } + /// + /// Send MessageAcknowledgment packet + /// + /// Message acknowledgment + /// True if properly sent + public bool SendMessageAcknowledgment(int messageCount) + { + try + { + byte[] fields = DataTypes.GetVarInt(messageCount); + + SendPacket(PacketTypesOut.MessageAcknowledgment, fields); + + return true; + } + catch (SocketException) { return false; } + catch (System.IO.IOException) { return false; } + catch (ObjectDisposedException) { return false; } + } + public LastSeenMessageList.Acknowledgment ConsumeAcknowledgment() { pendingAcknowledgments = 0; @@ -2268,15 +2526,29 @@ namespace MinecraftClient.Protocol.Handlers public void Acknowledge(ChatMessage message) { - LastSeenMessageList.Entry? entry = message.ToLastSeenMessageEntry(); + LastSeenMessageList.AcknowledgedMessage? entry = message.ToLastSeenMessageEntry(); if (entry != null) { - lastSeenMessagesCollector.Add(entry); - lastReceivedMessage = null; - - if (pendingAcknowledgments++ > 64) - SendMessageAcknowledgment(ConsumeAcknowledgment()); + if (protocolVersion >= MC_1_19_3_Version) + { + if (lastSeenMessagesCollector.Add_1_19_3(entry, true)) + { + if (lastSeenMessagesCollector.messageCount > 64) + { + int messageCount = lastSeenMessagesCollector.ResetMessageCount(); + if (messageCount > 0) + SendMessageAcknowledgment(messageCount); + } + } + } + else + { + lastSeenMessagesCollector.Add_1_19_2(entry); + lastReceivedMessage = null; + if (pendingAcknowledgments++ > 64) + SendMessageAcknowledgment(ConsumeAcknowledgment()); + } } } @@ -2298,55 +2570,77 @@ namespace MinecraftClient.Protocol.Handlers try { - LastSeenMessageList.Acknowledgment? acknowledgment = - (protocolVersion >= MC_1_19_2_Version) ? ConsumeAcknowledgment() : null; - - List fields = new(); - - // Command: String - fields.AddRange(dataTypes.GetString(command)); - - // Timestamp: Instant(Long) - DateTimeOffset timeNow = DateTimeOffset.UtcNow; - fields.AddRange(dataTypes.GetLong(timeNow.ToUnixTimeMilliseconds())); - List>? needSigned = null; // List< Argument Name, Argument Value > if (playerKeyPair != null && isOnlineMode && protocolVersion >= MC_1_19_Version && Config.Signature.LoginWithSecureProfile && Config.Signature.SignMessageInCommand) needSigned = DeclareCommands.CollectSignArguments(command); - if (needSigned == null || needSigned!.Count == 0) + lock (MessageSigningLock) { - fields.AddRange(dataTypes.GetLong(0)); // Salt: Long - fields.AddRange(dataTypes.GetVarInt(0)); // Signature Length: VarInt - } - else - { - Guid uuid = handler.GetUserUuid(); - byte[] salt = GenerateSalt(); - fields.AddRange(salt); // Salt: Long - fields.AddRange(dataTypes.GetVarInt(needSigned.Count)); // Signature Length: VarInt - foreach ((string argName, string message) in needSigned) + LastSeenMessageList.Acknowledgment? acknowledgment_1_19_2 = + (protocolVersion == MC_1_19_2_Version) ? ConsumeAcknowledgment() : null; + + (LastSeenMessageList.AcknowledgedMessage[] acknowledgment_1_19_3, byte[] bitset_1_19_3, int messageCount_1_19_3) = + (protocolVersion >= MC_1_19_3_Version) ? lastSeenMessagesCollector.Collect_1_19_3() : new(Array.Empty(), Array.Empty(), 0); + + List fields = new(); + + // Command: String + fields.AddRange(dataTypes.GetString(command)); + + // Timestamp: Instant(Long) + DateTimeOffset timeNow = DateTimeOffset.UtcNow; + fields.AddRange(DataTypes.GetLong(timeNow.ToUnixTimeMilliseconds())); + + if (needSigned == null || needSigned!.Count == 0) { - fields.AddRange(dataTypes.GetString(argName)); // Argument name: String - byte[] sign = (protocolVersion >= MC_1_19_2_Version) ? - playerKeyPair!.PrivateKey.SignMessage(message, uuid, timeNow, ref salt, acknowledgment!.lastSeen) : - playerKeyPair!.PrivateKey.SignMessage(message, uuid, timeNow, ref salt); - fields.AddRange(dataTypes.GetVarInt(sign.Length)); // Signature length: VarInt - fields.AddRange(sign); // Signature: Byte Array + fields.AddRange(DataTypes.GetLong(0)); // Salt: Long + fields.AddRange(DataTypes.GetVarInt(0)); // Signature Length: VarInt } + else + { + Guid uuid = handler.GetUserUuid(); + byte[] salt = GenerateSalt(); + fields.AddRange(salt); // Salt: Long + fields.AddRange(DataTypes.GetVarInt(needSigned.Count)); // Signature Length: VarInt + foreach ((string argName, string message) in needSigned) + { + fields.AddRange(dataTypes.GetString(argName)); // Argument name: String + + byte[] sign; + if (protocolVersion == MC_1_19_Version) + sign = playerKeyPair!.PrivateKey.SignMessage(message, uuid, timeNow, ref salt); + else if (protocolVersion == MC_1_19_2_Version) + sign = playerKeyPair!.PrivateKey.SignMessage(message, uuid, timeNow, ref salt, acknowledgment_1_19_2!.lastSeen); + else // protocolVersion >= MC_1_19_3_Version + sign = playerKeyPair!.PrivateKey.SignMessage(message, uuid, chatUuid, messageIndex++, timeNow, ref salt, acknowledgment_1_19_3); + + if (protocolVersion <= MC_1_19_2_Version) + fields.AddRange(DataTypes.GetVarInt(sign.Length)); // Signature length: VarInt + + fields.AddRange(sign); // Signature: Byte Array + } + } + + if (protocolVersion <= MC_1_19_2_Version) + fields.AddRange(dataTypes.GetBool(false)); // Signed Preview: Boolean + + if (protocolVersion == MC_1_19_2_Version) + { + // Message Acknowledgment (1.19.2) + fields.AddRange(dataTypes.GetAcknowledgment(acknowledgment_1_19_2!, isOnlineMode && Config.Signature.LoginWithSecureProfile)); + } + else if (protocolVersion >= MC_1_19_3_Version) + { + // message count + fields.AddRange(DataTypes.GetVarInt(messageCount_1_19_3)); + + // Acknowledged: BitSet + fields.AddRange(bitset_1_19_3); + } + + SendPacket(PacketTypesOut.ChatCommand, fields); } - - // Signed Preview: Boolean - fields.AddRange(dataTypes.GetBool(false)); - - if (protocolVersion >= MC_1_19_2_Version) - { - // Message Acknowledgment - fields.AddRange(dataTypes.GetAcknowledgment(acknowledgment!, isOnlineMode && Config.Signature.LoginWithSecureProfile)); - } - - SendPacket(PacketTypesOut.ChatCommand, fields); return true; } catch (SocketException) { return false; } @@ -2362,7 +2656,7 @@ namespace MinecraftClient.Protocol.Handlers /// True if properly sent public bool SendChatMessage(string message, PlayerKeyPair? playerKeyPair) { - if (String.IsNullOrEmpty(message)) + if (string.IsNullOrEmpty(message)) return true; // Process Chat Command - 1.19 and above @@ -2378,40 +2672,65 @@ namespace MinecraftClient.Protocol.Handlers if (protocolVersion >= MC_1_19_Version) { - LastSeenMessageList.Acknowledgment? acknowledgment = - (protocolVersion >= MC_1_19_2_Version) ? ConsumeAcknowledgment() : null; - - // Timestamp: Instant(Long) - DateTimeOffset timeNow = DateTimeOffset.UtcNow; - fields.AddRange(dataTypes.GetLong(timeNow.ToUnixTimeMilliseconds())); - - if (!isOnlineMode || playerKeyPair == null || !Config.Signature.LoginWithSecureProfile || !Config.Signature.SignChat) + lock (MessageSigningLock) { - fields.AddRange(dataTypes.GetLong(0)); // Salt: Long - fields.AddRange(dataTypes.GetVarInt(0)); // Signature Length: VarInt - } - else - { - // Salt: Long - byte[] salt = GenerateSalt(); - fields.AddRange(salt); + LastSeenMessageList.Acknowledgment? acknowledgment_1_19_2 = + (protocolVersion == MC_1_19_2_Version) ? ConsumeAcknowledgment() : null; - // Signature Length & Signature: (VarInt) and Byte Array - Guid uuid = handler.GetUserUuid(); - byte[] sign = (protocolVersion >= MC_1_19_2_Version) ? - playerKeyPair.PrivateKey.SignMessage(message, uuid, timeNow, ref salt, acknowledgment!.lastSeen) : - playerKeyPair.PrivateKey.SignMessage(message, uuid, timeNow, ref salt); - fields.AddRange(dataTypes.GetVarInt(sign.Length)); - fields.AddRange(sign); - } + (LastSeenMessageList.AcknowledgedMessage[] acknowledgment_1_19_3, byte[] bitset_1_19_3, int messageCount_1_19_3) = + (protocolVersion >= MC_1_19_3_Version) ? lastSeenMessagesCollector.Collect_1_19_3() : new(Array.Empty(), Array.Empty(), 0); - // Signed Preview: Boolean - fields.AddRange(dataTypes.GetBool(false)); + // Timestamp: Instant(Long) + DateTimeOffset timeNow = DateTimeOffset.UtcNow; + fields.AddRange(DataTypes.GetLong(timeNow.ToUnixTimeMilliseconds())); - if (protocolVersion >= MC_1_19_2_Version) - { - // Message Acknowledgment - fields.AddRange(dataTypes.GetAcknowledgment(acknowledgment!, isOnlineMode && Config.Signature.LoginWithSecureProfile)); + if (!isOnlineMode || playerKeyPair == null || !Config.Signature.LoginWithSecureProfile || !Config.Signature.SignChat) + { + fields.AddRange(DataTypes.GetLong(0)); // Salt: Long + if (protocolVersion < MC_1_19_3_Version) + fields.AddRange(DataTypes.GetVarInt(0)); // Signature Length: VarInt (1.19 - 1.19.2) + else + fields.AddRange(dataTypes.GetBool(false)); // Has signature: bool (1.19.3) + } + else + { + // Salt: Long + byte[] salt = GenerateSalt(); + fields.AddRange(salt); + + // Signature Length & Signature: (VarInt) and Byte Array + Guid playerUuid = handler.GetUserUuid(); + byte[] sign; + if (protocolVersion == MC_1_19_Version) // 1.19.1 or lower + sign = playerKeyPair.PrivateKey.SignMessage(message, playerUuid, timeNow, ref salt); + else if (protocolVersion == MC_1_19_2_Version) // 1.19.2 + sign = playerKeyPair.PrivateKey.SignMessage(message, playerUuid, timeNow, ref salt, acknowledgment_1_19_2!.lastSeen); + else // protocolVersion >= MC_1_19_3_Version + sign = playerKeyPair.PrivateKey.SignMessage(message, playerUuid, chatUuid, messageIndex++, timeNow, ref salt, acknowledgment_1_19_3); + + if (protocolVersion >= MC_1_19_3_Version) + fields.AddRange(dataTypes.GetBool(true)); + else + fields.AddRange(DataTypes.GetVarInt(sign.Length)); + fields.AddRange(sign); + } + + if (protocolVersion <= MC_1_19_2_Version) + fields.AddRange(dataTypes.GetBool(false)); // Signed Preview: Boolean + + if (protocolVersion >= MC_1_19_3_Version) + { + // message count + fields.AddRange(DataTypes.GetVarInt(messageCount_1_19_3)); + + // Acknowledged: BitSet + fields.AddRange(bitset_1_19_3); + } + else if (protocolVersion == MC_1_19_2_Version) + { + // Message Acknowledgment + fields.AddRange(dataTypes.GetAcknowledgment(acknowledgment_1_19_2!, isOnlineMode && Config.Signature.LoginWithSecureProfile)); + } } } SendPacket(PacketTypesOut.ChatMessage, fields); @@ -2427,9 +2746,9 @@ namespace MinecraftClient.Protocol.Handlers try { List fields = new(); - fields.AddRange(dataTypes.GetVarInt(PlayerEntityID)); - fields.AddRange(dataTypes.GetVarInt(ActionID)); - fields.AddRange(dataTypes.GetVarInt(0)); + fields.AddRange(DataTypes.GetVarInt(PlayerEntityID)); + fields.AddRange(DataTypes.GetVarInt(ActionID)); + fields.AddRange(DataTypes.GetVarInt(0)); SendPacket(PacketTypesOut.EntityAction, fields); return true; } @@ -2495,7 +2814,7 @@ namespace MinecraftClient.Protocol.Handlers fields.Add(viewDistance); if (protocolVersion >= MC_1_9_Version) - fields.AddRange(dataTypes.GetVarInt(chatMode)); + fields.AddRange(DataTypes.GetVarInt(chatMode)); else fields.AddRange(new byte[] { chatMode }); @@ -2507,7 +2826,7 @@ namespace MinecraftClient.Protocol.Handlers } else fields.Add(skinParts); if (protocolVersion >= MC_1_9_Version) - fields.AddRange(dataTypes.GetVarInt(mainHand)); + fields.AddRange(DataTypes.GetVarInt(mainHand)); if (protocolVersion >= MC_1_17_Version) { if (protocolVersion >= MC_1_18_1_Version) @@ -2628,7 +2947,7 @@ namespace MinecraftClient.Protocol.Handlers { try { - SendPacket(0x02, dataTypes.ConcatBytes(dataTypes.GetVarInt(messageId), dataTypes.GetBool(understood), data)); + SendPacket(0x02, dataTypes.ConcatBytes(DataTypes.GetVarInt(messageId), dataTypes.GetBool(understood), data)); return true; } catch (SocketException) { return false; } @@ -2647,8 +2966,8 @@ namespace MinecraftClient.Protocol.Handlers try { List fields = new(); - fields.AddRange(dataTypes.GetVarInt(EntityID)); - fields.AddRange(dataTypes.GetVarInt(type)); + fields.AddRange(DataTypes.GetVarInt(EntityID)); + fields.AddRange(DataTypes.GetVarInt(type)); // Is player Sneaking (Only 1.16 and above) // Currently hardcoded to false @@ -2670,12 +2989,12 @@ namespace MinecraftClient.Protocol.Handlers try { List fields = new(); - fields.AddRange(dataTypes.GetVarInt(EntityID)); - fields.AddRange(dataTypes.GetVarInt(type)); + fields.AddRange(DataTypes.GetVarInt(EntityID)); + fields.AddRange(DataTypes.GetVarInt(type)); fields.AddRange(dataTypes.GetFloat(X)); fields.AddRange(dataTypes.GetFloat(Y)); fields.AddRange(dataTypes.GetFloat(Z)); - fields.AddRange(dataTypes.GetVarInt(hand)); + fields.AddRange(DataTypes.GetVarInt(hand)); // Is player Sneaking (Only 1.16 and above) // Currently hardcoded to false // TODO: Update to reflect the real player state @@ -2693,9 +3012,9 @@ namespace MinecraftClient.Protocol.Handlers try { List fields = new(); - fields.AddRange(dataTypes.GetVarInt(EntityID)); - fields.AddRange(dataTypes.GetVarInt(type)); - fields.AddRange(dataTypes.GetVarInt(hand)); + fields.AddRange(DataTypes.GetVarInt(EntityID)); + fields.AddRange(DataTypes.GetVarInt(type)); + fields.AddRange(DataTypes.GetVarInt(hand)); // Is player Sneaking (Only 1.16 and above) // Currently hardcoded to false // TODO: Update to reflect the real player state @@ -2723,9 +3042,9 @@ namespace MinecraftClient.Protocol.Handlers try { List packet = new(); - packet.AddRange(dataTypes.GetVarInt(hand)); + packet.AddRange(DataTypes.GetVarInt(hand)); if (protocolVersion >= MC_1_19_Version) - packet.AddRange(dataTypes.GetVarInt(sequenceId)); + packet.AddRange(DataTypes.GetVarInt(sequenceId)); SendPacket(PacketTypesOut.UseItem, packet); return true; } @@ -2739,11 +3058,11 @@ namespace MinecraftClient.Protocol.Handlers try { List packet = new(); - packet.AddRange(dataTypes.GetVarInt(status)); + packet.AddRange(DataTypes.GetVarInt(status)); packet.AddRange(dataTypes.GetLocation(location)); - packet.AddRange(dataTypes.GetVarInt(dataTypes.GetBlockFace(face))); + packet.AddRange(DataTypes.GetVarInt(dataTypes.GetBlockFace(face))); if (protocolVersion >= MC_1_19_Version) - packet.AddRange(dataTypes.GetVarInt(sequenceId)); + packet.AddRange(DataTypes.GetVarInt(sequenceId)); SendPacket(PacketTypesOut.PlayerDigging, packet); return true; } @@ -2759,15 +3078,15 @@ namespace MinecraftClient.Protocol.Handlers try { List packet = new(); - packet.AddRange(dataTypes.GetVarInt(hand)); + packet.AddRange(DataTypes.GetVarInt(hand)); packet.AddRange(dataTypes.GetLocation(location)); - packet.AddRange(dataTypes.GetVarInt(dataTypes.GetBlockFace(face))); + packet.AddRange(DataTypes.GetVarInt(dataTypes.GetBlockFace(face))); packet.AddRange(dataTypes.GetFloat(0.5f)); // cursorX packet.AddRange(dataTypes.GetFloat(0.5f)); // cursorY packet.AddRange(dataTypes.GetFloat(0.5f)); // cursorZ packet.Add(0); // insideBlock = false; if (protocolVersion >= MC_1_19_Version) - packet.AddRange(dataTypes.GetVarInt(sequenceId)); + packet.AddRange(DataTypes.GetVarInt(sequenceId)); SendPacket(PacketTypesOut.PlayerBlockPlacement, packet); return true; } @@ -2833,14 +3152,14 @@ namespace MinecraftClient.Protocol.Handlers // 1.18+ if (protocolVersion >= MC_1_18_1_Version) { - packet.AddRange(dataTypes.GetVarInt(stateId)); // State ID + packet.AddRange(DataTypes.GetVarInt(stateId)); // State ID packet.AddRange(dataTypes.GetShort((short)slotId)); // Slot ID } // 1.17.1 else if (protocolVersion == MC_1_17_1_Version) { packet.AddRange(dataTypes.GetShort((short)slotId)); // Slot ID - packet.AddRange(dataTypes.GetVarInt(stateId)); // State ID + packet.AddRange(DataTypes.GetVarInt(stateId)); // State ID } // Older else @@ -2854,13 +3173,13 @@ namespace MinecraftClient.Protocol.Handlers packet.AddRange(dataTypes.GetShort(actionNumber)); if (protocolVersion >= MC_1_9_Version) - packet.AddRange(dataTypes.GetVarInt(mode)); // Mode + packet.AddRange(DataTypes.GetVarInt(mode)); // Mode else packet.Add(mode); // 1.17+ Array of changed slots if (protocolVersion >= MC_1_17_Version) { - packet.AddRange(dataTypes.GetVarInt(changedSlots.Count)); // Length of the array + packet.AddRange(DataTypes.GetVarInt(changedSlots.Count)); // Length of the array foreach (var slot in changedSlots) { packet.AddRange(dataTypes.GetShort(slot.Item1)); // slot ID @@ -2918,7 +3237,7 @@ namespace MinecraftClient.Protocol.Handlers if (protocolVersion < MC_1_8_Version) { - packet.AddRange(dataTypes.GetInt(playerid)); + packet.AddRange(DataTypes.GetInt(playerid)); packet.Add((byte)1); // Swing arm } else if (protocolVersion < MC_1_9_Version) @@ -2927,7 +3246,7 @@ namespace MinecraftClient.Protocol.Handlers } else // MC 1.9+ { - packet.AddRange(dataTypes.GetVarInt(animation)); + packet.AddRange(DataTypes.GetVarInt(animation)); } SendPacket(PacketTypesOut.Animation, packet); @@ -2996,7 +3315,7 @@ namespace MinecraftClient.Protocol.Handlers List packet = new(); packet.AddRange(dataTypes.GetLocation(location)); packet.AddRange(dataTypes.GetString(command)); - packet.AddRange(dataTypes.GetVarInt((int)mode)); + packet.AddRange(DataTypes.GetVarInt((int)mode)); packet.Add((byte)flags); SendPacket(PacketTypesOut.UpdateSign, packet); return true; @@ -3032,7 +3351,7 @@ namespace MinecraftClient.Protocol.Handlers try { List packet = new(); - packet.AddRange(dataTypes.GetVarInt(selectedSlot)); + packet.AddRange(DataTypes.GetVarInt(selectedSlot)); SendPacket(PacketTypesOut.SelectTrade, packet); return true; } @@ -3051,7 +3370,7 @@ namespace MinecraftClient.Protocol.Handlers try { List packet = new(); - packet.AddRange(dataTypes.GetUUID(UUID)); + packet.AddRange(DataTypes.GetUUID(UUID)); SendPacket(PacketTypesOut.Spectate, packet); return true; } @@ -3062,6 +3381,35 @@ namespace MinecraftClient.Protocol.Handlers else { return false; } } + public bool SendPlayerSession(PlayerKeyPair? playerKeyPair) + { + if (playerKeyPair == null || !isOnlineMode) + return false; + + if (protocolVersion >= MC_1_19_3_Version) + { + try + { + List packet = new(); + + chatUuid = Guid.NewGuid(); + packet.AddRange(DataTypes.GetUUID(chatUuid)); + packet.AddRange(DataTypes.GetLong(playerKeyPair.GetExpirationMilliseconds())); + packet.AddRange(DataTypes.GetVarInt(playerKeyPair.PublicKey.Key.Length)); + packet.AddRange(playerKeyPair.PublicKey.Key); + packet.AddRange(DataTypes.GetVarInt(playerKeyPair.PublicKey.SignatureV2!.Length)); + packet.AddRange(playerKeyPair.PublicKey.SignatureV2); + + SendPacket(PacketTypesOut.PlayerSession, packet); + return true; + } + catch (SocketException) { return false; } + catch (System.IO.IOException) { return false; } + catch (ObjectDisposedException) { return false; } + } + else { return false; } + } + private byte[] GenerateSalt() { byte[] salt = new byte[8]; diff --git a/MinecraftClient/Protocol/Handlers/Protocol18Forge.cs b/MinecraftClient/Protocol/Handlers/Protocol18Forge.cs index e7ff7cc2..1f1c5f4d 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18Forge.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18Forge.cs @@ -151,7 +151,7 @@ namespace MinecraftClient.Protocol.Handlers mods[i] = dataTypes.ConcatBytes(dataTypes.GetString(mod.ModID), dataTypes.GetString(mod.Version)); } SendForgeHandshakePacket(FMLHandshakeDiscriminator.ModList, - dataTypes.ConcatBytes(dataTypes.GetVarInt(forgeInfo.Mods.Count), dataTypes.ConcatBytes(mods))); + dataTypes.ConcatBytes(DataTypes.GetVarInt(forgeInfo.Mods.Count), dataTypes.ConcatBytes(mods))); fmlHandshakeState = FMLHandshakeClientState.WAITINGSERVERDATA; @@ -338,19 +338,19 @@ namespace MinecraftClient.Protocol.Handlers ConsoleIO.WriteLineFormatted("§8" + Translations.forge_fml2_mod_send, acceptnewlines: true); // Packet ID 2: Client to Server Mod List - fmlResponsePacket.AddRange(dataTypes.GetVarInt(2)); - fmlResponsePacket.AddRange(dataTypes.GetVarInt(mods.Count)); + fmlResponsePacket.AddRange(DataTypes.GetVarInt(2)); + fmlResponsePacket.AddRange(DataTypes.GetVarInt(mods.Count)); foreach (string mod in mods) fmlResponsePacket.AddRange(dataTypes.GetString(mod)); - fmlResponsePacket.AddRange(dataTypes.GetVarInt(channels.Count)); + fmlResponsePacket.AddRange(DataTypes.GetVarInt(channels.Count)); foreach (KeyValuePair item in channels) { fmlResponsePacket.AddRange(dataTypes.GetString(item.Key)); fmlResponsePacket.AddRange(dataTypes.GetString(item.Value)); } - fmlResponsePacket.AddRange(dataTypes.GetVarInt(registries.Count)); + fmlResponsePacket.AddRange(DataTypes.GetVarInt(registries.Count)); foreach (string registry in registries) { fmlResponsePacket.AddRange(dataTypes.GetString(registry)); @@ -376,7 +376,7 @@ namespace MinecraftClient.Protocol.Handlers ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.forge_fml2_registry, registryName)); } - fmlResponsePacket.AddRange(dataTypes.GetVarInt(99)); + fmlResponsePacket.AddRange(DataTypes.GetVarInt(99)); fmlResponseReady = true; break; @@ -395,7 +395,7 @@ namespace MinecraftClient.Protocol.Handlers ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.forge_fml2_config, configName)); } - fmlResponsePacket.AddRange(dataTypes.GetVarInt(99)); + fmlResponsePacket.AddRange(DataTypes.GetVarInt(99)); fmlResponseReady = true; break; @@ -410,7 +410,7 @@ namespace MinecraftClient.Protocol.Handlers // Wrap our FML packet into a LoginPluginResponse payload responseData.Clear(); responseData.AddRange(dataTypes.GetString(fmlChannel)); - responseData.AddRange(dataTypes.GetVarInt(fmlResponsePacket.Count)); + responseData.AddRange(DataTypes.GetVarInt(fmlResponsePacket.Count)); responseData.AddRange(fmlResponsePacket); return true; } diff --git a/MinecraftClient/Protocol/Handlers/Protocol18Terrain.cs b/MinecraftClient/Protocol/Handlers/Protocol18Terrain.cs index d144f37b..fc66edd0 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18Terrain.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18Terrain.cs @@ -264,9 +264,7 @@ namespace MinecraftClient.Protocol.Handlers int[] palette = new int[paletteLength]; for (int i = 0; i < paletteLength; i++) - { palette[i] = dataTypes.ReadNextVarInt(cache); - } // Bit mask covering bitsPerBlock bits // EG, if bitsPerBlock = 5, valueMask = 00011111 in binary diff --git a/MinecraftClient/Protocol/IMinecraftCom.cs b/MinecraftClient/Protocol/IMinecraftCom.cs index 4c0513dd..97ad8ca1 100644 --- a/MinecraftClient/Protocol/IMinecraftCom.cs +++ b/MinecraftClient/Protocol/IMinecraftCom.cs @@ -255,6 +255,12 @@ namespace MinecraftClient.Protocol /// The uuid of the player/entity to spectate/teleport to. bool SendSpectate(Guid uuid); + /// + /// Send player session + /// + /// + bool SendPlayerSession(PlayerKeyPair? playerKeyPair); + /// /// Get net read thread (main thread) ID /// diff --git a/MinecraftClient/Protocol/IMinecraftComHandler.cs b/MinecraftClient/Protocol/IMinecraftComHandler.cs index 61e24642..549d070d 100644 --- a/MinecraftClient/Protocol/IMinecraftComHandler.cs +++ b/MinecraftClient/Protocol/IMinecraftComHandler.cs @@ -4,6 +4,7 @@ using MinecraftClient.Inventory; using MinecraftClient.Logger; using MinecraftClient.Mapping; using MinecraftClient.Protocol.Message; +using MinecraftClient.Protocol.ProfileKey; using MinecraftClient.Scripting; namespace MinecraftClient.Protocol @@ -28,6 +29,7 @@ namespace MinecraftClient.Protocol string[] GetOnlinePlayers(); Dictionary GetOnlinePlayersWithUUID(); PlayerInfo? GetPlayerInfo(Guid uuid); + PlayerKeyPair? GetPlayerKeyPair(); Location GetCurrentLocation(); World GetWorld(); bool GetIsSupportPreviewsChat(); @@ -78,7 +80,7 @@ namespace MinecraftClient.Protocol /// /// Called when a server was successfully joined /// - void OnGameJoined(); + void OnGameJoined(bool isOnlineMode); /// /// Received chat/system message from the server @@ -464,6 +466,8 @@ namespace MinecraftClient.Protocol /// All commands. public void OnAutoCompleteDone(int transactionId, string[] result); + public void OnDeclareCommands(); + /// /// Send a click container button packet to the server. /// Used for Enchanting table, Lectern, stone cutter and loom diff --git a/MinecraftClient/Protocol/Message/ChatMessage.cs b/MinecraftClient/Protocol/Message/ChatMessage.cs index 790c70af..09048f3f 100644 --- a/MinecraftClient/Protocol/Message/ChatMessage.cs +++ b/MinecraftClient/Protocol/Message/ChatMessage.cs @@ -5,33 +5,33 @@ namespace MinecraftClient.Protocol.Message public class ChatMessage { // in 1.19 and above, isSignedChat = true - public readonly bool isSignedChat; + public bool isSignedChat; - public readonly string content; + public string content; - public readonly bool isJson; + public bool isJson, isSenderJson; // 0: chat (chat box), 1: system message (chat box), 2: game info (above hotbar), 3: say command, // 4: msg command, 5: team msg command, 6: emote command, 7: tellraw command - public readonly int chatTypeId; + public int chatTypeId; - public readonly Guid senderUUID; + public Guid senderUUID; - public readonly bool isSystemChat; + public bool isSystemChat; - public readonly string? unsignedContent; + public string? unsignedContent; - public readonly string? displayName; + public string? displayName; - public readonly string? teamName; + public string? teamName; - public readonly DateTime? timestamp; + public DateTime? timestamp; - public readonly byte[]? signature; + public byte[]? signature; - public readonly bool? isSignatureLegal; + public bool? isSignatureLegal; - public ChatMessage(string content, bool isJson, int chatType, Guid senderUUID, string? unsignedContent, string displayName, string? teamName, long timestamp, byte[] signature, bool isSignatureLegal) + public ChatMessage(string content, bool isJson, int chatType, Guid senderUUID, string? unsignedContent, string displayName, string? teamName, long timestamp, byte[]? signature, bool isSignatureLegal) { isSignedChat = true; isSystemChat = false; @@ -47,19 +47,20 @@ namespace MinecraftClient.Protocol.Message this.isSignatureLegal = isSignatureLegal; } - public ChatMessage(string content, bool isJson, int chatType, Guid senderUUID, bool isSystemChat = false) + public ChatMessage(string content, string? displayName, bool isJson, int chatType, Guid senderUUID, bool isSystemChat = false) { isSignedChat = isSystemChat; this.isSystemChat = isSystemChat; this.content = content; + this.displayName = displayName; this.isJson = isJson; chatTypeId = chatType; this.senderUUID = senderUUID; } - public LastSeenMessageList.Entry? ToLastSeenMessageEntry() + public LastSeenMessageList.AcknowledgedMessage? ToLastSeenMessageEntry() { - return signature != null ? new LastSeenMessageList.Entry(senderUUID, signature) : null; + return signature != null ? new LastSeenMessageList.AcknowledgedMessage(senderUUID, signature, true) : null; } public bool LacksSender() diff --git a/MinecraftClient/Protocol/Message/ChatParser.cs b/MinecraftClient/Protocol/Message/ChatParser.cs index 2aa87b00..dad15d21 100644 --- a/MinecraftClient/Protocol/Message/ChatParser.cs +++ b/MinecraftClient/Protocol/Message/ChatParser.cs @@ -1,6 +1,9 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.IO; +using System.Linq; using System.Net.Http; +using System.Net.Http.Json; using System.Text; using System.Text.Json; using System.Text.RegularExpressions; @@ -28,6 +31,30 @@ namespace MinecraftClient.Protocol.Message public static Dictionary? ChatId2Type; + public static void ReadChatType(Dictionary registryCodec) + { + Dictionary chatTypeDictionary = ChatId2Type ?? new(); + var chatTypeListNbt = (object[])(((Dictionary)registryCodec["minecraft:chat_type"])["value"]); + foreach (var (chatName, chatId) in from Dictionary chatTypeNbt in chatTypeListNbt + let chatName = (string)chatTypeNbt["name"] + let chatId = (int)chatTypeNbt["id"] + select (chatName, chatId)) + { + chatTypeDictionary[chatId] = chatName switch + { + "minecraft:chat" => MessageType.CHAT, + "minecraft:emote_command" => MessageType.EMOTE_COMMAND, + "minecraft:msg_command_incoming" => MessageType.MSG_COMMAND_INCOMING, + "minecraft:msg_command_outgoing" => MessageType.MSG_COMMAND_OUTGOING, + "minecraft:say_command" => MessageType.SAY_COMMAND, + "minecraft:team_msg_command_incoming" => MessageType.TEAM_MSG_COMMAND_INCOMING, + "minecraft:team_msg_command_outgoing" => MessageType.TEAM_MSG_COMMAND_OUTGOING, + _ => MessageType.CHAT, + }; + } + ChatId2Type = chatTypeDictionary; + } + /// /// The main function to convert text from MC 1.6+ JSON to MC 1.5.2 formatted text /// @@ -47,7 +74,7 @@ namespace MinecraftClient.Protocol.Message /// Returns the translated text public static string ParseSignedChat(ChatMessage message, List? links = null) { - string sender = message.displayName!; + string sender = message.isSenderJson ? ParseText(message.displayName!) : message.displayName!; string content; if (Config.Signature.ShowModifiedChat && message.unsignedContent != null) { @@ -66,7 +93,7 @@ namespace MinecraftClient.Protocol.Message List usingData = new(); MessageType chatType; - if (message.isSystemChat) + if (message.chatTypeId == -1) chatType = MessageType.RAW_MSG; else if (!ChatId2Type!.TryGetValue(message.chatTypeId, out chatType)) chatType = MessageType.CHAT; @@ -119,7 +146,7 @@ namespace MinecraftClient.Protocol.Message if (message.isSystemChat) { if (Config.Signature.MarkSystemMessage) - color = "§§7 §§r "; // Background Gray + color = "§7▌§r"; // Background Gray } else { @@ -128,18 +155,18 @@ namespace MinecraftClient.Protocol.Message if (Config.Signature.ShowModifiedChat && message.unsignedContent != null) { if (Config.Signature.MarkModifiedMsg) - color = "§§6 §§r "; // Background Yellow + color = "§6▌§r"; // Background Yellow } else { if (Config.Signature.MarkLegallySignedMsg) - color = "§§2 §§r "; // Background Green + color = "§2▌§r"; // Background Green } } else { if (Config.Signature.MarkIllegallySignedMsg) - color = "§§4 §§r "; // Background Red + color = "§4▌§r"; // Background Red } } return color + text; @@ -212,7 +239,7 @@ namespace MinecraftClient.Protocol.Message string languageFilePath = "lang" + Path.DirectorySeparatorChar + Config.Main.Advanced.Language + ".json"; - // Load the external dictionnary of translation rules or display an error message + // Load the external dictionary of translation rules or display an error message if (File.Exists(languageFilePath)) { try @@ -246,18 +273,18 @@ namespace MinecraftClient.Protocol.Message if (Config.Logging.DebugMessages) ConsoleIO.WriteLineFormatted(string.Format(Translations.chat_request, translation_file_location)); - Task fetch_file = httpClient.GetStreamAsync(translation_file_location); - fetch_file.Wait(); - TranslationRules = JsonSerializer.Deserialize>(fetch_file.Result)!; - fetch_file.Dispose(); + Task?> fetckFileTask = httpClient.GetFromJsonAsync>(translation_file_location); + fetckFileTask.Wait(); + if (fetckFileTask.Result != null && fetckFileTask.Result.Count > 0) + { + TranslationRules = fetckFileTask.Result; + TranslationRules["Version"] = TranslationsFile_Version; + File.WriteAllText(languageFilePath, JsonSerializer.Serialize(TranslationRules, typeof(Dictionary)), Encoding.UTF8); - TranslationRules["Version"] = TranslationsFile_Version; - - File.WriteAllText(languageFilePath, JsonSerializer.Serialize(TranslationRules, typeof(Dictionary)), Encoding.UTF8); - - ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.chat_done, languageFilePath)); - - return; + ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.chat_done, languageFilePath)); + return; + } + fetckFileTask.Dispose(); } else { @@ -272,6 +299,15 @@ namespace MinecraftClient.Protocol.Message { ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.chat_save_fail, languageFilePath), acceptnewlines: true); } + catch (Exception e) + { + ConsoleIO.WriteLineFormatted("§8" + Translations.chat_fail, acceptnewlines: true); + if (Config.Logging.DebugMessages) + { + ConsoleIO.WriteLine(e.Message); + ConsoleIO.WriteLine(e.StackTrace ?? ""); + } + } finally { httpClient.Dispose(); diff --git a/MinecraftClient/Protocol/Message/LastSeenMessageList.cs b/MinecraftClient/Protocol/Message/LastSeenMessageList.cs index c3de5178..62b1227e 100644 --- a/MinecraftClient/Protocol/Message/LastSeenMessageList.cs +++ b/MinecraftClient/Protocol/Message/LastSeenMessageList.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.Linq; +using static MinecraftClient.Protocol.Message.LastSeenMessageList; namespace MinecraftClient.Protocol.Message { @@ -8,38 +10,45 @@ namespace MinecraftClient.Protocol.Message /// public class LastSeenMessageList { - public static readonly LastSeenMessageList EMPTY = new(Array.Empty()); + public static readonly LastSeenMessageList EMPTY = new(Array.Empty()); public static readonly int MAX_ENTRIES = 5; - public Entry[] entries; + public AcknowledgedMessage[] entries; - public LastSeenMessageList(Entry[] list) + public LastSeenMessageList(AcknowledgedMessage[] list) { entries = list; } public void WriteForSign(List data) { - foreach (Entry entry in entries) + foreach (AcknowledgedMessage entry in entries) { data.Add(70); data.AddRange(entry.profileId.ToBigEndianBytes()); - data.AddRange(entry.lastSignature); + data.AddRange(entry.signature); } } /// /// A pair of a player's UUID and the signature of the last message they saw, used as an entry of LastSeenMessageList. /// - public class Entry + public record AcknowledgedMessage { + public bool pending; public Guid profileId; - public byte[] lastSignature; + public byte[] signature; - public Entry(Guid profileId, byte[] lastSignature) + public AcknowledgedMessage(Guid profileId, byte[] lastSignature, bool pending) { this.profileId = profileId; - this.lastSignature = lastSignature; + this.signature = lastSignature; + this.pending = pending; + } + + public AcknowledgedMessage UnmarkAsPending() + { + return this.pending ? new AcknowledgedMessage(profileId, signature, false) : this; } } @@ -50,9 +59,9 @@ namespace MinecraftClient.Protocol.Message public class Acknowledgment { public LastSeenMessageList lastSeen; - public Entry? lastReceived; + public AcknowledgedMessage? lastReceived; - public Acknowledgment(LastSeenMessageList lastSeenMessageList, Entry? lastReceivedMessage) + public Acknowledgment(LastSeenMessageList lastSeenMessageList, AcknowledgedMessage? lastReceivedMessage) { lastSeen = lastSeenMessageList; lastReceived = lastReceivedMessage; @@ -70,24 +79,26 @@ namespace MinecraftClient.Protocol.Message /// public class LastSeenMessagesCollector { - private readonly LastSeenMessageList.Entry[] entries; - private int size = 0; + private readonly LastSeenMessageList.AcknowledgedMessage?[] acknowledgedMessages; + private int nextIndex = 0; + internal int messageCount { private set; get; } = 0; + private LastSeenMessageList.AcknowledgedMessage? lastEntry = null; private LastSeenMessageList lastSeenMessages; public LastSeenMessagesCollector(int size) { lastSeenMessages = LastSeenMessageList.EMPTY; - entries = new LastSeenMessageList.Entry[size]; + acknowledgedMessages = new LastSeenMessageList.AcknowledgedMessage[size]; } - public void Add(LastSeenMessageList.Entry entry) + public void Add_1_19_2(LastSeenMessageList.AcknowledgedMessage entry) { - LastSeenMessageList.Entry? lastEntry = entry; + LastSeenMessageList.AcknowledgedMessage? lastEntry = entry; - for (int i = 0; i < size; ++i) + for (int i = 0; i < messageCount; ++i) { - LastSeenMessageList.Entry curEntry = entries[i]; - entries[i] = lastEntry; + LastSeenMessageList.AcknowledgedMessage curEntry = acknowledgedMessages[i]!; + acknowledgedMessages[i] = lastEntry; lastEntry = curEntry; if (curEntry.profileId == entry.profileId) { @@ -96,19 +107,62 @@ namespace MinecraftClient.Protocol.Message } } - if (lastEntry != null && size < entries.Length) - entries[size++] = lastEntry; + if (lastEntry != null && messageCount < acknowledgedMessages.Length) + acknowledgedMessages[messageCount++] = lastEntry; - LastSeenMessageList.Entry[] msgList = new LastSeenMessageList.Entry[size]; - for (int i = 0; i < size; ++i) - msgList[i] = entries[i]; + LastSeenMessageList.AcknowledgedMessage[] msgList = new LastSeenMessageList.AcknowledgedMessage[messageCount]; + for (int i = 0; i < messageCount; ++i) + msgList[i] = acknowledgedMessages[i]!; lastSeenMessages = new LastSeenMessageList(msgList); } + public bool Add_1_19_3(LastSeenMessageList.AcknowledgedMessage entry, bool displayed) + { + // net.minecraft.network.message.LastSeenMessagesCollector#add(net.minecraft.network.message.MessageSignatureData, boolean) + // net.minecraft.network.message.LastSeenMessagesCollector#add(net.minecraft.network.message.AcknowledgedMessage) + if (lastEntry != null && entry.signature.SequenceEqual(lastEntry.signature)) + return false; + lastEntry = entry; + + int index = nextIndex; + nextIndex = (index + 1) % acknowledgedMessages.Length; + + ++messageCount; + acknowledgedMessages[index] = displayed ? entry : null; + + return true; + } + + public Tuple Collect_1_19_3() + { + // net.minecraft.network.message.LastSeenMessagesCollector#collect + int count = ResetMessageCount(); + byte[] bitset = new byte[3]; // new Bitset(20); Todo: Use a complete bitset implementation. + List objectList = new(acknowledgedMessages.Length); + for (int j = 0; j < acknowledgedMessages.Length; ++j) + { + int k = (nextIndex + j) % acknowledgedMessages.Length; + AcknowledgedMessage? acknowledgedMessage = acknowledgedMessages[k]; + if (acknowledgedMessage == null) + continue; + bitset[j / 8] |= (byte)(1 << (j % 8)); // bitSet.set(j, true); + objectList.Add(acknowledgedMessage); + acknowledgedMessages[k] = acknowledgedMessage.UnmarkAsPending(); + } + return new(objectList.ToArray(), bitset, count); + } + public LastSeenMessageList GetLastSeenMessages() { return lastSeenMessages; } + public int ResetMessageCount() + { + // net.minecraft.network.message.LastSeenMessagesCollector#resetMessageCount + int cnt = messageCount; + messageCount = 0; + return cnt; + } } } diff --git a/MinecraftClient/Protocol/PlayerInfo.cs b/MinecraftClient/Protocol/PlayerInfo.cs index 31e4300e..74134068 100644 --- a/MinecraftClient/Protocol/PlayerInfo.cs +++ b/MinecraftClient/Protocol/PlayerInfo.cs @@ -20,15 +20,21 @@ namespace MinecraftClient.Protocol public string? DisplayName; + public bool Listed = true; + // Entity info public Mapping.Entity? entity; // For message signature - private readonly PublicKey? PublicKey; + public int MessageIndex = -1; - private readonly DateTime? KeyExpiresAt; + public Guid ChatUuid = Guid.Empty; + + private PublicKey? PublicKey; + + private DateTime? KeyExpiresAt; private bool lastMessageVerified; @@ -71,6 +77,28 @@ namespace MinecraftClient.Protocol precedingSignature = null; } + public void ClearPublicKey() + { + ChatUuid = Guid.Empty; + PublicKey = null; + KeyExpiresAt = null; + } + + public void SetPublicKey(Guid chatUuid, long publicKeyExpiryTime, byte[] encodedPublicKey, byte[] publicKeySignature) + { + ChatUuid = chatUuid; + KeyExpiresAt = DateTimeOffset.FromUnixTimeMilliseconds(publicKeyExpiryTime).UtcDateTime; + try + { + PublicKey = new PublicKey(encodedPublicKey, publicKeySignature); + lastMessageVerified = true; + } + catch (System.Security.Cryptography.CryptographicException) + { + PublicKey = null; + } + } + public bool IsMessageChainLegal() { return lastMessageVerified; @@ -105,7 +133,7 @@ namespace MinecraftClient.Protocol } /// - /// Verify message - 1.19.1 and above + /// Verify message - 1.19.1 and 1.19.2 /// /// Message content /// Timestamp @@ -143,7 +171,7 @@ namespace MinecraftClient.Protocol } /// - /// Verify message head - 1.19.1 and above + /// Verify message head - 1.19.1 and 1.19.2 /// /// Preceding message signature /// Message signature @@ -171,5 +199,24 @@ namespace MinecraftClient.Protocol return res; } + + /// + /// Verify message - 1.19.3 and above + /// + /// Message content + /// Timestamp + /// Salt + /// Message signature + /// Preceding message signature + /// LastSeenMessages + /// Is this message chain vaild + public bool VerifyMessage(string message, Guid playerUuid, Guid chatUuid, int messageIndex, long timestamp, long salt, ref byte[] signature, Tuple[] previousMessageSignatures) + { + if (PublicKey == null || IsKeyExpired()) + return false; + + // net.minecraft.server.network.ServerPlayNetworkHandler#validateMessage + return true; + } } } diff --git a/MinecraftClient/Protocol/ProfileKey/KeyUtils.cs b/MinecraftClient/Protocol/ProfileKey/KeyUtils.cs index fdd68560..4a8d5c66 100644 --- a/MinecraftClient/Protocol/ProfileKey/KeyUtils.cs +++ b/MinecraftClient/Protocol/ProfileKey/KeyUtils.cs @@ -2,7 +2,9 @@ using System.Collections.Generic; using System.Security.Cryptography; using System.Text; +using MinecraftClient.Protocol.Handlers; using MinecraftClient.Protocol.Message; +using static MinecraftClient.Protocol.Message.LastSeenMessageList; namespace MinecraftClient.Protocol.ProfileKey { @@ -110,6 +112,33 @@ namespace MinecraftClient.Protocol.ProfileKey return data.ToArray(); } + public static byte[] GetSignatureData_1_19_3(string message, Guid playerUuid, Guid chatUuid, int messageIndex, DateTimeOffset timestamp, ref byte[] salt, AcknowledgedMessage[] lastSeenMessages) + { + List data = new(); + + // net.minecraft.network.message.SignedMessage#update + data.AddRange(DataTypes.GetInt(1)); + + // message link + // net.minecraft.network.message.MessageLink#update + data.AddRange(DataTypes.GetUUID(playerUuid)); + data.AddRange(DataTypes.GetUUID(chatUuid)); + data.AddRange(DataTypes.GetInt(messageIndex)); + + // message body + // net.minecraft.network.message.MessageBody#update + data.AddRange(salt); + data.AddRange(DataTypes.GetLong(timestamp.ToUnixTimeSeconds())); + byte[] messageBytes = Encoding.UTF8.GetBytes(message); + data.AddRange(DataTypes.GetInt(messageBytes.Length)); + data.AddRange(messageBytes); + data.AddRange(DataTypes.GetInt(lastSeenMessages.Length)); + foreach (AcknowledgedMessage ack in lastSeenMessages) + data.AddRange(ack.signature); + + return data.ToArray(); + } + public static byte[] GetSignatureData(byte[]? precedingSignature, Guid sender, byte[] bodySign) { List data = new(); @@ -124,6 +153,40 @@ namespace MinecraftClient.Protocol.ProfileKey return data.ToArray(); } + public static byte[] GetSignatureData(string message, DateTimeOffset timestamp, ref byte[] salt, int messageCount, Guid sender, Guid sessionUuid) + { + List data = new(); + + // TODO! + byte[] unknownInt1 = BitConverter.GetBytes(1); + Array.Reverse(unknownInt1); + data.AddRange(unknownInt1); + + data.AddRange(sender.ToBigEndianBytes()); + data.AddRange(sessionUuid.ToBigEndianBytes()); + + byte[] msgCountByte = BitConverter.GetBytes(messageCount); + Array.Reverse(msgCountByte); + data.AddRange(msgCountByte); + data.AddRange(salt); + + byte[] timestampByte = BitConverter.GetBytes(timestamp.ToUnixTimeSeconds()); + Array.Reverse(timestampByte); + data.AddRange(timestampByte); + + byte[] msgByte = Encoding.UTF8.GetBytes(message); + byte[] msgLengthByte = BitConverter.GetBytes(msgByte.Length); + Array.Reverse(msgLengthByte); + data.AddRange(msgLengthByte); + data.AddRange(msgByte); + + byte[] unknownInt2 = BitConverter.GetBytes(0); + Array.Reverse(unknownInt2); + data.AddRange(unknownInt2); + + return data.ToArray(); + } + // https://github.com/mono/mono/blob/master/mcs/class/System.Json/System.Json/JsonValue.cs public static string EscapeString(string src) { diff --git a/MinecraftClient/Protocol/ProfileKey/PrivateKey.cs b/MinecraftClient/Protocol/ProfileKey/PrivateKey.cs index 6cb8103b..c471a103 100644 --- a/MinecraftClient/Protocol/ProfileKey/PrivateKey.cs +++ b/MinecraftClient/Protocol/ProfileKey/PrivateKey.cs @@ -1,6 +1,7 @@ using System; using System.Security.Cryptography; using MinecraftClient.Protocol.Message; +using static MinecraftClient.Protocol.Message.LastSeenMessageList; namespace MinecraftClient.Protocol.ProfileKey { @@ -43,7 +44,7 @@ namespace MinecraftClient.Protocol.ProfileKey } /// - /// Sign message - 1.19.1 and above + /// Sign message - 1.19.1 and 1.19.2 /// /// Message content /// Sender uuid @@ -64,5 +65,21 @@ namespace MinecraftClient.Protocol.ProfileKey return msgSign; } + /// + /// Sign message - 1.19.3 and above + /// + /// Message content + /// Sender uuid + /// Timestamp + /// Salt + /// LastSeenMessageList + /// Signature data + public byte[] SignMessage(string message, Guid playerUuid, Guid chatUuid, int messageIndex, DateTimeOffset timestamp, ref byte[] salt, AcknowledgedMessage[] lastSeenMessages) + { + byte[] bodySignData = KeyUtils.GetSignatureData_1_19_3(message, playerUuid, chatUuid, messageIndex, timestamp, ref salt, lastSeenMessages); + + return SignData(bodySignData); + } + } } diff --git a/MinecraftClient/Protocol/ProfileKey/PublicKey.cs b/MinecraftClient/Protocol/ProfileKey/PublicKey.cs index 2f01fa84..2208e04e 100644 --- a/MinecraftClient/Protocol/ProfileKey/PublicKey.cs +++ b/MinecraftClient/Protocol/ProfileKey/PublicKey.cs @@ -24,6 +24,12 @@ namespace MinecraftClient.Protocol.ProfileKey if (!string.IsNullOrEmpty(sigV2)) SignatureV2 = Convert.FromBase64String(sigV2!); + + if (SignatureV2 == null || SignatureV2.Length == 0) + SignatureV2 = Signature; + + if (Signature == null || Signature.Length == 0) + Signature = SignatureV2; } public PublicKey(byte[] key, byte[] signature) @@ -58,7 +64,7 @@ namespace MinecraftClient.Protocol.ProfileKey } /// - /// Verify message - 1.19.1 and above + /// Verify message - 1.19.1 and 1.19.2 /// /// Message content /// Sender uuid @@ -79,7 +85,7 @@ namespace MinecraftClient.Protocol.ProfileKey } /// - /// Verify message head - 1.19.1 and above + /// Verify message head - 1.19.1 and 1.19.2 /// /// Message body hash /// Message signature diff --git a/MinecraftClient/Protocol/ProtocolHandler.cs b/MinecraftClient/Protocol/ProtocolHandler.cs index 3328faf0..345fe2a8 100644 --- a/MinecraftClient/Protocol/ProtocolHandler.cs +++ b/MinecraftClient/Protocol/ProtocolHandler.cs @@ -134,7 +134,7 @@ namespace MinecraftClient.Protocol if (Array.IndexOf(supportedVersions_Protocol16, ProtocolVersion) > -1) return new Protocol16Handler(Client, ProtocolVersion, Handler); - int[] supportedVersions_Protocol18 = { 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 }; + int[] supportedVersions_Protocol18 = { 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 }; if (Array.IndexOf(supportedVersions_Protocol18, ProtocolVersion) > -1) return new Protocol18Handler(Client, ProtocolVersion, Handler, forgeInfo); @@ -313,6 +313,8 @@ namespace MinecraftClient.Protocol case "1.19.1": case "1.19.2": return 760; + case "1.19.3": + return 761; default: return 0; } @@ -389,6 +391,7 @@ namespace MinecraftClient.Protocol case 758: return "1.18.2"; case 759: return "1.19"; case 760: return "1.19.2"; + case 761: return "1.19.3"; default: return "0.0"; } } diff --git a/MinecraftClient/Protocol/ReplayHandler.cs b/MinecraftClient/Protocol/ReplayHandler.cs index abaeecfc..1c88eb6a 100644 --- a/MinecraftClient/Protocol/ReplayHandler.cs +++ b/MinecraftClient/Protocol/ReplayHandler.cs @@ -233,7 +233,7 @@ namespace MinecraftClient.Protocol // build raw packet // format: packetID + packetData List rawPacket = new(); - rawPacket.AddRange(dataTypes.GetVarInt(packetID).ToArray()); + rawPacket.AddRange(DataTypes.GetVarInt(packetID).ToArray()); rawPacket.AddRange(packetData.ToArray()); // build format // format: timestamp + packetLength + RawPacket @@ -376,7 +376,7 @@ namespace MinecraftClient.Protocol private byte[] GetSpawnPlayerPacket(int entityID, Guid playerUUID, Location location, double pitch, double yaw) { List packet = new(); - packet.AddRange(dataTypes.GetVarInt(entityID)); + packet.AddRange(DataTypes.GetVarInt(entityID)); packet.AddRange(playerUUID.ToBigEndianBytes()); packet.AddRange(dataTypes.GetDouble(location.X)); packet.AddRange(dataTypes.GetDouble(location.Y)); diff --git a/MinecraftClient/Resources/ConfigComments/ConfigComments.Designer.cs b/MinecraftClient/Resources/ConfigComments/ConfigComments.Designer.cs index 068377a5..82e0532f 100644 --- a/MinecraftClient/Resources/ConfigComments/ConfigComments.Designer.cs +++ b/MinecraftClient/Resources/ConfigComments/ConfigComments.Designer.cs @@ -1561,7 +1561,7 @@ namespace MinecraftClient { } /// - /// Looks up a localized string similar to Temporary fix for Badpacket issue on some servers.. + /// Looks up a localized string similar to Temporary fix for Badpacket issue on some servers. Need to enable "TerrainAndMovements" first.. /// internal static string Main_Advanced_temporary_fix_badpacket { get { diff --git a/MinecraftClient/Resources/ConfigComments/ConfigComments.resx b/MinecraftClient/Resources/ConfigComments/ConfigComments.resx index 8dc6735a..b302fea0 100644 --- a/MinecraftClient/Resources/ConfigComments/ConfigComments.resx +++ b/MinecraftClient/Resources/ConfigComments/ConfigComments.resx @@ -703,7 +703,7 @@ Usage examples: "/tell <mybot> connect Server1", "/connect Server2"Messages displayed above xp bar, set this to false in case of xp bar spam. - Temporary fix for Badpacket issue on some servers. + Temporary fix for Badpacket issue on some servers. Need to enable "TerrainAndMovements" first. Uses more ram, cpu, bandwidth but allows you to move around. diff --git a/MinecraftClient/Resources/Translations/Translations.Designer.cs b/MinecraftClient/Resources/Translations/Translations.Designer.cs index 9c1b8d84..a0ca3082 100644 --- a/MinecraftClient/Resources/Translations/Translations.Designer.cs +++ b/MinecraftClient/Resources/Translations/Translations.Designer.cs @@ -2704,6 +2704,15 @@ namespace MinecraftClient { } } + /// + /// Looks up a localized string similar to Cancel mining the block located at {0}.. + /// + internal static string cmd_dig_cancel { + get { + return ResourceManager.GetString("cmd.dig.cancel", resourceCulture); + } + } + /// /// Looks up a localized string similar to Attempt to break a block. /// @@ -2722,6 +2731,15 @@ namespace MinecraftClient { } } + /// + /// Looks up a localized string similar to Mining of the block located at {0} ends.. + /// + internal static string cmd_dig_end { + get { + return ResourceManager.GetString("cmd.dig.end", resourceCulture); + } + } + /// /// Looks up a localized string similar to Failed to start digging block.. /// diff --git a/MinecraftClient/Resources/Translations/Translations.resx b/MinecraftClient/Resources/Translations/Translations.resx index 73e81493..120249c5 100644 --- a/MinecraftClient/Resources/Translations/Translations.resx +++ b/MinecraftClient/Resources/Translations/Translations.resx @@ -2028,4 +2028,10 @@ Logging in... Connected to proxy {0}:{1} + + Mining of the block located at {0} ends. + + + Cancel mining the block located at {0}. + \ No newline at end of file diff --git a/MinecraftClient/Settings.cs b/MinecraftClient/Settings.cs index 8ddd556b..6b6bb5b9 100644 --- a/MinecraftClient/Settings.cs +++ b/MinecraftClient/Settings.cs @@ -35,7 +35,7 @@ namespace MinecraftClient // Other Settings public const string TranslationsFile_Version = "1.19.3"; public const string TranslationsFile_Website_Index = "https://piston-meta.mojang.com/v1/packages/c492375ded5da34b646b8c5c0842a0028bc69cec/2.json"; - public const string TranslationsFile_Website_Download = "http://resources.download.minecraft.net"; + public const string TranslationsFile_Website_Download = "https://resources.download.minecraft.net"; public const string TranslationProjectUrl = "https://crwd.in/minecraft-console-client"; @@ -472,6 +472,12 @@ namespace MinecraftClient Advanced.MinTerminalWidth = 1; if (Advanced.MinTerminalHeight < 1) Advanced.MinTerminalHeight = 1; + + if (Advanced.TemporaryFixBadpacket && !Advanced.TerrainAndMovements) + { + Advanced.TerrainAndMovements = true; + ConsoleIO.WriteLineFormatted("§c[Settings]You need to enable TerrainAndMovements before enabling TemporaryFixBadpacket."); + } } [TomlDoNotInlineObject] @@ -519,7 +525,7 @@ namespace MinecraftClient public string MinecraftVersion = "auto"; [TomlInlineComment("$Main.Advanced.mc_forge$")] - public ForgeConfigType EnableForge = ForgeConfigType.auto; + public ForgeConfigType EnableForge = ForgeConfigType.no; [TomlInlineComment("$Main.Advanced.brand_info$")] public BrandInfoType BrandInfo = BrandInfoType.mcc; @@ -792,7 +798,7 @@ namespace MinecraftClient ConsoleInteractive.ConsoleWriter.UseVT100ColorCode = General.ConsoleColorMode != ConsoleColorModeType.legacy_4bit; // Buffer - General.History_Input_Records = + General.History_Input_Records = ConsoleInteractive.ConsoleBuffer.SetBackreadBufferLimit(General.History_Input_Records); // Suggestion @@ -1204,27 +1210,27 @@ namespace MinecraftClient catch (ArgumentException) { checkResult = false; - ConsoleIO.WriteLineFormatted("§cIllegal regular expression: ChatFormat.Public = " + Public); + ConsoleIO.WriteLineFormatted("§c[Settings]Illegal regular expression: ChatFormat.Public = " + Public); } try { _ = new Regex(Private); } catch (ArgumentException) { checkResult = false; - ConsoleIO.WriteLineFormatted("§cIllegal regular expression: ChatFormat.Private = " + Private); + ConsoleIO.WriteLineFormatted("§c[Settings]Illegal regular expression: ChatFormat.Private = " + Private); } try { _ = new Regex(TeleportRequest); } catch (ArgumentException) { checkResult = false; - ConsoleIO.WriteLineFormatted("§cIllegal regular expression: ChatFormat.TeleportRequest = " + TeleportRequest); + ConsoleIO.WriteLineFormatted("§c[Settings]Illegal regular expression: ChatFormat.TeleportRequest = " + TeleportRequest); } if (!checkResult) { UserDefined = false; - ConsoleIO.WriteLineFormatted("§cChatFormat: User-defined regular expressions are disabled."); + ConsoleIO.WriteLineFormatted("§c[Settings]ChatFormat: User-defined regular expressions are disabled."); } } }