diff --git a/MinecraftClient/Inventory/ItemPalettes/ItemPalette1194.cs b/MinecraftClient/Inventory/ItemPalettes/ItemPalette1194.cs new file mode 100644 index 00000000..2b23cabb --- /dev/null +++ b/MinecraftClient/Inventory/ItemPalettes/ItemPalette1194.cs @@ -0,0 +1,1246 @@ +using System.Collections.Generic; + +namespace MinecraftClient.Inventory.ItemPalettes +{ + public class ItemPalette1194 : ItemPalette + { + private static readonly Dictionary mappings = new(); + + static ItemPalette1194() + { + mappings[740] = ItemType.AcaciaBoat; + mappings[662] = ItemType.AcaciaButton; + mappings[741] = ItemType.AcaciaChestBoat; + mappings[689] = ItemType.AcaciaDoor; + mappings[291] = ItemType.AcaciaFence; + mappings[712] = ItemType.AcaciaFenceGate; + mappings[857] = ItemType.AcaciaHangingSign; + mappings[157] = ItemType.AcaciaLeaves; + mappings[113] = ItemType.AcaciaLog; + mappings[27] = ItemType.AcaciaPlanks; + mappings[677] = ItemType.AcaciaPressurePlate; + mappings[39] = ItemType.AcaciaSapling; + mappings[846] = ItemType.AcaciaSign; + mappings[232] = ItemType.AcaciaSlab; + mappings[363] = ItemType.AcaciaStairs; + mappings[701] = ItemType.AcaciaTrapdoor; + mappings[147] = ItemType.AcaciaWood; + mappings[722] = ItemType.ActivatorRail; + mappings[0] = ItemType.Air; + mappings[963] = ItemType.AllaySpawnEgg; + mappings[198] = ItemType.Allium; + mappings[71] = ItemType.AmethystBlock; + mappings[1204] = ItemType.AmethystCluster; + mappings[764] = ItemType.AmethystShard; + mappings[66] = ItemType.AncientDebris; + mappings[6] = ItemType.Andesite; + mappings[623] = ItemType.AndesiteSlab; + mappings[606] = ItemType.AndesiteStairs; + mappings[383] = ItemType.AndesiteWall; + mappings[395] = ItemType.Anvil; + mappings[755] = ItemType.Apple; + mappings[1073] = ItemType.ArmorStand; + mappings[757] = ItemType.Arrow; + mappings[875] = ItemType.AxolotlBucket; + mappings[964] = ItemType.AxolotlSpawnEgg; + mappings[174] = ItemType.Azalea; + mappings[161] = ItemType.AzaleaLeaves; + mappings[199] = ItemType.AzureBluet; + mappings[1049] = ItemType.BakedPotato; + mappings[227] = ItemType.Bamboo; + mappings[121] = ItemType.BambooBlock; + mappings[666] = ItemType.BambooButton; + mappings[749] = ItemType.BambooChestRaft; + mappings[693] = ItemType.BambooDoor; + mappings[295] = ItemType.BambooFence; + mappings[716] = ItemType.BambooFenceGate; + mappings[861] = ItemType.BambooHangingSign; + mappings[34] = ItemType.BambooMosaic; + mappings[237] = ItemType.BambooMosaicSlab; + mappings[368] = ItemType.BambooMosaicStairs; + mappings[31] = ItemType.BambooPlanks; + mappings[681] = ItemType.BambooPressurePlate; + mappings[748] = ItemType.BambooRaft; + mappings[850] = ItemType.BambooSign; + mappings[236] = ItemType.BambooSlab; + mappings[367] = ItemType.BambooStairs; + mappings[705] = ItemType.BambooTrapdoor; + mappings[1148] = ItemType.Barrel; + mappings[419] = ItemType.Barrier; + mappings[304] = ItemType.Basalt; + mappings[965] = ItemType.BatSpawnEgg; + mappings[372] = ItemType.Beacon; + mappings[43] = ItemType.Bedrock; + mappings[1165] = ItemType.BeeNest; + mappings[966] = ItemType.BeeSpawnEgg; + mappings[943] = ItemType.Beef; + mappings[1166] = ItemType.Beehive; + mappings[1103] = ItemType.Beetroot; + mappings[1104] = ItemType.BeetrootSeeds; + mappings[1105] = ItemType.BeetrootSoup; + mappings[1156] = ItemType.Bell; + mappings[225] = ItemType.BigDripleaf; + mappings[736] = ItemType.BirchBoat; + mappings[660] = ItemType.BirchButton; + mappings[737] = ItemType.BirchChestBoat; + mappings[687] = ItemType.BirchDoor; + mappings[289] = ItemType.BirchFence; + mappings[710] = ItemType.BirchFenceGate; + mappings[855] = ItemType.BirchHangingSign; + mappings[155] = ItemType.BirchLeaves; + mappings[111] = ItemType.BirchLog; + mappings[25] = ItemType.BirchPlanks; + mappings[675] = ItemType.BirchPressurePlate; + mappings[37] = ItemType.BirchSapling; + mappings[844] = ItemType.BirchSign; + mappings[230] = ItemType.BirchSlab; + mappings[361] = ItemType.BirchStairs; + mappings[699] = ItemType.BirchTrapdoor; + mappings[145] = ItemType.BirchWood; + mappings[1098] = ItemType.BlackBanner; + mappings[935] = ItemType.BlackBed; + mappings[1200] = ItemType.BlackCandle; + mappings[437] = ItemType.BlackCarpet; + mappings[546] = ItemType.BlackConcrete; + mappings[562] = ItemType.BlackConcretePowder; + mappings[915] = ItemType.BlackDye; + mappings[530] = ItemType.BlackGlazedTerracotta; + mappings[514] = ItemType.BlackShulkerBox; + mappings[462] = ItemType.BlackStainedGlass; + mappings[478] = ItemType.BlackStainedGlassPane; + mappings[418] = ItemType.BlackTerracotta; + mappings[194] = ItemType.BlackWool; + mappings[1171] = ItemType.Blackstone; + mappings[1172] = ItemType.BlackstoneSlab; + mappings[1173] = ItemType.BlackstoneStairs; + mappings[388] = ItemType.BlackstoneWall; + mappings[1150] = ItemType.BlastFurnace; + mappings[957] = ItemType.BlazePowder; + mappings[949] = ItemType.BlazeRod; + mappings[967] = ItemType.BlazeSpawnEgg; + mappings[1094] = ItemType.BlueBanner; + mappings[931] = ItemType.BlueBed; + mappings[1196] = ItemType.BlueCandle; + mappings[433] = ItemType.BlueCarpet; + mappings[542] = ItemType.BlueConcrete; + mappings[558] = ItemType.BlueConcretePowder; + mappings[911] = ItemType.BlueDye; + mappings[526] = ItemType.BlueGlazedTerracotta; + mappings[594] = ItemType.BlueIce; + mappings[197] = ItemType.BlueOrchid; + mappings[510] = ItemType.BlueShulkerBox; + mappings[458] = ItemType.BlueStainedGlass; + mappings[474] = ItemType.BlueStainedGlassPane; + mappings[414] = ItemType.BlueTerracotta; + mappings[190] = ItemType.BlueWool; + mappings[917] = ItemType.Bone; + mappings[496] = ItemType.BoneBlock; + mappings[916] = ItemType.BoneMeal; + mappings[881] = ItemType.Book; + mappings[262] = ItemType.Bookshelf; + mappings[756] = ItemType.Bow; + mappings[804] = ItemType.Bowl; + mappings[575] = ItemType.BrainCoral; + mappings[570] = ItemType.BrainCoralBlock; + mappings[585] = ItemType.BrainCoralFan; + mappings[811] = ItemType.Bread; + mappings[959] = ItemType.BrewingStand; + mappings[877] = ItemType.Brick; + mappings[246] = ItemType.BrickSlab; + mappings[337] = ItemType.BrickStairs; + mappings[375] = ItemType.BrickWall; + mappings[261] = ItemType.Bricks; + mappings[1095] = ItemType.BrownBanner; + mappings[932] = ItemType.BrownBed; + mappings[1197] = ItemType.BrownCandle; + mappings[434] = ItemType.BrownCarpet; + mappings[543] = ItemType.BrownConcrete; + mappings[559] = ItemType.BrownConcretePowder; + mappings[912] = ItemType.BrownDye; + mappings[527] = ItemType.BrownGlazedTerracotta; + mappings[210] = ItemType.BrownMushroom; + mappings[328] = ItemType.BrownMushroomBlock; + mappings[511] = ItemType.BrownShulkerBox; + mappings[459] = ItemType.BrownStainedGlass; + mappings[475] = ItemType.BrownStainedGlassPane; + mappings[415] = ItemType.BrownTerracotta; + mappings[191] = ItemType.BrownWool; + mappings[1211] = ItemType.Brush; + mappings[576] = ItemType.BubbleCoral; + mappings[571] = ItemType.BubbleCoralBlock; + mappings[586] = ItemType.BubbleCoralFan; + mappings[864] = ItemType.Bucket; + mappings[72] = ItemType.BuddingAmethyst; + mappings[886] = ItemType.Bundle; + mappings[284] = ItemType.Cactus; + mappings[919] = ItemType.Cake; + mappings[11] = ItemType.Calcite; + mappings[969] = ItemType.CamelSpawnEgg; + mappings[1161] = ItemType.Campfire; + mappings[1184] = ItemType.Candle; + mappings[1047] = ItemType.Carrot; + mappings[729] = ItemType.CarrotOnAStick; + mappings[1151] = ItemType.CartographyTable; + mappings[299] = ItemType.CarvedPumpkin; + mappings[968] = ItemType.CatSpawnEgg; + mappings[960] = ItemType.Cauldron; + mappings[970] = ItemType.CaveSpiderSpawnEgg; + mappings[332] = ItemType.Chain; + mappings[491] = ItemType.ChainCommandBlock; + mappings[819] = ItemType.ChainmailBoots; + mappings[817] = ItemType.ChainmailChestplate; + mappings[816] = ItemType.ChainmailHelmet; + mappings[818] = ItemType.ChainmailLeggings; + mappings[759] = ItemType.Charcoal; + mappings[742] = ItemType.CherryBoat; + mappings[663] = ItemType.CherryButton; + mappings[743] = ItemType.CherryChestBoat; + mappings[690] = ItemType.CherryDoor; + mappings[292] = ItemType.CherryFence; + mappings[713] = ItemType.CherryFenceGate; + mappings[858] = ItemType.CherryHangingSign; + mappings[158] = ItemType.CherryLeaves; + mappings[114] = ItemType.CherryLog; + mappings[28] = ItemType.CherryPlanks; + mappings[678] = ItemType.CherryPressurePlate; + mappings[40] = ItemType.CherrySapling; + mappings[847] = ItemType.CherrySign; + mappings[233] = ItemType.CherrySlab; + mappings[364] = ItemType.CherryStairs; + mappings[702] = ItemType.CherryTrapdoor; + mappings[148] = ItemType.CherryWood; + mappings[275] = ItemType.Chest; + mappings[725] = ItemType.ChestMinecart; + mappings[945] = ItemType.Chicken; + mappings[971] = ItemType.ChickenSpawnEgg; + mappings[396] = ItemType.ChippedAnvil; + mappings[263] = ItemType.ChiseledBookshelf; + mappings[326] = ItemType.ChiseledDeepslate; + mappings[344] = ItemType.ChiseledNetherBricks; + mappings[1178] = ItemType.ChiseledPolishedBlackstone; + mappings[398] = ItemType.ChiseledQuartzBlock; + mappings[487] = ItemType.ChiseledRedSandstone; + mappings[169] = ItemType.ChiseledSandstone; + mappings[319] = ItemType.ChiseledStoneBricks; + mappings[270] = ItemType.ChorusFlower; + mappings[1100] = ItemType.ChorusFruit; + mappings[269] = ItemType.ChorusPlant; + mappings[285] = ItemType.Clay; + mappings[878] = ItemType.ClayBall; + mappings[888] = ItemType.Clock; + mappings[758] = ItemType.Coal; + mappings[67] = ItemType.CoalBlock; + mappings[48] = ItemType.CoalOre; + mappings[16] = ItemType.CoarseDirt; + mappings[1215] = ItemType.CoastArmorTrimSmithingTemplate; + mappings[9] = ItemType.CobbledDeepslate; + mappings[627] = ItemType.CobbledDeepslateSlab; + mappings[610] = ItemType.CobbledDeepslateStairs; + mappings[391] = ItemType.CobbledDeepslateWall; + mappings[22] = ItemType.Cobblestone; + mappings[245] = ItemType.CobblestoneSlab; + mappings[280] = ItemType.CobblestoneStairs; + mappings[373] = ItemType.CobblestoneWall; + mappings[171] = ItemType.Cobweb; + mappings[899] = ItemType.CocoaBeans; + mappings[891] = ItemType.Cod; + mappings[873] = ItemType.CodBucket; + mappings[972] = ItemType.CodSpawnEgg; + mappings[371] = ItemType.CommandBlock; + mappings[1080] = ItemType.CommandBlockMinecart; + mappings[636] = ItemType.Comparator; + mappings[884] = ItemType.Compass; + mappings[1147] = ItemType.Composter; + mappings[595] = ItemType.Conduit; + mappings[944] = ItemType.CookedBeef; + mappings[946] = ItemType.CookedChicken; + mappings[895] = ItemType.CookedCod; + mappings[1082] = ItemType.CookedMutton; + mappings[838] = ItemType.CookedPorkchop; + mappings[1069] = ItemType.CookedRabbit; + mappings[896] = ItemType.CookedSalmon; + mappings[936] = ItemType.Cookie; + mappings[74] = ItemType.CopperBlock; + mappings[768] = ItemType.CopperIngot; + mappings[52] = ItemType.CopperOre; + mappings[205] = ItemType.Cornflower; + mappings[973] = ItemType.CowSpawnEgg; + mappings[323] = ItemType.CrackedDeepslateBricks; + mappings[325] = ItemType.CrackedDeepslateTiles; + mappings[343] = ItemType.CrackedNetherBricks; + mappings[1182] = ItemType.CrackedPolishedBlackstoneBricks; + mappings[318] = ItemType.CrackedStoneBricks; + mappings[276] = ItemType.CraftingTable; + mappings[1141] = ItemType.CreeperBannerPattern; + mappings[1057] = ItemType.CreeperHead; + mappings[974] = ItemType.CreeperSpawnEgg; + mappings[667] = ItemType.CrimsonButton; + mappings[694] = ItemType.CrimsonDoor; + mappings[296] = ItemType.CrimsonFence; + mappings[717] = ItemType.CrimsonFenceGate; + mappings[212] = ItemType.CrimsonFungus; + mappings[862] = ItemType.CrimsonHangingSign; + mappings[151] = ItemType.CrimsonHyphae; + mappings[20] = ItemType.CrimsonNylium; + mappings[32] = ItemType.CrimsonPlanks; + mappings[682] = ItemType.CrimsonPressurePlate; + mappings[214] = ItemType.CrimsonRoots; + mappings[851] = ItemType.CrimsonSign; + mappings[238] = ItemType.CrimsonSlab; + mappings[369] = ItemType.CrimsonStairs; + mappings[119] = ItemType.CrimsonStem; + mappings[706] = ItemType.CrimsonTrapdoor; + mappings[1137] = ItemType.Crossbow; + mappings[1170] = ItemType.CryingObsidian; + mappings[81] = ItemType.CutCopper; + mappings[89] = ItemType.CutCopperSlab; + mappings[85] = ItemType.CutCopperStairs; + mappings[488] = ItemType.CutRedSandstone; + mappings[252] = ItemType.CutRedSandstoneSlab; + mappings[170] = ItemType.CutSandstone; + mappings[243] = ItemType.CutSandstoneSlab; + mappings[1092] = ItemType.CyanBanner; + mappings[929] = ItemType.CyanBed; + mappings[1194] = ItemType.CyanCandle; + mappings[431] = ItemType.CyanCarpet; + mappings[540] = ItemType.CyanConcrete; + mappings[556] = ItemType.CyanConcretePowder; + mappings[909] = ItemType.CyanDye; + mappings[524] = ItemType.CyanGlazedTerracotta; + mappings[508] = ItemType.CyanShulkerBox; + mappings[456] = ItemType.CyanStainedGlass; + mappings[472] = ItemType.CyanStainedGlassPane; + mappings[412] = ItemType.CyanTerracotta; + mappings[188] = ItemType.CyanWool; + mappings[397] = ItemType.DamagedAnvil; + mappings[195] = ItemType.Dandelion; + mappings[744] = ItemType.DarkOakBoat; + mappings[664] = ItemType.DarkOakButton; + mappings[745] = ItemType.DarkOakChestBoat; + mappings[691] = ItemType.DarkOakDoor; + mappings[293] = ItemType.DarkOakFence; + mappings[714] = ItemType.DarkOakFenceGate; + mappings[859] = ItemType.DarkOakHangingSign; + mappings[159] = ItemType.DarkOakLeaves; + mappings[115] = ItemType.DarkOakLog; + mappings[29] = ItemType.DarkOakPlanks; + mappings[679] = ItemType.DarkOakPressurePlate; + mappings[41] = ItemType.DarkOakSapling; + mappings[848] = ItemType.DarkOakSign; + mappings[234] = ItemType.DarkOakSlab; + mappings[365] = ItemType.DarkOakStairs; + mappings[703] = ItemType.DarkOakTrapdoor; + mappings[149] = ItemType.DarkOakWood; + mappings[481] = ItemType.DarkPrismarine; + mappings[256] = ItemType.DarkPrismarineSlab; + mappings[484] = ItemType.DarkPrismarineStairs; + mappings[649] = ItemType.DaylightDetector; + mappings[579] = ItemType.DeadBrainCoral; + mappings[565] = ItemType.DeadBrainCoralBlock; + mappings[590] = ItemType.DeadBrainCoralFan; + mappings[580] = ItemType.DeadBubbleCoral; + mappings[566] = ItemType.DeadBubbleCoralBlock; + mappings[591] = ItemType.DeadBubbleCoralFan; + mappings[176] = ItemType.DeadBush; + mappings[581] = ItemType.DeadFireCoral; + mappings[567] = ItemType.DeadFireCoralBlock; + mappings[592] = ItemType.DeadFireCoralFan; + mappings[582] = ItemType.DeadHornCoral; + mappings[568] = ItemType.DeadHornCoralBlock; + mappings[593] = ItemType.DeadHornCoralFan; + mappings[583] = ItemType.DeadTubeCoral; + mappings[564] = ItemType.DeadTubeCoralBlock; + mappings[589] = ItemType.DeadTubeCoralFan; + mappings[1116] = ItemType.DebugStick; + mappings[264] = ItemType.DecoratedPot; + mappings[8] = ItemType.Deepslate; + mappings[629] = ItemType.DeepslateBrickSlab; + mappings[612] = ItemType.DeepslateBrickStairs; + mappings[393] = ItemType.DeepslateBrickWall; + mappings[322] = ItemType.DeepslateBricks; + mappings[49] = ItemType.DeepslateCoalOre; + mappings[53] = ItemType.DeepslateCopperOre; + mappings[63] = ItemType.DeepslateDiamondOre; + mappings[59] = ItemType.DeepslateEmeraldOre; + mappings[55] = ItemType.DeepslateGoldOre; + mappings[51] = ItemType.DeepslateIronOre; + mappings[61] = ItemType.DeepslateLapisOre; + mappings[57] = ItemType.DeepslateRedstoneOre; + mappings[630] = ItemType.DeepslateTileSlab; + mappings[613] = ItemType.DeepslateTileStairs; + mappings[394] = ItemType.DeepslateTileWall; + mappings[324] = ItemType.DeepslateTiles; + mappings[720] = ItemType.DetectorRail; + mappings[760] = ItemType.Diamond; + mappings[796] = ItemType.DiamondAxe; + mappings[76] = ItemType.DiamondBlock; + mappings[827] = ItemType.DiamondBoots; + mappings[825] = ItemType.DiamondChestplate; + mappings[824] = ItemType.DiamondHelmet; + mappings[797] = ItemType.DiamondHoe; + mappings[1076] = ItemType.DiamondHorseArmor; + mappings[826] = ItemType.DiamondLeggings; + mappings[62] = ItemType.DiamondOre; + mappings[795] = ItemType.DiamondPickaxe; + mappings[794] = ItemType.DiamondShovel; + mappings[793] = ItemType.DiamondSword; + mappings[4] = ItemType.Diorite; + mappings[626] = ItemType.DioriteSlab; + mappings[609] = ItemType.DioriteStairs; + mappings[387] = ItemType.DioriteWall; + mappings[15] = ItemType.Dirt; + mappings[440] = ItemType.DirtPath; + mappings[1132] = ItemType.DiscFragment5; + mappings[643] = ItemType.Dispenser; + mappings[975] = ItemType.DolphinSpawnEgg; + mappings[976] = ItemType.DonkeySpawnEgg; + mappings[1106] = ItemType.DragonBreath; + mappings[355] = ItemType.DragonEgg; + mappings[1058] = ItemType.DragonHead; + mappings[940] = ItemType.DriedKelp; + mappings[879] = ItemType.DriedKelpBlock; + mappings[13] = ItemType.DripstoneBlock; + mappings[644] = ItemType.Dropper; + mappings[977] = ItemType.DrownedSpawnEgg; + mappings[1214] = ItemType.DuneArmorTrimSmithingTemplate; + mappings[1210] = ItemType.EchoShard; + mappings[883] = ItemType.Egg; + mappings[978] = ItemType.ElderGuardianSpawnEgg; + mappings[731] = ItemType.Elytra; + mappings[761] = ItemType.Emerald; + mappings[358] = ItemType.EmeraldBlock; + mappings[58] = ItemType.EmeraldOre; + mappings[1064] = ItemType.EnchantedBook; + mappings[841] = ItemType.EnchantedGoldenApple; + mappings[351] = ItemType.EnchantingTable; + mappings[1099] = ItemType.EndCrystal; + mappings[352] = ItemType.EndPortalFrame; + mappings[268] = ItemType.EndRod; + mappings[353] = ItemType.EndStone; + mappings[619] = ItemType.EndStoneBrickSlab; + mappings[601] = ItemType.EndStoneBrickStairs; + mappings[386] = ItemType.EndStoneBrickWall; + mappings[354] = ItemType.EndStoneBricks; + mappings[357] = ItemType.EnderChest; + mappings[979] = ItemType.EnderDragonSpawnEgg; + mappings[961] = ItemType.EnderEye; + mappings[948] = ItemType.EnderPearl; + mappings[980] = ItemType.EndermanSpawnEgg; + mappings[981] = ItemType.EndermiteSpawnEgg; + mappings[982] = ItemType.EvokerSpawnEgg; + mappings[1040] = ItemType.ExperienceBottle; + mappings[78] = ItemType.ExposedCopper; + mappings[82] = ItemType.ExposedCutCopper; + mappings[90] = ItemType.ExposedCutCopperSlab; + mappings[86] = ItemType.ExposedCutCopperStairs; + mappings[1218] = ItemType.EyeArmorTrimSmithingTemplate; + mappings[277] = ItemType.Farmland; + mappings[807] = ItemType.Feather; + mappings[956] = ItemType.FermentedSpiderEye; + mappings[173] = ItemType.Fern; + mappings[937] = ItemType.FilledMap; + mappings[1041] = ItemType.FireCharge; + mappings[577] = ItemType.FireCoral; + mappings[572] = ItemType.FireCoralBlock; + mappings[587] = ItemType.FireCoralFan; + mappings[1062] = ItemType.FireworkRocket; + mappings[1063] = ItemType.FireworkStar; + mappings[887] = ItemType.FishingRod; + mappings[1152] = ItemType.FletchingTable; + mappings[836] = ItemType.Flint; + mappings[754] = ItemType.FlintAndSteel; + mappings[1140] = ItemType.FlowerBannerPattern; + mappings[1046] = ItemType.FlowerPot; + mappings[175] = ItemType.FloweringAzalea; + mappings[162] = ItemType.FloweringAzaleaLeaves; + mappings[983] = ItemType.FoxSpawnEgg; + mappings[984] = ItemType.FrogSpawnEgg; + mappings[1209] = ItemType.Frogspawn; + mappings[278] = ItemType.Furnace; + mappings[726] = ItemType.FurnaceMinecart; + mappings[985] = ItemType.GhastSpawnEgg; + mappings[950] = ItemType.GhastTear; + mappings[1174] = ItemType.GildedBlackstone; + mappings[165] = ItemType.Glass; + mappings[954] = ItemType.GlassBottle; + mappings[333] = ItemType.GlassPane; + mappings[962] = ItemType.GlisteringMelonSlice; + mappings[1144] = ItemType.GlobeBannerPattern; + mappings[1160] = ItemType.GlowBerries; + mappings[898] = ItemType.GlowInkSac; + mappings[1045] = ItemType.GlowItemFrame; + mappings[336] = ItemType.GlowLichen; + mappings[986] = ItemType.GlowSquidSpawnEgg; + mappings[308] = ItemType.Glowstone; + mappings[890] = ItemType.GlowstoneDust; + mappings[1146] = ItemType.GoatHorn; + mappings[987] = ItemType.GoatSpawnEgg; + mappings[75] = ItemType.GoldBlock; + mappings[770] = ItemType.GoldIngot; + mappings[951] = ItemType.GoldNugget; + mappings[54] = ItemType.GoldOre; + mappings[840] = ItemType.GoldenApple; + mappings[786] = ItemType.GoldenAxe; + mappings[831] = ItemType.GoldenBoots; + mappings[1052] = ItemType.GoldenCarrot; + mappings[829] = ItemType.GoldenChestplate; + mappings[828] = ItemType.GoldenHelmet; + mappings[787] = ItemType.GoldenHoe; + mappings[1075] = ItemType.GoldenHorseArmor; + mappings[830] = ItemType.GoldenLeggings; + mappings[785] = ItemType.GoldenPickaxe; + mappings[784] = ItemType.GoldenShovel; + mappings[783] = ItemType.GoldenSword; + mappings[2] = ItemType.Granite; + mappings[622] = ItemType.GraniteSlab; + mappings[605] = ItemType.GraniteStairs; + mappings[379] = ItemType.GraniteWall; + mappings[172] = ItemType.Grass; + mappings[14] = ItemType.GrassBlock; + mappings[47] = ItemType.Gravel; + mappings[1090] = ItemType.GrayBanner; + mappings[927] = ItemType.GrayBed; + mappings[1192] = ItemType.GrayCandle; + mappings[429] = ItemType.GrayCarpet; + mappings[538] = ItemType.GrayConcrete; + mappings[554] = ItemType.GrayConcretePowder; + mappings[907] = ItemType.GrayDye; + mappings[522] = ItemType.GrayGlazedTerracotta; + mappings[506] = ItemType.GrayShulkerBox; + mappings[454] = ItemType.GrayStainedGlass; + mappings[470] = ItemType.GrayStainedGlassPane; + mappings[410] = ItemType.GrayTerracotta; + mappings[186] = ItemType.GrayWool; + mappings[1096] = ItemType.GreenBanner; + mappings[933] = ItemType.GreenBed; + mappings[1198] = ItemType.GreenCandle; + mappings[435] = ItemType.GreenCarpet; + mappings[544] = ItemType.GreenConcrete; + mappings[560] = ItemType.GreenConcretePowder; + mappings[913] = ItemType.GreenDye; + mappings[528] = ItemType.GreenGlazedTerracotta; + mappings[512] = ItemType.GreenShulkerBox; + mappings[460] = ItemType.GreenStainedGlass; + mappings[476] = ItemType.GreenStainedGlassPane; + mappings[416] = ItemType.GreenTerracotta; + mappings[192] = ItemType.GreenWool; + mappings[1153] = ItemType.Grindstone; + mappings[988] = ItemType.GuardianSpawnEgg; + mappings[808] = ItemType.Gunpowder; + mappings[224] = ItemType.HangingRoots; + mappings[421] = ItemType.HayBlock; + mappings[1136] = ItemType.HeartOfTheSea; + mappings[672] = ItemType.HeavyWeightedPressurePlate; + mappings[989] = ItemType.HoglinSpawnEgg; + mappings[640] = ItemType.HoneyBlock; + mappings[1167] = ItemType.HoneyBottle; + mappings[1164] = ItemType.Honeycomb; + mappings[1168] = ItemType.HoneycombBlock; + mappings[642] = ItemType.Hopper; + mappings[728] = ItemType.HopperMinecart; + mappings[578] = ItemType.HornCoral; + mappings[573] = ItemType.HornCoralBlock; + mappings[588] = ItemType.HornCoralFan; + mappings[990] = ItemType.HorseSpawnEgg; + mappings[991] = ItemType.HuskSpawnEgg; + mappings[282] = ItemType.Ice; + mappings[314] = ItemType.InfestedChiseledStoneBricks; + mappings[310] = ItemType.InfestedCobblestone; + mappings[313] = ItemType.InfestedCrackedStoneBricks; + mappings[315] = ItemType.InfestedDeepslate; + mappings[312] = ItemType.InfestedMossyStoneBricks; + mappings[309] = ItemType.InfestedStone; + mappings[311] = ItemType.InfestedStoneBricks; + mappings[897] = ItemType.InkSac; + mappings[791] = ItemType.IronAxe; + mappings[331] = ItemType.IronBars; + mappings[73] = ItemType.IronBlock; + mappings[823] = ItemType.IronBoots; + mappings[821] = ItemType.IronChestplate; + mappings[684] = ItemType.IronDoor; + mappings[992] = ItemType.IronGolemSpawnEgg; + mappings[820] = ItemType.IronHelmet; + mappings[792] = ItemType.IronHoe; + mappings[1074] = ItemType.IronHorseArmor; + mappings[766] = ItemType.IronIngot; + mappings[822] = ItemType.IronLeggings; + mappings[1114] = ItemType.IronNugget; + mappings[50] = ItemType.IronOre; + mappings[790] = ItemType.IronPickaxe; + mappings[789] = ItemType.IronShovel; + mappings[788] = ItemType.IronSword; + mappings[696] = ItemType.IronTrapdoor; + mappings[1044] = ItemType.ItemFrame; + mappings[300] = ItemType.JackOLantern; + mappings[751] = ItemType.Jigsaw; + mappings[286] = ItemType.Jukebox; + mappings[738] = ItemType.JungleBoat; + mappings[661] = ItemType.JungleButton; + mappings[739] = ItemType.JungleChestBoat; + mappings[688] = ItemType.JungleDoor; + mappings[290] = ItemType.JungleFence; + mappings[711] = ItemType.JungleFenceGate; + mappings[856] = ItemType.JungleHangingSign; + mappings[156] = ItemType.JungleLeaves; + mappings[112] = ItemType.JungleLog; + mappings[26] = ItemType.JunglePlanks; + mappings[676] = ItemType.JunglePressurePlate; + mappings[38] = ItemType.JungleSapling; + mappings[845] = ItemType.JungleSign; + mappings[231] = ItemType.JungleSlab; + mappings[362] = ItemType.JungleStairs; + mappings[700] = ItemType.JungleTrapdoor; + mappings[146] = ItemType.JungleWood; + mappings[220] = ItemType.Kelp; + mappings[1115] = ItemType.KnowledgeBook; + mappings[279] = ItemType.Ladder; + mappings[1157] = ItemType.Lantern; + mappings[167] = ItemType.LapisBlock; + mappings[762] = ItemType.LapisLazuli; + mappings[60] = ItemType.LapisOre; + mappings[1203] = ItemType.LargeAmethystBud; + mappings[446] = ItemType.LargeFern; + mappings[866] = ItemType.LavaBucket; + mappings[1078] = ItemType.Lead; + mappings[869] = ItemType.Leather; + mappings[815] = ItemType.LeatherBoots; + mappings[813] = ItemType.LeatherChestplate; + mappings[812] = ItemType.LeatherHelmet; + mappings[1077] = ItemType.LeatherHorseArmor; + mappings[814] = ItemType.LeatherLeggings; + mappings[645] = ItemType.Lectern; + mappings[647] = ItemType.Lever; + mappings[420] = ItemType.Light; + mappings[1086] = ItemType.LightBlueBanner; + mappings[923] = ItemType.LightBlueBed; + mappings[1188] = ItemType.LightBlueCandle; + mappings[425] = ItemType.LightBlueCarpet; + mappings[534] = ItemType.LightBlueConcrete; + mappings[550] = ItemType.LightBlueConcretePowder; + mappings[903] = ItemType.LightBlueDye; + mappings[518] = ItemType.LightBlueGlazedTerracotta; + mappings[502] = ItemType.LightBlueShulkerBox; + mappings[450] = ItemType.LightBlueStainedGlass; + mappings[466] = ItemType.LightBlueStainedGlassPane; + mappings[406] = ItemType.LightBlueTerracotta; + mappings[182] = ItemType.LightBlueWool; + mappings[1091] = ItemType.LightGrayBanner; + mappings[928] = ItemType.LightGrayBed; + mappings[1193] = ItemType.LightGrayCandle; + mappings[430] = ItemType.LightGrayCarpet; + mappings[539] = ItemType.LightGrayConcrete; + mappings[555] = ItemType.LightGrayConcretePowder; + mappings[908] = ItemType.LightGrayDye; + mappings[523] = ItemType.LightGrayGlazedTerracotta; + mappings[507] = ItemType.LightGrayShulkerBox; + mappings[455] = ItemType.LightGrayStainedGlass; + mappings[471] = ItemType.LightGrayStainedGlassPane; + mappings[411] = ItemType.LightGrayTerracotta; + mappings[187] = ItemType.LightGrayWool; + mappings[671] = ItemType.LightWeightedPressurePlate; + mappings[648] = ItemType.LightningRod; + mappings[442] = ItemType.Lilac; + mappings[206] = ItemType.LilyOfTheValley; + mappings[341] = ItemType.LilyPad; + mappings[1088] = ItemType.LimeBanner; + mappings[925] = ItemType.LimeBed; + mappings[1190] = ItemType.LimeCandle; + mappings[427] = ItemType.LimeCarpet; + mappings[536] = ItemType.LimeConcrete; + mappings[552] = ItemType.LimeConcretePowder; + mappings[905] = ItemType.LimeDye; + mappings[520] = ItemType.LimeGlazedTerracotta; + mappings[504] = ItemType.LimeShulkerBox; + mappings[452] = ItemType.LimeStainedGlass; + mappings[468] = ItemType.LimeStainedGlassPane; + mappings[408] = ItemType.LimeTerracotta; + mappings[184] = ItemType.LimeWool; + mappings[1110] = ItemType.LingeringPotion; + mappings[993] = ItemType.LlamaSpawnEgg; + mappings[1169] = ItemType.Lodestone; + mappings[1139] = ItemType.Loom; + mappings[1085] = ItemType.MagentaBanner; + mappings[922] = ItemType.MagentaBed; + mappings[1187] = ItemType.MagentaCandle; + mappings[424] = ItemType.MagentaCarpet; + mappings[533] = ItemType.MagentaConcrete; + mappings[549] = ItemType.MagentaConcretePowder; + mappings[902] = ItemType.MagentaDye; + mappings[517] = ItemType.MagentaGlazedTerracotta; + mappings[501] = ItemType.MagentaShulkerBox; + mappings[449] = ItemType.MagentaStainedGlass; + mappings[465] = ItemType.MagentaStainedGlassPane; + mappings[405] = ItemType.MagentaTerracotta; + mappings[181] = ItemType.MagentaWool; + mappings[492] = ItemType.MagmaBlock; + mappings[958] = ItemType.MagmaCream; + mappings[994] = ItemType.MagmaCubeSpawnEgg; + mappings[746] = ItemType.MangroveBoat; + mappings[665] = ItemType.MangroveButton; + mappings[747] = ItemType.MangroveChestBoat; + mappings[692] = ItemType.MangroveDoor; + mappings[294] = ItemType.MangroveFence; + mappings[715] = ItemType.MangroveFenceGate; + mappings[860] = ItemType.MangroveHangingSign; + mappings[160] = ItemType.MangroveLeaves; + mappings[116] = ItemType.MangroveLog; + mappings[30] = ItemType.MangrovePlanks; + mappings[680] = ItemType.MangrovePressurePlate; + mappings[42] = ItemType.MangrovePropagule; + mappings[117] = ItemType.MangroveRoots; + mappings[849] = ItemType.MangroveSign; + mappings[235] = ItemType.MangroveSlab; + mappings[366] = ItemType.MangroveStairs; + mappings[704] = ItemType.MangroveTrapdoor; + mappings[150] = ItemType.MangroveWood; + mappings[1051] = ItemType.Map; + mappings[1202] = ItemType.MediumAmethystBud; + mappings[334] = ItemType.Melon; + mappings[942] = ItemType.MelonSeeds; + mappings[939] = ItemType.MelonSlice; + mappings[870] = ItemType.MilkBucket; + mappings[724] = ItemType.Minecart; + mappings[1143] = ItemType.MojangBannerPattern; + mappings[995] = ItemType.MooshroomSpawnEgg; + mappings[223] = ItemType.MossBlock; + mappings[221] = ItemType.MossCarpet; + mappings[265] = ItemType.MossyCobblestone; + mappings[618] = ItemType.MossyCobblestoneSlab; + mappings[600] = ItemType.MossyCobblestoneStairs; + mappings[374] = ItemType.MossyCobblestoneWall; + mappings[616] = ItemType.MossyStoneBrickSlab; + mappings[598] = ItemType.MossyStoneBrickStairs; + mappings[378] = ItemType.MossyStoneBrickWall; + mappings[317] = ItemType.MossyStoneBricks; + mappings[19] = ItemType.Mud; + mappings[248] = ItemType.MudBrickSlab; + mappings[339] = ItemType.MudBrickStairs; + mappings[381] = ItemType.MudBrickWall; + mappings[321] = ItemType.MudBricks; + mappings[118] = ItemType.MuddyMangroveRoots; + mappings[996] = ItemType.MuleSpawnEgg; + mappings[330] = ItemType.MushroomStem; + mappings[805] = ItemType.MushroomStew; + mappings[1127] = ItemType.MusicDisc11; + mappings[1117] = ItemType.MusicDisc13; + mappings[1130] = ItemType.MusicDisc5; + mappings[1119] = ItemType.MusicDiscBlocks; + mappings[1118] = ItemType.MusicDiscCat; + mappings[1120] = ItemType.MusicDiscChirp; + mappings[1121] = ItemType.MusicDiscFar; + mappings[1122] = ItemType.MusicDiscMall; + mappings[1123] = ItemType.MusicDiscMellohi; + mappings[1129] = ItemType.MusicDiscOtherside; + mappings[1131] = ItemType.MusicDiscPigstep; + mappings[1124] = ItemType.MusicDiscStal; + mappings[1125] = ItemType.MusicDiscStrad; + mappings[1128] = ItemType.MusicDiscWait; + mappings[1126] = ItemType.MusicDiscWard; + mappings[1081] = ItemType.Mutton; + mappings[340] = ItemType.Mycelium; + mappings[1079] = ItemType.NameTag; + mappings[1135] = ItemType.NautilusShell; + mappings[1065] = ItemType.NetherBrick; + mappings[345] = ItemType.NetherBrickFence; + mappings[249] = ItemType.NetherBrickSlab; + mappings[346] = ItemType.NetherBrickStairs; + mappings[382] = ItemType.NetherBrickWall; + mappings[342] = ItemType.NetherBricks; + mappings[64] = ItemType.NetherGoldOre; + mappings[65] = ItemType.NetherQuartzOre; + mappings[216] = ItemType.NetherSprouts; + mappings[1060] = ItemType.NetherStar; + mappings[952] = ItemType.NetherWart; + mappings[493] = ItemType.NetherWartBlock; + mappings[801] = ItemType.NetheriteAxe; + mappings[77] = ItemType.NetheriteBlock; + mappings[835] = ItemType.NetheriteBoots; + mappings[833] = ItemType.NetheriteChestplate; + mappings[832] = ItemType.NetheriteHelmet; + mappings[802] = ItemType.NetheriteHoe; + mappings[771] = ItemType.NetheriteIngot; + mappings[834] = ItemType.NetheriteLeggings; + mappings[800] = ItemType.NetheritePickaxe; + mappings[772] = ItemType.NetheriteScrap; + mappings[799] = ItemType.NetheriteShovel; + mappings[798] = ItemType.NetheriteSword; + mappings[1212] = ItemType.NetheriteUpgradeSmithingTemplate; + mappings[301] = ItemType.Netherrack; + mappings[655] = ItemType.NoteBlock; + mappings[732] = ItemType.OakBoat; + mappings[658] = ItemType.OakButton; + mappings[733] = ItemType.OakChestBoat; + mappings[685] = ItemType.OakDoor; + mappings[287] = ItemType.OakFence; + mappings[708] = ItemType.OakFenceGate; + mappings[853] = ItemType.OakHangingSign; + mappings[153] = ItemType.OakLeaves; + mappings[109] = ItemType.OakLog; + mappings[23] = ItemType.OakPlanks; + mappings[673] = ItemType.OakPressurePlate; + mappings[35] = ItemType.OakSapling; + mappings[842] = ItemType.OakSign; + mappings[228] = ItemType.OakSlab; + mappings[359] = ItemType.OakStairs; + mappings[697] = ItemType.OakTrapdoor; + mappings[143] = ItemType.OakWood; + mappings[641] = ItemType.Observer; + mappings[266] = ItemType.Obsidian; + mappings[997] = ItemType.OcelotSpawnEgg; + mappings[1206] = ItemType.OchreFroglight; + mappings[1084] = ItemType.OrangeBanner; + mappings[921] = ItemType.OrangeBed; + mappings[1186] = ItemType.OrangeCandle; + mappings[423] = ItemType.OrangeCarpet; + mappings[532] = ItemType.OrangeConcrete; + mappings[548] = ItemType.OrangeConcretePowder; + mappings[901] = ItemType.OrangeDye; + mappings[516] = ItemType.OrangeGlazedTerracotta; + mappings[500] = ItemType.OrangeShulkerBox; + mappings[448] = ItemType.OrangeStainedGlass; + mappings[464] = ItemType.OrangeStainedGlassPane; + mappings[404] = ItemType.OrangeTerracotta; + mappings[201] = ItemType.OrangeTulip; + mappings[180] = ItemType.OrangeWool; + mappings[204] = ItemType.OxeyeDaisy; + mappings[80] = ItemType.OxidizedCopper; + mappings[84] = ItemType.OxidizedCutCopper; + mappings[92] = ItemType.OxidizedCutCopperSlab; + mappings[88] = ItemType.OxidizedCutCopperStairs; + mappings[439] = ItemType.PackedIce; + mappings[320] = ItemType.PackedMud; + mappings[839] = ItemType.Painting; + mappings[998] = ItemType.PandaSpawnEgg; + mappings[880] = ItemType.Paper; + mappings[999] = ItemType.ParrotSpawnEgg; + mappings[1208] = ItemType.PearlescentFroglight; + mappings[444] = ItemType.Peony; + mappings[244] = ItemType.PetrifiedOakSlab; + mappings[1134] = ItemType.PhantomMembrane; + mappings[1000] = ItemType.PhantomSpawnEgg; + mappings[1001] = ItemType.PigSpawnEgg; + mappings[1145] = ItemType.PiglinBannerPattern; + mappings[1003] = ItemType.PiglinBruteSpawnEgg; + mappings[1059] = ItemType.PiglinHead; + mappings[1002] = ItemType.PiglinSpawnEgg; + mappings[1004] = ItemType.PillagerSpawnEgg; + mappings[1089] = ItemType.PinkBanner; + mappings[926] = ItemType.PinkBed; + mappings[1191] = ItemType.PinkCandle; + mappings[428] = ItemType.PinkCarpet; + mappings[537] = ItemType.PinkConcrete; + mappings[553] = ItemType.PinkConcretePowder; + mappings[906] = ItemType.PinkDye; + mappings[521] = ItemType.PinkGlazedTerracotta; + mappings[222] = ItemType.PinkPetals; + mappings[505] = ItemType.PinkShulkerBox; + mappings[453] = ItemType.PinkStainedGlass; + mappings[469] = ItemType.PinkStainedGlassPane; + mappings[409] = ItemType.PinkTerracotta; + mappings[203] = ItemType.PinkTulip; + mappings[185] = ItemType.PinkWool; + mappings[637] = ItemType.Piston; + mappings[1055] = ItemType.PlayerHead; + mappings[17] = ItemType.Podzol; + mappings[1205] = ItemType.PointedDripstone; + mappings[1050] = ItemType.PoisonousPotato; + mappings[1005] = ItemType.PolarBearSpawnEgg; + mappings[7] = ItemType.PolishedAndesite; + mappings[625] = ItemType.PolishedAndesiteSlab; + mappings[608] = ItemType.PolishedAndesiteStairs; + mappings[305] = ItemType.PolishedBasalt; + mappings[1175] = ItemType.PolishedBlackstone; + mappings[1180] = ItemType.PolishedBlackstoneBrickSlab; + mappings[1181] = ItemType.PolishedBlackstoneBrickStairs; + mappings[390] = ItemType.PolishedBlackstoneBrickWall; + mappings[1179] = ItemType.PolishedBlackstoneBricks; + mappings[657] = ItemType.PolishedBlackstoneButton; + mappings[670] = ItemType.PolishedBlackstonePressurePlate; + mappings[1176] = ItemType.PolishedBlackstoneSlab; + mappings[1177] = ItemType.PolishedBlackstoneStairs; + mappings[389] = ItemType.PolishedBlackstoneWall; + mappings[10] = ItemType.PolishedDeepslate; + mappings[628] = ItemType.PolishedDeepslateSlab; + mappings[611] = ItemType.PolishedDeepslateStairs; + mappings[392] = ItemType.PolishedDeepslateWall; + mappings[5] = ItemType.PolishedDiorite; + mappings[617] = ItemType.PolishedDioriteSlab; + mappings[599] = ItemType.PolishedDioriteStairs; + mappings[3] = ItemType.PolishedGranite; + mappings[614] = ItemType.PolishedGraniteSlab; + mappings[596] = ItemType.PolishedGraniteStairs; + mappings[1101] = ItemType.PoppedChorusFruit; + mappings[196] = ItemType.Poppy; + mappings[837] = ItemType.Porkchop; + mappings[1048] = ItemType.Potato; + mappings[953] = ItemType.Potion; + mappings[1224] = ItemType.PotteryShardArcher; + mappings[1226] = ItemType.PotteryShardArmsUp; + mappings[1225] = ItemType.PotteryShardPrize; + mappings[1227] = ItemType.PotteryShardSkull; + mappings[867] = ItemType.PowderSnowBucket; + mappings[719] = ItemType.PoweredRail; + mappings[479] = ItemType.Prismarine; + mappings[255] = ItemType.PrismarineBrickSlab; + mappings[483] = ItemType.PrismarineBrickStairs; + mappings[480] = ItemType.PrismarineBricks; + mappings[1067] = ItemType.PrismarineCrystals; + mappings[1066] = ItemType.PrismarineShard; + mappings[254] = ItemType.PrismarineSlab; + mappings[482] = ItemType.PrismarineStairs; + mappings[376] = ItemType.PrismarineWall; + mappings[894] = ItemType.Pufferfish; + mappings[871] = ItemType.PufferfishBucket; + mappings[1006] = ItemType.PufferfishSpawnEgg; + mappings[298] = ItemType.Pumpkin; + mappings[1061] = ItemType.PumpkinPie; + mappings[941] = ItemType.PumpkinSeeds; + mappings[1093] = ItemType.PurpleBanner; + mappings[930] = ItemType.PurpleBed; + mappings[1195] = ItemType.PurpleCandle; + mappings[432] = ItemType.PurpleCarpet; + mappings[541] = ItemType.PurpleConcrete; + mappings[557] = ItemType.PurpleConcretePowder; + mappings[910] = ItemType.PurpleDye; + mappings[525] = ItemType.PurpleGlazedTerracotta; + mappings[509] = ItemType.PurpleShulkerBox; + mappings[457] = ItemType.PurpleStainedGlass; + mappings[473] = ItemType.PurpleStainedGlassPane; + mappings[413] = ItemType.PurpleTerracotta; + mappings[189] = ItemType.PurpleWool; + mappings[271] = ItemType.PurpurBlock; + mappings[272] = ItemType.PurpurPillar; + mappings[253] = ItemType.PurpurSlab; + mappings[273] = ItemType.PurpurStairs; + mappings[763] = ItemType.Quartz; + mappings[399] = ItemType.QuartzBlock; + mappings[400] = ItemType.QuartzBricks; + mappings[401] = ItemType.QuartzPillar; + mappings[250] = ItemType.QuartzSlab; + mappings[402] = ItemType.QuartzStairs; + mappings[1068] = ItemType.Rabbit; + mappings[1071] = ItemType.RabbitFoot; + mappings[1072] = ItemType.RabbitHide; + mappings[1007] = ItemType.RabbitSpawnEgg; + mappings[1070] = ItemType.RabbitStew; + mappings[721] = ItemType.Rail; + mappings[1008] = ItemType.RavagerSpawnEgg; + mappings[767] = ItemType.RawCopper; + mappings[69] = ItemType.RawCopperBlock; + mappings[769] = ItemType.RawGold; + mappings[70] = ItemType.RawGoldBlock; + mappings[765] = ItemType.RawIron; + mappings[68] = ItemType.RawIronBlock; + mappings[885] = ItemType.RecoveryCompass; + mappings[1097] = ItemType.RedBanner; + mappings[934] = ItemType.RedBed; + mappings[1199] = ItemType.RedCandle; + mappings[436] = ItemType.RedCarpet; + mappings[545] = ItemType.RedConcrete; + mappings[561] = ItemType.RedConcretePowder; + mappings[914] = ItemType.RedDye; + mappings[529] = ItemType.RedGlazedTerracotta; + mappings[211] = ItemType.RedMushroom; + mappings[329] = ItemType.RedMushroomBlock; + mappings[624] = ItemType.RedNetherBrickSlab; + mappings[607] = ItemType.RedNetherBrickStairs; + mappings[384] = ItemType.RedNetherBrickWall; + mappings[495] = ItemType.RedNetherBricks; + mappings[46] = ItemType.RedSand; + mappings[486] = ItemType.RedSandstone; + mappings[251] = ItemType.RedSandstoneSlab; + mappings[489] = ItemType.RedSandstoneStairs; + mappings[377] = ItemType.RedSandstoneWall; + mappings[513] = ItemType.RedShulkerBox; + mappings[461] = ItemType.RedStainedGlass; + mappings[477] = ItemType.RedStainedGlassPane; + mappings[417] = ItemType.RedTerracotta; + mappings[200] = ItemType.RedTulip; + mappings[193] = ItemType.RedWool; + mappings[632] = ItemType.Redstone; + mappings[634] = ItemType.RedstoneBlock; + mappings[654] = ItemType.RedstoneLamp; + mappings[56] = ItemType.RedstoneOre; + mappings[633] = ItemType.RedstoneTorch; + mappings[327] = ItemType.ReinforcedDeepslate; + mappings[635] = ItemType.Repeater; + mappings[490] = ItemType.RepeatingCommandBlock; + mappings[1183] = ItemType.RespawnAnchor; + mappings[1222] = ItemType.RibArmorTrimSmithingTemplate; + mappings[18] = ItemType.RootedDirt; + mappings[443] = ItemType.RoseBush; + mappings[947] = ItemType.RottenFlesh; + mappings[723] = ItemType.Saddle; + mappings[892] = ItemType.Salmon; + mappings[872] = ItemType.SalmonBucket; + mappings[1009] = ItemType.SalmonSpawnEgg; + mappings[44] = ItemType.Sand; + mappings[168] = ItemType.Sandstone; + mappings[242] = ItemType.SandstoneSlab; + mappings[356] = ItemType.SandstoneStairs; + mappings[385] = ItemType.SandstoneWall; + mappings[631] = ItemType.Scaffolding; + mappings[347] = ItemType.Sculk; + mappings[349] = ItemType.SculkCatalyst; + mappings[650] = ItemType.SculkSensor; + mappings[350] = ItemType.SculkShrieker; + mappings[348] = ItemType.SculkVein; + mappings[753] = ItemType.Scute; + mappings[485] = ItemType.SeaLantern; + mappings[178] = ItemType.SeaPickle; + mappings[177] = ItemType.Seagrass; + mappings[1213] = ItemType.SentryArmorTrimSmithingTemplate; + mappings[938] = ItemType.Shears; + mappings[1010] = ItemType.SheepSpawnEgg; + mappings[1111] = ItemType.Shield; + mappings[1163] = ItemType.Shroomlight; + mappings[498] = ItemType.ShulkerBox; + mappings[1113] = ItemType.ShulkerShell; + mappings[1011] = ItemType.ShulkerSpawnEgg; + mappings[1012] = ItemType.SilverfishSpawnEgg; + mappings[1014] = ItemType.SkeletonHorseSpawnEgg; + mappings[1053] = ItemType.SkeletonSkull; + mappings[1013] = ItemType.SkeletonSpawnEgg; + mappings[1142] = ItemType.SkullBannerPattern; + mappings[882] = ItemType.SlimeBall; + mappings[639] = ItemType.SlimeBlock; + mappings[1015] = ItemType.SlimeSpawnEgg; + mappings[1201] = ItemType.SmallAmethystBud; + mappings[226] = ItemType.SmallDripleaf; + mappings[1154] = ItemType.SmithingTable; + mappings[1149] = ItemType.Smoker; + mappings[306] = ItemType.SmoothBasalt; + mappings[257] = ItemType.SmoothQuartz; + mappings[621] = ItemType.SmoothQuartzSlab; + mappings[604] = ItemType.SmoothQuartzStairs; + mappings[258] = ItemType.SmoothRedSandstone; + mappings[615] = ItemType.SmoothRedSandstoneSlab; + mappings[597] = ItemType.SmoothRedSandstoneStairs; + mappings[259] = ItemType.SmoothSandstone; + mappings[620] = ItemType.SmoothSandstoneSlab; + mappings[603] = ItemType.SmoothSandstoneStairs; + mappings[260] = ItemType.SmoothStone; + mappings[241] = ItemType.SmoothStoneSlab; + mappings[1016] = ItemType.SnifferSpawnEgg; + mappings[1221] = ItemType.SnoutArmorTrimSmithingTemplate; + mappings[281] = ItemType.Snow; + mappings[283] = ItemType.SnowBlock; + mappings[1017] = ItemType.SnowGolemSpawnEgg; + mappings[868] = ItemType.Snowball; + mappings[1162] = ItemType.SoulCampfire; + mappings[1158] = ItemType.SoulLantern; + mappings[302] = ItemType.SoulSand; + mappings[303] = ItemType.SoulSoil; + mappings[307] = ItemType.SoulTorch; + mappings[274] = ItemType.Spawner; + mappings[1108] = ItemType.SpectralArrow; + mappings[955] = ItemType.SpiderEye; + mappings[1018] = ItemType.SpiderSpawnEgg; + mappings[1223] = ItemType.SpireArmorTrimSmithingTemplate; + mappings[1107] = ItemType.SplashPotion; + mappings[163] = ItemType.Sponge; + mappings[209] = ItemType.SporeBlossom; + mappings[734] = ItemType.SpruceBoat; + mappings[659] = ItemType.SpruceButton; + mappings[735] = ItemType.SpruceChestBoat; + mappings[686] = ItemType.SpruceDoor; + mappings[288] = ItemType.SpruceFence; + mappings[709] = ItemType.SpruceFenceGate; + mappings[854] = ItemType.SpruceHangingSign; + mappings[154] = ItemType.SpruceLeaves; + mappings[110] = ItemType.SpruceLog; + mappings[24] = ItemType.SprucePlanks; + mappings[674] = ItemType.SprucePressurePlate; + mappings[36] = ItemType.SpruceSapling; + mappings[843] = ItemType.SpruceSign; + mappings[229] = ItemType.SpruceSlab; + mappings[360] = ItemType.SpruceStairs; + mappings[698] = ItemType.SpruceTrapdoor; + mappings[144] = ItemType.SpruceWood; + mappings[889] = ItemType.Spyglass; + mappings[1019] = ItemType.SquidSpawnEgg; + mappings[803] = ItemType.Stick; + mappings[638] = ItemType.StickyPiston; + mappings[1] = ItemType.Stone; + mappings[781] = ItemType.StoneAxe; + mappings[247] = ItemType.StoneBrickSlab; + mappings[338] = ItemType.StoneBrickStairs; + mappings[380] = ItemType.StoneBrickWall; + mappings[316] = ItemType.StoneBricks; + mappings[656] = ItemType.StoneButton; + mappings[782] = ItemType.StoneHoe; + mappings[780] = ItemType.StonePickaxe; + mappings[669] = ItemType.StonePressurePlate; + mappings[779] = ItemType.StoneShovel; + mappings[240] = ItemType.StoneSlab; + mappings[602] = ItemType.StoneStairs; + mappings[778] = ItemType.StoneSword; + mappings[1155] = ItemType.Stonecutter; + mappings[1020] = ItemType.StraySpawnEgg; + mappings[1021] = ItemType.StriderSpawnEgg; + mappings[806] = ItemType.String; + mappings[126] = ItemType.StrippedAcaciaLog; + mappings[136] = ItemType.StrippedAcaciaWood; + mappings[142] = ItemType.StrippedBambooBlock; + mappings[124] = ItemType.StrippedBirchLog; + mappings[134] = ItemType.StrippedBirchWood; + mappings[127] = ItemType.StrippedCherryLog; + mappings[137] = ItemType.StrippedCherryWood; + mappings[140] = ItemType.StrippedCrimsonHyphae; + mappings[130] = ItemType.StrippedCrimsonStem; + mappings[128] = ItemType.StrippedDarkOakLog; + mappings[138] = ItemType.StrippedDarkOakWood; + mappings[125] = ItemType.StrippedJungleLog; + mappings[135] = ItemType.StrippedJungleWood; + mappings[129] = ItemType.StrippedMangroveLog; + mappings[139] = ItemType.StrippedMangroveWood; + mappings[122] = ItemType.StrippedOakLog; + mappings[132] = ItemType.StrippedOakWood; + mappings[123] = ItemType.StrippedSpruceLog; + mappings[133] = ItemType.StrippedSpruceWood; + mappings[141] = ItemType.StrippedWarpedHyphae; + mappings[131] = ItemType.StrippedWarpedStem; + mappings[750] = ItemType.StructureBlock; + mappings[497] = ItemType.StructureVoid; + mappings[918] = ItemType.Sugar; + mappings[219] = ItemType.SugarCane; + mappings[441] = ItemType.Sunflower; + mappings[45] = ItemType.SuspiciousSand; + mappings[1138] = ItemType.SuspiciousStew; + mappings[1159] = ItemType.SweetBerries; + mappings[876] = ItemType.TadpoleBucket; + mappings[1022] = ItemType.TadpoleSpawnEgg; + mappings[445] = ItemType.TallGrass; + mappings[646] = ItemType.Target; + mappings[438] = ItemType.Terracotta; + mappings[1220] = ItemType.TideArmorTrimSmithingTemplate; + mappings[166] = ItemType.TintedGlass; + mappings[1109] = ItemType.TippedArrow; + mappings[653] = ItemType.Tnt; + mappings[727] = ItemType.TntMinecart; + mappings[267] = ItemType.Torch; + mappings[208] = ItemType.Torchflower; + mappings[1102] = ItemType.TorchflowerSeeds; + mappings[1112] = ItemType.TotemOfUndying; + mappings[1023] = ItemType.TraderLlamaSpawnEgg; + mappings[652] = ItemType.TrappedChest; + mappings[1133] = ItemType.Trident; + mappings[651] = ItemType.TripwireHook; + mappings[893] = ItemType.TropicalFish; + mappings[874] = ItemType.TropicalFishBucket; + mappings[1024] = ItemType.TropicalFishSpawnEgg; + mappings[574] = ItemType.TubeCoral; + mappings[569] = ItemType.TubeCoralBlock; + mappings[584] = ItemType.TubeCoralFan; + mappings[12] = ItemType.Tuff; + mappings[563] = ItemType.TurtleEgg; + mappings[752] = ItemType.TurtleHelmet; + mappings[1025] = ItemType.TurtleSpawnEgg; + mappings[218] = ItemType.TwistingVines; + mappings[1207] = ItemType.VerdantFroglight; + mappings[1219] = ItemType.VexArmorTrimSmithingTemplate; + mappings[1026] = ItemType.VexSpawnEgg; + mappings[1027] = ItemType.VillagerSpawnEgg; + mappings[1028] = ItemType.VindicatorSpawnEgg; + mappings[335] = ItemType.Vine; + mappings[1029] = ItemType.WanderingTraderSpawnEgg; + mappings[1217] = ItemType.WardArmorTrimSmithingTemplate; + mappings[1030] = ItemType.WardenSpawnEgg; + mappings[668] = ItemType.WarpedButton; + mappings[695] = ItemType.WarpedDoor; + mappings[297] = ItemType.WarpedFence; + mappings[718] = ItemType.WarpedFenceGate; + mappings[213] = ItemType.WarpedFungus; + mappings[730] = ItemType.WarpedFungusOnAStick; + mappings[863] = ItemType.WarpedHangingSign; + mappings[152] = ItemType.WarpedHyphae; + mappings[21] = ItemType.WarpedNylium; + mappings[33] = ItemType.WarpedPlanks; + mappings[683] = ItemType.WarpedPressurePlate; + mappings[215] = ItemType.WarpedRoots; + mappings[852] = ItemType.WarpedSign; + mappings[239] = ItemType.WarpedSlab; + mappings[370] = ItemType.WarpedStairs; + mappings[120] = ItemType.WarpedStem; + mappings[707] = ItemType.WarpedTrapdoor; + mappings[494] = ItemType.WarpedWartBlock; + mappings[865] = ItemType.WaterBucket; + mappings[93] = ItemType.WaxedCopperBlock; + mappings[97] = ItemType.WaxedCutCopper; + mappings[105] = ItemType.WaxedCutCopperSlab; + mappings[101] = ItemType.WaxedCutCopperStairs; + mappings[94] = ItemType.WaxedExposedCopper; + mappings[98] = ItemType.WaxedExposedCutCopper; + mappings[106] = ItemType.WaxedExposedCutCopperSlab; + mappings[102] = ItemType.WaxedExposedCutCopperStairs; + mappings[96] = ItemType.WaxedOxidizedCopper; + mappings[100] = ItemType.WaxedOxidizedCutCopper; + mappings[108] = ItemType.WaxedOxidizedCutCopperSlab; + mappings[104] = ItemType.WaxedOxidizedCutCopperStairs; + mappings[95] = ItemType.WaxedWeatheredCopper; + mappings[99] = ItemType.WaxedWeatheredCutCopper; + mappings[107] = ItemType.WaxedWeatheredCutCopperSlab; + mappings[103] = ItemType.WaxedWeatheredCutCopperStairs; + mappings[79] = ItemType.WeatheredCopper; + mappings[83] = ItemType.WeatheredCutCopper; + mappings[91] = ItemType.WeatheredCutCopperSlab; + mappings[87] = ItemType.WeatheredCutCopperStairs; + mappings[217] = ItemType.WeepingVines; + mappings[164] = ItemType.WetSponge; + mappings[810] = ItemType.Wheat; + mappings[809] = ItemType.WheatSeeds; + mappings[1083] = ItemType.WhiteBanner; + mappings[920] = ItemType.WhiteBed; + mappings[1185] = ItemType.WhiteCandle; + mappings[422] = ItemType.WhiteCarpet; + mappings[531] = ItemType.WhiteConcrete; + mappings[547] = ItemType.WhiteConcretePowder; + mappings[900] = ItemType.WhiteDye; + mappings[515] = ItemType.WhiteGlazedTerracotta; + mappings[499] = ItemType.WhiteShulkerBox; + mappings[447] = ItemType.WhiteStainedGlass; + mappings[463] = ItemType.WhiteStainedGlassPane; + mappings[403] = ItemType.WhiteTerracotta; + mappings[202] = ItemType.WhiteTulip; + mappings[179] = ItemType.WhiteWool; + mappings[1216] = ItemType.WildArmorTrimSmithingTemplate; + mappings[1031] = ItemType.WitchSpawnEgg; + mappings[207] = ItemType.WitherRose; + mappings[1054] = ItemType.WitherSkeletonSkull; + mappings[1033] = ItemType.WitherSkeletonSpawnEgg; + mappings[1032] = ItemType.WitherSpawnEgg; + mappings[1034] = ItemType.WolfSpawnEgg; + mappings[776] = ItemType.WoodenAxe; + mappings[777] = ItemType.WoodenHoe; + mappings[775] = ItemType.WoodenPickaxe; + mappings[774] = ItemType.WoodenShovel; + mappings[773] = ItemType.WoodenSword; + mappings[1042] = ItemType.WritableBook; + mappings[1043] = ItemType.WrittenBook; + mappings[1087] = ItemType.YellowBanner; + mappings[924] = ItemType.YellowBed; + mappings[1189] = ItemType.YellowCandle; + mappings[426] = ItemType.YellowCarpet; + mappings[535] = ItemType.YellowConcrete; + mappings[551] = ItemType.YellowConcretePowder; + mappings[904] = ItemType.YellowDye; + mappings[519] = ItemType.YellowGlazedTerracotta; + mappings[503] = ItemType.YellowShulkerBox; + mappings[451] = ItemType.YellowStainedGlass; + mappings[467] = ItemType.YellowStainedGlassPane; + mappings[407] = ItemType.YellowTerracotta; + mappings[183] = ItemType.YellowWool; + mappings[1035] = ItemType.ZoglinSpawnEgg; + mappings[1056] = ItemType.ZombieHead; + mappings[1037] = ItemType.ZombieHorseSpawnEgg; + mappings[1036] = ItemType.ZombieSpawnEgg; + mappings[1038] = ItemType.ZombieVillagerSpawnEgg; + mappings[1039] = ItemType.ZombifiedPiglinSpawnEgg; + } + + protected override Dictionary GetDict() + { + return mappings; + } + } +} diff --git a/MinecraftClient/Inventory/ItemType.cs b/MinecraftClient/Inventory/ItemType.cs index 11807ab7..da92dec5 100644 --- a/MinecraftClient/Inventory/ItemType.cs +++ b/MinecraftClient/Inventory/ItemType.cs @@ -171,6 +171,7 @@ BrownStainedGlassPane, BrownTerracotta, BrownWool, + Brush, BubbleCoral, BubbleCoralBlock, BubbleCoralFan, @@ -197,6 +198,23 @@ ChainmailHelmet, ChainmailLeggings, Charcoal, + CherryBoat, + CherryButton, + CherryChestBoat, + CherryDoor, + CherryFence, + CherryFenceGate, + CherryHangingSign, + CherryLeaves, + CherryLog, + CherryPlanks, + CherryPressurePlate, + CherrySapling, + CherrySign, + CherrySlab, + CherryStairs, + CherryTrapdoor, + CherryWood, Chest, ChestMinecart, Chicken, @@ -220,6 +238,7 @@ CoalBlock, CoalOre, CoarseDirt, + CoastArmorTrimSmithingTemplate, CobbledDeepslate, CobbledDeepslateSlab, CobbledDeepslateStairs, @@ -339,6 +358,7 @@ DeadTubeCoralBlock, DeadTubeCoralFan, DebugStick, + DecoratedPot, Deepslate, DeepslateBrickSlab, DeepslateBrickStairs, @@ -388,6 +408,7 @@ DripstoneBlock, Dropper, DrownedSpawnEgg, + DuneArmorTrimSmithingTemplate, EchoShard, Egg, ElderGuardianSpawnEgg, @@ -418,6 +439,7 @@ ExposedCutCopper, ExposedCutCopperSlab, ExposedCutCopperStairs, + EyeArmorTrimSmithingTemplate, Farmland, Feather, FermentedSpiderEye, @@ -748,6 +770,7 @@ NetheriteScrap, NetheriteShovel, NetheriteSword, + NetheriteUpgradeSmithingTemplate, Netherrack, NoteBlock, OakBoat, @@ -815,6 +838,7 @@ PinkConcretePowder, PinkDye, PinkGlazedTerracotta, + PinkPetals, PinkShulkerBox, PinkStainedGlass, PinkStainedGlassPane, @@ -856,6 +880,10 @@ Porkchop, Potato, Potion, + PotteryShardArcher, + PotteryShardArmsUp, + PotteryShardPrize, + PotteryShardSkull, PowderSnowBucket, PoweredRail, Prismarine, @@ -944,6 +972,7 @@ Repeater, RepeatingCommandBlock, RespawnAnchor, + RibArmorTrimSmithingTemplate, RootedDirt, RoseBush, RottenFlesh, @@ -966,6 +995,7 @@ SeaLantern, SeaPickle, Seagrass, + SentryArmorTrimSmithingTemplate, Shears, SheepSpawnEgg, Shield, @@ -997,6 +1027,8 @@ SmoothSandstoneStairs, SmoothStone, SmoothStoneSlab, + SnifferSpawnEgg, + SnoutArmorTrimSmithingTemplate, Snow, SnowBlock, SnowGolemSpawnEgg, @@ -1010,6 +1042,7 @@ SpectralArrow, SpiderEye, SpiderSpawnEgg, + SpireArmorTrimSmithingTemplate, SplashPotion, Sponge, SporeBlossom, @@ -1057,6 +1090,8 @@ StrippedBambooBlock, StrippedBirchLog, StrippedBirchWood, + StrippedCherryLog, + StrippedCherryWood, StrippedCrimsonHyphae, StrippedCrimsonStem, StrippedDarkOakLog, @@ -1076,6 +1111,7 @@ Sugar, SugarCane, Sunflower, + SuspiciousSand, SuspiciousStew, SweetBerries, TadpoleBucket, @@ -1083,11 +1119,14 @@ TallGrass, Target, Terracotta, + TideArmorTrimSmithingTemplate, TintedGlass, TippedArrow, Tnt, TntMinecart, Torch, + Torchflower, + TorchflowerSeeds, TotemOfUndying, TraderLlamaSpawnEgg, TrappedChest, @@ -1105,11 +1144,13 @@ TurtleSpawnEgg, TwistingVines, VerdantFroglight, + VexArmorTrimSmithingTemplate, VexSpawnEgg, VillagerSpawnEgg, VindicatorSpawnEgg, Vine, WanderingTraderSpawnEgg, + WardArmorTrimSmithingTemplate, WardenSpawnEgg, WarpedButton, WarpedDoor, @@ -1168,6 +1209,7 @@ WhiteTerracotta, WhiteTulip, WhiteWool, + WildArmorTrimSmithingTemplate, WitchSpawnEgg, WitherRose, WitherSkeletonSkull, diff --git a/MinecraftClient/Mapping/BlockPalettes/Palette1194.cs b/MinecraftClient/Mapping/BlockPalettes/Palette1194.cs new file mode 100644 index 00000000..83c7ff29 --- /dev/null +++ b/MinecraftClient/Mapping/BlockPalettes/Palette1194.cs @@ -0,0 +1,1653 @@ +using System.Collections.Generic; + +namespace MinecraftClient.Mapping.BlockPalettes +{ + public class Palette1194 : BlockPalette + { + private static readonly Dictionary materials = new(); + + static Palette1194() + { + for (int i = 8703; i <= 8726; i++) + materials[i] = Material.AcaciaButton; + for (int i = 11869; i <= 11932; i++) + materials[i] = Material.AcaciaDoor; + for (int i = 11517; i <= 11548; i++) + materials[i] = Material.AcaciaFence; + for (int i = 11261; i <= 11292; i++) + materials[i] = Material.AcaciaFenceGate; + for (int i = 5022; i <= 5085; i++) + materials[i] = Material.AcaciaHangingSign; + for (int i = 345; i <= 372; i++) + materials[i] = Material.AcaciaLeaves; + for (int i = 138; i <= 140; i++) + materials[i] = Material.AcaciaLog; + materials[19] = Material.AcaciaPlanks; + for (int i = 5720; i <= 5721; i++) + materials[i] = Material.AcaciaPressurePlate; + for (int i = 33; i <= 34; i++) + materials[i] = Material.AcaciaSapling; + for (int i = 4394; i <= 4425; i++) + materials[i] = Material.AcaciaSign; + for (int i = 11041; i <= 11046; i++) + materials[i] = Material.AcaciaSlab; + for (int i = 9740; i <= 9819; i++) + materials[i] = Material.AcaciaStairs; + for (int i = 6214; i <= 6277; i++) + materials[i] = Material.AcaciaTrapdoor; + for (int i = 5558; i <= 5565; i++) + materials[i] = Material.AcaciaWallHangingSign; + for (int i = 4782; i <= 4789; i++) + materials[i] = Material.AcaciaWallSign; + for (int i = 197; i <= 199; i++) + materials[i] = Material.AcaciaWood; + for (int i = 9176; i <= 9199; i++) + materials[i] = Material.ActivatorRail; + materials[0] = Material.Air; + materials[2075] = Material.Allium; + materials[20872] = Material.AmethystBlock; + for (int i = 20874; i <= 20885; i++) + materials[i] = Material.AmethystCluster; + materials[19289] = Material.AncientDebris; + materials[6] = Material.Andesite; + for (int i = 13977; i <= 13982; i++) + materials[i] = Material.AndesiteSlab; + for (int i = 13603; i <= 13682; i++) + materials[i] = Material.AndesiteStairs; + for (int i = 16593; i <= 16916; i++) + materials[i] = Material.AndesiteWall; + for (int i = 8963; i <= 8966; i++) + materials[i] = Material.Anvil; + for (int i = 6813; i <= 6816; i++) + materials[i] = Material.AttachedMelonStem; + for (int i = 6809; i <= 6812; i++) + materials[i] = Material.AttachedPumpkinStem; + materials[21967] = Material.Azalea; + for (int i = 457; i <= 484; i++) + materials[i] = Material.AzaleaLeaves; + materials[2076] = Material.AzureBluet; + for (int i = 12786; i <= 12797; i++) + materials[i] = Material.Bamboo; + for (int i = 155; i <= 157; i++) + materials[i] = Material.BambooBlock; + for (int i = 8799; i <= 8822; i++) + materials[i] = Material.BambooButton; + for (int i = 12125; i <= 12188; i++) + materials[i] = Material.BambooDoor; + for (int i = 11645; i <= 11676; i++) + materials[i] = Material.BambooFence; + for (int i = 11389; i <= 11420; i++) + materials[i] = Material.BambooFenceGate; + for (int i = 5470; i <= 5533; i++) + materials[i] = Material.BambooHangingSign; + materials[24] = Material.BambooMosaic; + for (int i = 11071; i <= 11076; i++) + materials[i] = Material.BambooMosaicSlab; + for (int i = 10140; i <= 10219; i++) + materials[i] = Material.BambooMosaicStairs; + materials[23] = Material.BambooPlanks; + for (int i = 5728; i <= 5729; i++) + materials[i] = Material.BambooPressurePlate; + materials[12785] = Material.BambooSapling; + for (int i = 4554; i <= 4585; i++) + materials[i] = Material.BambooSign; + for (int i = 11065; i <= 11070; i++) + materials[i] = Material.BambooSlab; + for (int i = 10060; i <= 10139; i++) + materials[i] = Material.BambooStairs; + for (int i = 6470; i <= 6533; i++) + materials[i] = Material.BambooTrapdoor; + for (int i = 5614; i <= 5621; i++) + materials[i] = Material.BambooWallHangingSign; + for (int i = 4822; i <= 4829; i++) + materials[i] = Material.BambooWallSign; + for (int i = 18249; i <= 18260; i++) + materials[i] = Material.Barrel; + materials[10221] = Material.Barrier; + for (int i = 5849; i <= 5851; i++) + materials[i] = Material.Basalt; + materials[7914] = Material.Beacon; + materials[79] = Material.Bedrock; + for (int i = 19238; i <= 19261; i++) + materials[i] = Material.BeeNest; + for (int i = 19262; i <= 19285; i++) + materials[i] = Material.Beehive; + for (int i = 12353; i <= 12356; i++) + materials[i] = Material.Beetroots; + for (int i = 18312; i <= 18343; i++) + materials[i] = Material.Bell; + for (int i = 21987; i <= 22018; i++) + materials[i] = Material.BigDripleaf; + for (int i = 22019; i <= 22026; i++) + materials[i] = Material.BigDripleafStem; + for (int i = 8655; i <= 8678; i++) + materials[i] = Material.BirchButton; + for (int i = 11741; i <= 11804; i++) + materials[i] = Material.BirchDoor; + for (int i = 11453; i <= 11484; i++) + materials[i] = Material.BirchFence; + for (int i = 11197; i <= 11228; i++) + materials[i] = Material.BirchFenceGate; + for (int i = 4958; i <= 5021; i++) + materials[i] = Material.BirchHangingSign; + for (int i = 289; i <= 316; i++) + materials[i] = Material.BirchLeaves; + for (int i = 132; i <= 134; i++) + materials[i] = Material.BirchLog; + materials[17] = Material.BirchPlanks; + for (int i = 5716; i <= 5717; i++) + materials[i] = Material.BirchPressurePlate; + for (int i = 29; i <= 30; i++) + materials[i] = Material.BirchSapling; + for (int i = 4362; i <= 4393; i++) + materials[i] = Material.BirchSign; + for (int i = 11029; i <= 11034; i++) + materials[i] = Material.BirchSlab; + for (int i = 7742; i <= 7821; i++) + materials[i] = Material.BirchStairs; + for (int i = 6086; i <= 6149; i++) + materials[i] = Material.BirchTrapdoor; + for (int i = 5550; i <= 5557; i++) + materials[i] = Material.BirchWallHangingSign; + for (int i = 4774; i <= 4781; i++) + materials[i] = Material.BirchWallSign; + for (int i = 191; i <= 193; i++) + materials[i] = Material.BirchWood; + for (int i = 10854; i <= 10869; i++) + materials[i] = Material.BlackBanner; + for (int i = 1924; i <= 1939; i++) + materials[i] = Material.BlackBed; + for (int i = 20822; i <= 20837; i++) + materials[i] = Material.BlackCandle; + for (int i = 20870; i <= 20871; i++) + materials[i] = Material.BlackCandleCake; + materials[10598] = Material.BlackCarpet; + materials[12587] = Material.BlackConcrete; + materials[12603] = Material.BlackConcretePowder; + for (int i = 12568; i <= 12571; i++) + materials[i] = Material.BlackGlazedTerracotta; + for (int i = 12502; i <= 12507; i++) + materials[i] = Material.BlackShulkerBox; + materials[5957] = Material.BlackStainedGlass; + for (int i = 9708; i <= 9739; i++) + materials[i] = Material.BlackStainedGlassPane; + materials[9227] = Material.BlackTerracotta; + for (int i = 10930; i <= 10933; i++) + materials[i] = Material.BlackWallBanner; + materials[2058] = Material.BlackWool; + materials[19301] = Material.Blackstone; + for (int i = 19706; i <= 19711; i++) + materials[i] = Material.BlackstoneSlab; + for (int i = 19302; i <= 19381; i++) + materials[i] = Material.BlackstoneStairs; + for (int i = 19382; i <= 19705; i++) + materials[i] = Material.BlackstoneWall; + for (int i = 18269; i <= 18276; i++) + materials[i] = Material.BlastFurnace; + for (int i = 10790; i <= 10805; i++) + materials[i] = Material.BlueBanner; + for (int i = 1860; i <= 1875; i++) + materials[i] = Material.BlueBed; + for (int i = 20758; i <= 20773; i++) + materials[i] = Material.BlueCandle; + for (int i = 20862; i <= 20863; i++) + materials[i] = Material.BlueCandleCake; + materials[10594] = Material.BlueCarpet; + materials[12583] = Material.BlueConcrete; + materials[12599] = Material.BlueConcretePowder; + for (int i = 12552; i <= 12555; i++) + materials[i] = Material.BlueGlazedTerracotta; + materials[12782] = Material.BlueIce; + materials[2074] = Material.BlueOrchid; + for (int i = 12478; i <= 12483; i++) + materials[i] = Material.BlueShulkerBox; + materials[5953] = Material.BlueStainedGlass; + for (int i = 9580; i <= 9611; i++) + materials[i] = Material.BlueStainedGlassPane; + materials[9223] = Material.BlueTerracotta; + for (int i = 10914; i <= 10917; i++) + materials[i] = Material.BlueWallBanner; + materials[2054] = Material.BlueWool; + for (int i = 12390; i <= 12392; i++) + materials[i] = Material.BoneBlock; + materials[2092] = Material.Bookshelf; + for (int i = 12666; i <= 12667; i++) + materials[i] = Material.BrainCoral; + materials[12650] = Material.BrainCoralBlock; + for (int i = 12686; i <= 12687; i++) + materials[i] = Material.BrainCoralFan; + for (int i = 12742; i <= 12749; i++) + materials[i] = Material.BrainCoralWallFan; + for (int i = 7386; i <= 7393; i++) + materials[i] = Material.BrewingStand; + for (int i = 11113; i <= 11118; i++) + materials[i] = Material.BrickSlab; + for (int i = 7025; i <= 7104; i++) + materials[i] = Material.BrickStairs; + for (int i = 14001; i <= 14324; i++) + materials[i] = Material.BrickWall; + materials[2089] = Material.Bricks; + for (int i = 10806; i <= 10821; i++) + materials[i] = Material.BrownBanner; + for (int i = 1876; i <= 1891; i++) + materials[i] = Material.BrownBed; + for (int i = 20774; i <= 20789; i++) + materials[i] = Material.BrownCandle; + for (int i = 20864; i <= 20865; i++) + materials[i] = Material.BrownCandleCake; + materials[10595] = Material.BrownCarpet; + materials[12584] = Material.BrownConcrete; + materials[12600] = Material.BrownConcretePowder; + for (int i = 12556; i <= 12559; i++) + materials[i] = Material.BrownGlazedTerracotta; + materials[2085] = Material.BrownMushroom; + for (int i = 6546; i <= 6609; i++) + materials[i] = Material.BrownMushroomBlock; + for (int i = 12484; i <= 12489; i++) + materials[i] = Material.BrownShulkerBox; + materials[5954] = Material.BrownStainedGlass; + for (int i = 9612; i <= 9643; i++) + materials[i] = Material.BrownStainedGlassPane; + materials[9224] = Material.BrownTerracotta; + for (int i = 10918; i <= 10921; i++) + materials[i] = Material.BrownWallBanner; + materials[2055] = Material.BrownWool; + for (int i = 12801; i <= 12802; i++) + materials[i] = Material.BubbleColumn; + for (int i = 12668; i <= 12669; i++) + materials[i] = Material.BubbleCoral; + materials[12651] = Material.BubbleCoralBlock; + for (int i = 12688; i <= 12689; i++) + materials[i] = Material.BubbleCoralFan; + for (int i = 12750; i <= 12757; i++) + materials[i] = Material.BubbleCoralWallFan; + materials[20873] = Material.BuddingAmethyst; + for (int i = 5778; i <= 5793; i++) + materials[i] = Material.Cactus; + for (int i = 5871; i <= 5877; i++) + materials[i] = Material.Cake; + materials[20923] = Material.Calcite; + for (int i = 18352; i <= 18383; i++) + materials[i] = Material.Campfire; + for (int i = 20566; i <= 20581; i++) + materials[i] = Material.Candle; + for (int i = 20838; i <= 20839; i++) + materials[i] = Material.CandleCake; + for (int i = 8591; i <= 8598; i++) + materials[i] = Material.Carrots; + materials[18277] = Material.CartographyTable; + for (int i = 5863; i <= 5866; i++) + materials[i] = Material.CarvedPumpkin; + materials[7394] = Material.Cauldron; + materials[12800] = Material.CaveAir; + for (int i = 21912; i <= 21963; i++) + materials[i] = Material.CaveVines; + for (int i = 21964; i <= 21965; i++) + materials[i] = Material.CaveVinesPlant; + for (int i = 6770; i <= 6775; i++) + materials[i] = Material.Chain; + for (int i = 12371; i <= 12382; i++) + materials[i] = Material.ChainCommandBlock; + for (int i = 8727; i <= 8750; i++) + materials[i] = Material.CherryButton; + for (int i = 11933; i <= 11996; i++) + materials[i] = Material.CherryDoor; + for (int i = 11549; i <= 11580; i++) + materials[i] = Material.CherryFence; + for (int i = 11293; i <= 11324; i++) + materials[i] = Material.CherryFenceGate; + for (int i = 5086; i <= 5149; i++) + materials[i] = Material.CherryHangingSign; + for (int i = 373; i <= 400; i++) + materials[i] = Material.CherryLeaves; + for (int i = 141; i <= 143; i++) + materials[i] = Material.CherryLog; + materials[20] = Material.CherryPlanks; + for (int i = 5722; i <= 5723; i++) + materials[i] = Material.CherryPressurePlate; + for (int i = 35; i <= 36; i++) + materials[i] = Material.CherrySapling; + for (int i = 4426; i <= 4457; i++) + materials[i] = Material.CherrySign; + for (int i = 11047; i <= 11052; i++) + materials[i] = Material.CherrySlab; + for (int i = 9820; i <= 9899; i++) + materials[i] = Material.CherryStairs; + for (int i = 6278; i <= 6341; i++) + materials[i] = Material.CherryTrapdoor; + for (int i = 5566; i <= 5573; i++) + materials[i] = Material.CherryWallHangingSign; + for (int i = 4790; i <= 4797; i++) + materials[i] = Material.CherryWallSign; + for (int i = 200; i <= 202; i++) + materials[i] = Material.CherryWood; + for (int i = 2950; i <= 2973; i++) + materials[i] = Material.Chest; + for (int i = 8967; i <= 8970; i++) + materials[i] = Material.ChippedAnvil; + for (int i = 2093; i <= 2348; i++) + materials[i] = Material.ChiseledBookshelf; + materials[23694] = Material.ChiseledDeepslate; + materials[20563] = Material.ChiseledNetherBricks; + materials[19715] = Material.ChiseledPolishedBlackstone; + materials[9092] = Material.ChiseledQuartzBlock; + materials[10935] = Material.ChiseledRedSandstone; + materials[532] = Material.ChiseledSandstone; + materials[6537] = Material.ChiseledStoneBricks; + for (int i = 12259; i <= 12264; i++) + materials[i] = Material.ChorusFlower; + for (int i = 12195; i <= 12258; i++) + materials[i] = Material.ChorusPlant; + materials[5794] = Material.Clay; + materials[10600] = Material.CoalBlock; + materials[123] = Material.CoalOre; + materials[11] = Material.CoarseDirt; + materials[22050] = Material.CobbledDeepslate; + for (int i = 22131; i <= 22136; i++) + materials[i] = Material.CobbledDeepslateSlab; + for (int i = 22051; i <= 22130; i++) + materials[i] = Material.CobbledDeepslateStairs; + for (int i = 22137; i <= 22460; i++) + materials[i] = Material.CobbledDeepslateWall; + materials[14] = Material.Cobblestone; + for (int i = 11107; i <= 11112; i++) + materials[i] = Material.CobblestoneSlab; + for (int i = 4678; i <= 4757; i++) + materials[i] = Material.CobblestoneStairs; + for (int i = 7915; i <= 8238; i++) + materials[i] = Material.CobblestoneWall; + materials[2000] = Material.Cobweb; + for (int i = 7415; i <= 7426; i++) + materials[i] = Material.Cocoa; + for (int i = 7902; i <= 7913; i++) + materials[i] = Material.CommandBlock; + for (int i = 9031; i <= 9046; i++) + materials[i] = Material.Comparator; + for (int i = 19213; i <= 19221; i++) + materials[i] = Material.Composter; + for (int i = 12783; i <= 12784; i++) + materials[i] = Material.Conduit; + materials[21164] = Material.CopperBlock; + materials[21165] = Material.CopperOre; + materials[2082] = Material.Cornflower; + materials[23695] = Material.CrackedDeepslateBricks; + materials[23696] = Material.CrackedDeepslateTiles; + materials[20564] = Material.CrackedNetherBricks; + materials[19714] = Material.CrackedPolishedBlackstoneBricks; + materials[6536] = Material.CrackedStoneBricks; + materials[4273] = Material.CraftingTable; + for (int i = 8903; i <= 8918; i++) + materials[i] = Material.CreeperHead; + for (int i = 8919; i <= 8922; i++) + materials[i] = Material.CreeperWallHead; + for (int i = 18941; i <= 18964; i++) + materials[i] = Material.CrimsonButton; + for (int i = 18989; i <= 19052; i++) + materials[i] = Material.CrimsonDoor; + for (int i = 18525; i <= 18556; i++) + materials[i] = Material.CrimsonFence; + for (int i = 18717; i <= 18748; i++) + materials[i] = Material.CrimsonFenceGate; + materials[18450] = Material.CrimsonFungus; + for (int i = 5278; i <= 5341; i++) + materials[i] = Material.CrimsonHangingSign; + for (int i = 18443; i <= 18445; i++) + materials[i] = Material.CrimsonHyphae; + materials[18449] = Material.CrimsonNylium; + materials[18507] = Material.CrimsonPlanks; + for (int i = 18521; i <= 18522; i++) + materials[i] = Material.CrimsonPressurePlate; + materials[18506] = Material.CrimsonRoots; + for (int i = 19117; i <= 19148; i++) + materials[i] = Material.CrimsonSign; + for (int i = 18509; i <= 18514; i++) + materials[i] = Material.CrimsonSlab; + for (int i = 18781; i <= 18860; i++) + materials[i] = Material.CrimsonStairs; + for (int i = 18437; i <= 18439; i++) + materials[i] = Material.CrimsonStem; + for (int i = 18589; i <= 18652; i++) + materials[i] = Material.CrimsonTrapdoor; + for (int i = 5598; i <= 5605; i++) + materials[i] = Material.CrimsonWallHangingSign; + for (int i = 19181; i <= 19188; i++) + materials[i] = Material.CrimsonWallSign; + materials[19290] = Material.CryingObsidian; + materials[21170] = Material.CutCopper; + for (int i = 21509; i <= 21514; i++) + materials[i] = Material.CutCopperSlab; + for (int i = 21411; i <= 21490; i++) + materials[i] = Material.CutCopperStairs; + materials[10936] = Material.CutRedSandstone; + for (int i = 11149; i <= 11154; i++) + materials[i] = Material.CutRedSandstoneSlab; + materials[533] = Material.CutSandstone; + for (int i = 11095; i <= 11100; i++) + materials[i] = Material.CutSandstoneSlab; + for (int i = 10758; i <= 10773; i++) + materials[i] = Material.CyanBanner; + for (int i = 1828; i <= 1843; i++) + materials[i] = Material.CyanBed; + for (int i = 20726; i <= 20741; i++) + materials[i] = Material.CyanCandle; + for (int i = 20858; i <= 20859; i++) + materials[i] = Material.CyanCandleCake; + materials[10592] = Material.CyanCarpet; + materials[12581] = Material.CyanConcrete; + materials[12597] = Material.CyanConcretePowder; + for (int i = 12544; i <= 12547; i++) + materials[i] = Material.CyanGlazedTerracotta; + for (int i = 12466; i <= 12471; i++) + materials[i] = Material.CyanShulkerBox; + materials[5951] = Material.CyanStainedGlass; + for (int i = 9516; i <= 9547; i++) + materials[i] = Material.CyanStainedGlassPane; + materials[9221] = Material.CyanTerracotta; + for (int i = 10906; i <= 10909; i++) + materials[i] = Material.CyanWallBanner; + materials[2052] = Material.CyanWool; + for (int i = 8971; i <= 8974; i++) + materials[i] = Material.DamagedAnvil; + materials[2071] = Material.Dandelion; + for (int i = 8751; i <= 8774; i++) + materials[i] = Material.DarkOakButton; + for (int i = 11997; i <= 12060; i++) + materials[i] = Material.DarkOakDoor; + for (int i = 11581; i <= 11612; i++) + materials[i] = Material.DarkOakFence; + for (int i = 11325; i <= 11356; i++) + materials[i] = Material.DarkOakFenceGate; + for (int i = 5214; i <= 5277; i++) + materials[i] = Material.DarkOakHangingSign; + for (int i = 401; i <= 428; i++) + materials[i] = Material.DarkOakLeaves; + for (int i = 144; i <= 146; i++) + materials[i] = Material.DarkOakLog; + materials[21] = Material.DarkOakPlanks; + for (int i = 5724; i <= 5725; i++) + materials[i] = Material.DarkOakPressurePlate; + for (int i = 37; i <= 38; i++) + materials[i] = Material.DarkOakSapling; + for (int i = 4490; i <= 4521; i++) + materials[i] = Material.DarkOakSign; + for (int i = 11053; i <= 11058; i++) + materials[i] = Material.DarkOakSlab; + for (int i = 9900; i <= 9979; i++) + materials[i] = Material.DarkOakStairs; + for (int i = 6342; i <= 6405; i++) + materials[i] = Material.DarkOakTrapdoor; + for (int i = 5582; i <= 5589; i++) + materials[i] = Material.DarkOakWallHangingSign; + for (int i = 4806; i <= 4813; i++) + materials[i] = Material.DarkOakWallSign; + for (int i = 203; i <= 205; i++) + materials[i] = Material.DarkOakWood; + materials[10320] = Material.DarkPrismarine; + for (int i = 10573; i <= 10578; i++) + materials[i] = Material.DarkPrismarineSlab; + for (int i = 10481; i <= 10560; i++) + materials[i] = Material.DarkPrismarineStairs; + for (int i = 9047; i <= 9078; i++) + materials[i] = Material.DaylightDetector; + for (int i = 12656; i <= 12657; i++) + materials[i] = Material.DeadBrainCoral; + materials[12645] = Material.DeadBrainCoralBlock; + for (int i = 12676; i <= 12677; i++) + materials[i] = Material.DeadBrainCoralFan; + for (int i = 12702; i <= 12709; i++) + materials[i] = Material.DeadBrainCoralWallFan; + for (int i = 12658; i <= 12659; i++) + materials[i] = Material.DeadBubbleCoral; + materials[12646] = Material.DeadBubbleCoralBlock; + for (int i = 12678; i <= 12679; i++) + materials[i] = Material.DeadBubbleCoralFan; + for (int i = 12710; i <= 12717; i++) + materials[i] = Material.DeadBubbleCoralWallFan; + materials[2003] = Material.DeadBush; + for (int i = 12660; i <= 12661; i++) + materials[i] = Material.DeadFireCoral; + materials[12647] = Material.DeadFireCoralBlock; + for (int i = 12680; i <= 12681; i++) + materials[i] = Material.DeadFireCoralFan; + for (int i = 12718; i <= 12725; i++) + materials[i] = Material.DeadFireCoralWallFan; + for (int i = 12662; i <= 12663; i++) + materials[i] = Material.DeadHornCoral; + materials[12648] = Material.DeadHornCoralBlock; + for (int i = 12682; i <= 12683; i++) + materials[i] = Material.DeadHornCoralFan; + for (int i = 12726; i <= 12733; i++) + materials[i] = Material.DeadHornCoralWallFan; + for (int i = 12654; i <= 12655; i++) + materials[i] = Material.DeadTubeCoral; + materials[12644] = Material.DeadTubeCoralBlock; + for (int i = 12674; i <= 12675; i++) + materials[i] = Material.DeadTubeCoralFan; + for (int i = 12694; i <= 12701; i++) + materials[i] = Material.DeadTubeCoralWallFan; + for (int i = 23717; i <= 23724; i++) + materials[i] = Material.DecoratedPot; + for (int i = 22047; i <= 22049; i++) + materials[i] = Material.Deepslate; + for (int i = 23364; i <= 23369; i++) + materials[i] = Material.DeepslateBrickSlab; + for (int i = 23284; i <= 23363; i++) + materials[i] = Material.DeepslateBrickStairs; + for (int i = 23370; i <= 23693; i++) + materials[i] = Material.DeepslateBrickWall; + materials[23283] = Material.DeepslateBricks; + materials[124] = Material.DeepslateCoalOre; + materials[21166] = Material.DeepslateCopperOre; + materials[4271] = Material.DeepslateDiamondOre; + materials[7508] = Material.DeepslateEmeraldOre; + materials[120] = Material.DeepslateGoldOre; + materials[122] = Material.DeepslateIronOre; + materials[517] = Material.DeepslateLapisOre; + for (int i = 5732; i <= 5733; i++) + materials[i] = Material.DeepslateRedstoneOre; + for (int i = 22953; i <= 22958; i++) + materials[i] = Material.DeepslateTileSlab; + for (int i = 22873; i <= 22952; i++) + materials[i] = Material.DeepslateTileStairs; + for (int i = 22959; i <= 23282; i++) + materials[i] = Material.DeepslateTileWall; + materials[22872] = Material.DeepslateTiles; + for (int i = 1964; i <= 1987; i++) + materials[i] = Material.DetectorRail; + materials[4272] = Material.DiamondBlock; + materials[4270] = Material.DiamondOre; + materials[4] = Material.Diorite; + for (int i = 13995; i <= 14000; i++) + materials[i] = Material.DioriteSlab; + for (int i = 13843; i <= 13922; i++) + materials[i] = Material.DioriteStairs; + for (int i = 17889; i <= 18212; i++) + materials[i] = Material.DioriteWall; + materials[10] = Material.Dirt; + materials[12357] = Material.DirtPath; + for (int i = 519; i <= 530; i++) + materials[i] = Material.Dispenser; + materials[7412] = Material.DragonEgg; + for (int i = 8923; i <= 8938; i++) + materials[i] = Material.DragonHead; + for (int i = 8939; i <= 8942; i++) + materials[i] = Material.DragonWallHead; + materials[12631] = Material.DriedKelpBlock; + materials[21911] = Material.DripstoneBlock; + for (int i = 9200; i <= 9211; i++) + materials[i] = Material.Dropper; + materials[7661] = Material.EmeraldBlock; + materials[7507] = Material.EmeraldOre; + materials[7385] = Material.EnchantingTable; + materials[12358] = Material.EndGateway; + materials[7402] = Material.EndPortal; + for (int i = 7403; i <= 7410; i++) + materials[i] = Material.EndPortalFrame; + for (int i = 12189; i <= 12194; i++) + materials[i] = Material.EndRod; + materials[7411] = Material.EndStone; + for (int i = 13953; i <= 13958; i++) + materials[i] = Material.EndStoneBrickSlab; + for (int i = 13203; i <= 13282; i++) + materials[i] = Material.EndStoneBrickStairs; + for (int i = 17565; i <= 17888; i++) + materials[i] = Material.EndStoneBrickWall; + materials[12349] = Material.EndStoneBricks; + for (int i = 7509; i <= 7516; i++) + materials[i] = Material.EnderChest; + materials[21163] = Material.ExposedCopper; + materials[21169] = Material.ExposedCutCopper; + for (int i = 21503; i <= 21508; i++) + materials[i] = Material.ExposedCutCopperSlab; + for (int i = 21331; i <= 21410; i++) + materials[i] = Material.ExposedCutCopperStairs; + for (int i = 4282; i <= 4289; i++) + materials[i] = Material.Farmland; + materials[2002] = Material.Fern; + for (int i = 2356; i <= 2867; i++) + materials[i] = Material.Fire; + for (int i = 12670; i <= 12671; i++) + materials[i] = Material.FireCoral; + materials[12652] = Material.FireCoralBlock; + for (int i = 12690; i <= 12691; i++) + materials[i] = Material.FireCoralFan; + for (int i = 12758; i <= 12765; i++) + materials[i] = Material.FireCoralWallFan; + materials[18278] = Material.FletchingTable; + materials[8563] = Material.FlowerPot; + materials[21968] = Material.FloweringAzalea; + for (int i = 485; i <= 512; i++) + materials[i] = Material.FloweringAzaleaLeaves; + materials[23715] = Material.Frogspawn; + for (int i = 12383; i <= 12386; i++) + materials[i] = Material.FrostedIce; + for (int i = 4290; i <= 4297; i++) + materials[i] = Material.Furnace; + materials[20126] = Material.GildedBlackstone; + materials[515] = Material.Glass; + for (int i = 6776; i <= 6807; i++) + materials[i] = Material.GlassPane; + for (int i = 6865; i <= 6992; i++) + materials[i] = Material.GlowLichen; + materials[5860] = Material.Glowstone; + materials[2087] = Material.GoldBlock; + materials[119] = Material.GoldOre; + materials[2] = Material.Granite; + for (int i = 13971; i <= 13976; i++) + materials[i] = Material.GraniteSlab; + for (int i = 13523; i <= 13602; i++) + materials[i] = Material.GraniteStairs; + for (int i = 15297; i <= 15620; i++) + materials[i] = Material.GraniteWall; + materials[2001] = Material.Grass; + for (int i = 8; i <= 9; i++) + materials[i] = Material.GrassBlock; + materials[118] = Material.Gravel; + for (int i = 10726; i <= 10741; i++) + materials[i] = Material.GrayBanner; + for (int i = 1796; i <= 1811; i++) + materials[i] = Material.GrayBed; + for (int i = 20694; i <= 20709; i++) + materials[i] = Material.GrayCandle; + for (int i = 20854; i <= 20855; i++) + materials[i] = Material.GrayCandleCake; + materials[10590] = Material.GrayCarpet; + materials[12579] = Material.GrayConcrete; + materials[12595] = Material.GrayConcretePowder; + for (int i = 12536; i <= 12539; i++) + materials[i] = Material.GrayGlazedTerracotta; + for (int i = 12454; i <= 12459; i++) + materials[i] = Material.GrayShulkerBox; + materials[5949] = Material.GrayStainedGlass; + for (int i = 9452; i <= 9483; i++) + materials[i] = Material.GrayStainedGlassPane; + materials[9219] = Material.GrayTerracotta; + for (int i = 10898; i <= 10901; i++) + materials[i] = Material.GrayWallBanner; + materials[2050] = Material.GrayWool; + for (int i = 10822; i <= 10837; i++) + materials[i] = Material.GreenBanner; + for (int i = 1892; i <= 1907; i++) + materials[i] = Material.GreenBed; + for (int i = 20790; i <= 20805; i++) + materials[i] = Material.GreenCandle; + for (int i = 20866; i <= 20867; i++) + materials[i] = Material.GreenCandleCake; + materials[10596] = Material.GreenCarpet; + materials[12585] = Material.GreenConcrete; + materials[12601] = Material.GreenConcretePowder; + for (int i = 12560; i <= 12563; i++) + materials[i] = Material.GreenGlazedTerracotta; + for (int i = 12490; i <= 12495; i++) + materials[i] = Material.GreenShulkerBox; + materials[5955] = Material.GreenStainedGlass; + for (int i = 9644; i <= 9675; i++) + materials[i] = Material.GreenStainedGlassPane; + materials[9225] = Material.GreenTerracotta; + for (int i = 10922; i <= 10925; i++) + materials[i] = Material.GreenWallBanner; + materials[2056] = Material.GreenWool; + for (int i = 18279; i <= 18290; i++) + materials[i] = Material.Grindstone; + for (int i = 22043; i <= 22044; i++) + materials[i] = Material.HangingRoots; + for (int i = 10580; i <= 10582; i++) + materials[i] = Material.HayBlock; + for (int i = 9015; i <= 9030; i++) + materials[i] = Material.HeavyWeightedPressurePlate; + materials[19286] = Material.HoneyBlock; + materials[19287] = Material.HoneycombBlock; + for (int i = 9081; i <= 9090; i++) + materials[i] = Material.Hopper; + for (int i = 12672; i <= 12673; i++) + materials[i] = Material.HornCoral; + materials[12653] = Material.HornCoralBlock; + for (int i = 12692; i <= 12693; i++) + materials[i] = Material.HornCoralFan; + for (int i = 12766; i <= 12773; i++) + materials[i] = Material.HornCoralWallFan; + materials[5776] = Material.Ice; + materials[6545] = Material.InfestedChiseledStoneBricks; + materials[6541] = Material.InfestedCobblestone; + materials[6544] = Material.InfestedCrackedStoneBricks; + for (int i = 23697; i <= 23699; i++) + materials[i] = Material.InfestedDeepslate; + materials[6543] = Material.InfestedMossyStoneBricks; + materials[6540] = Material.InfestedStone; + materials[6542] = Material.InfestedStoneBricks; + for (int i = 6738; i <= 6769; i++) + materials[i] = Material.IronBars; + materials[2088] = Material.IronBlock; + for (int i = 5648; i <= 5711; i++) + materials[i] = Material.IronDoor; + materials[121] = Material.IronOre; + for (int i = 10254; i <= 10317; i++) + materials[i] = Material.IronTrapdoor; + for (int i = 5867; i <= 5870; i++) + materials[i] = Material.JackOLantern; + for (int i = 19201; i <= 19212; i++) + materials[i] = Material.Jigsaw; + for (int i = 5811; i <= 5812; i++) + materials[i] = Material.Jukebox; + for (int i = 8679; i <= 8702; i++) + materials[i] = Material.JungleButton; + for (int i = 11805; i <= 11868; i++) + materials[i] = Material.JungleDoor; + for (int i = 11485; i <= 11516; i++) + materials[i] = Material.JungleFence; + for (int i = 11229; i <= 11260; i++) + materials[i] = Material.JungleFenceGate; + for (int i = 5150; i <= 5213; i++) + materials[i] = Material.JungleHangingSign; + for (int i = 317; i <= 344; i++) + materials[i] = Material.JungleLeaves; + for (int i = 135; i <= 137; i++) + materials[i] = Material.JungleLog; + materials[18] = Material.JunglePlanks; + for (int i = 5718; i <= 5719; i++) + materials[i] = Material.JunglePressurePlate; + for (int i = 31; i <= 32; i++) + materials[i] = Material.JungleSapling; + for (int i = 4458; i <= 4489; i++) + materials[i] = Material.JungleSign; + for (int i = 11035; i <= 11040; i++) + materials[i] = Material.JungleSlab; + for (int i = 7822; i <= 7901; i++) + materials[i] = Material.JungleStairs; + for (int i = 6150; i <= 6213; i++) + materials[i] = Material.JungleTrapdoor; + for (int i = 5574; i <= 5581; i++) + materials[i] = Material.JungleWallHangingSign; + for (int i = 4798; i <= 4805; i++) + materials[i] = Material.JungleWallSign; + for (int i = 194; i <= 196; i++) + materials[i] = Material.JungleWood; + for (int i = 12604; i <= 12629; i++) + materials[i] = Material.Kelp; + materials[12630] = Material.KelpPlant; + for (int i = 4650; i <= 4657; i++) + materials[i] = Material.Ladder; + for (int i = 18344; i <= 18347; i++) + materials[i] = Material.Lantern; + materials[518] = Material.LapisBlock; + materials[516] = Material.LapisOre; + for (int i = 20886; i <= 20897; i++) + materials[i] = Material.LargeAmethystBud; + for (int i = 10612; i <= 10613; i++) + materials[i] = Material.LargeFern; + for (int i = 96; i <= 111; i++) + materials[i] = Material.Lava; + materials[7398] = Material.LavaCauldron; + for (int i = 18291; i <= 18306; i++) + materials[i] = Material.Lectern; + for (int i = 5622; i <= 5645; i++) + materials[i] = Material.Lever; + for (int i = 10222; i <= 10253; i++) + materials[i] = Material.Light; + for (int i = 10662; i <= 10677; i++) + materials[i] = Material.LightBlueBanner; + for (int i = 1732; i <= 1747; i++) + materials[i] = Material.LightBlueBed; + for (int i = 20630; i <= 20645; i++) + materials[i] = Material.LightBlueCandle; + for (int i = 20846; i <= 20847; i++) + materials[i] = Material.LightBlueCandleCake; + materials[10586] = Material.LightBlueCarpet; + materials[12575] = Material.LightBlueConcrete; + materials[12591] = Material.LightBlueConcretePowder; + for (int i = 12520; i <= 12523; i++) + materials[i] = Material.LightBlueGlazedTerracotta; + for (int i = 12430; i <= 12435; i++) + materials[i] = Material.LightBlueShulkerBox; + materials[5945] = Material.LightBlueStainedGlass; + for (int i = 9324; i <= 9355; i++) + materials[i] = Material.LightBlueStainedGlassPane; + materials[9215] = Material.LightBlueTerracotta; + for (int i = 10882; i <= 10885; i++) + materials[i] = Material.LightBlueWallBanner; + materials[2046] = Material.LightBlueWool; + for (int i = 10742; i <= 10757; i++) + materials[i] = Material.LightGrayBanner; + for (int i = 1812; i <= 1827; i++) + materials[i] = Material.LightGrayBed; + for (int i = 20710; i <= 20725; i++) + materials[i] = Material.LightGrayCandle; + for (int i = 20856; i <= 20857; i++) + materials[i] = Material.LightGrayCandleCake; + materials[10591] = Material.LightGrayCarpet; + materials[12580] = Material.LightGrayConcrete; + materials[12596] = Material.LightGrayConcretePowder; + for (int i = 12540; i <= 12543; i++) + materials[i] = Material.LightGrayGlazedTerracotta; + for (int i = 12460; i <= 12465; i++) + materials[i] = Material.LightGrayShulkerBox; + materials[5950] = Material.LightGrayStainedGlass; + for (int i = 9484; i <= 9515; i++) + materials[i] = Material.LightGrayStainedGlassPane; + materials[9220] = Material.LightGrayTerracotta; + for (int i = 10902; i <= 10905; i++) + materials[i] = Material.LightGrayWallBanner; + materials[2051] = Material.LightGrayWool; + for (int i = 8999; i <= 9014; i++) + materials[i] = Material.LightWeightedPressurePlate; + for (int i = 21867; i <= 21890; i++) + materials[i] = Material.LightningRod; + for (int i = 10604; i <= 10605; i++) + materials[i] = Material.Lilac; + materials[2084] = Material.LilyOfTheValley; + materials[7267] = Material.LilyPad; + for (int i = 10694; i <= 10709; i++) + materials[i] = Material.LimeBanner; + for (int i = 1764; i <= 1779; i++) + materials[i] = Material.LimeBed; + for (int i = 20662; i <= 20677; i++) + materials[i] = Material.LimeCandle; + for (int i = 20850; i <= 20851; i++) + materials[i] = Material.LimeCandleCake; + materials[10588] = Material.LimeCarpet; + materials[12577] = Material.LimeConcrete; + materials[12593] = Material.LimeConcretePowder; + for (int i = 12528; i <= 12531; i++) + materials[i] = Material.LimeGlazedTerracotta; + for (int i = 12442; i <= 12447; i++) + materials[i] = Material.LimeShulkerBox; + materials[5947] = Material.LimeStainedGlass; + for (int i = 9388; i <= 9419; i++) + materials[i] = Material.LimeStainedGlassPane; + materials[9217] = Material.LimeTerracotta; + for (int i = 10890; i <= 10893; i++) + materials[i] = Material.LimeWallBanner; + materials[2048] = Material.LimeWool; + materials[19300] = Material.Lodestone; + for (int i = 18245; i <= 18248; i++) + materials[i] = Material.Loom; + for (int i = 10646; i <= 10661; i++) + materials[i] = Material.MagentaBanner; + for (int i = 1716; i <= 1731; i++) + materials[i] = Material.MagentaBed; + for (int i = 20614; i <= 20629; i++) + materials[i] = Material.MagentaCandle; + for (int i = 20844; i <= 20845; i++) + materials[i] = Material.MagentaCandleCake; + materials[10585] = Material.MagentaCarpet; + materials[12574] = Material.MagentaConcrete; + materials[12590] = Material.MagentaConcretePowder; + for (int i = 12516; i <= 12519; i++) + materials[i] = Material.MagentaGlazedTerracotta; + for (int i = 12424; i <= 12429; i++) + materials[i] = Material.MagentaShulkerBox; + materials[5944] = Material.MagentaStainedGlass; + for (int i = 9292; i <= 9323; i++) + materials[i] = Material.MagentaStainedGlassPane; + materials[9214] = Material.MagentaTerracotta; + for (int i = 10878; i <= 10881; i++) + materials[i] = Material.MagentaWallBanner; + materials[2045] = Material.MagentaWool; + materials[12387] = Material.MagmaBlock; + for (int i = 8775; i <= 8798; i++) + materials[i] = Material.MangroveButton; + for (int i = 12061; i <= 12124; i++) + materials[i] = Material.MangroveDoor; + for (int i = 11613; i <= 11644; i++) + materials[i] = Material.MangroveFence; + for (int i = 11357; i <= 11388; i++) + materials[i] = Material.MangroveFenceGate; + for (int i = 5406; i <= 5469; i++) + materials[i] = Material.MangroveHangingSign; + for (int i = 429; i <= 456; i++) + materials[i] = Material.MangroveLeaves; + for (int i = 147; i <= 149; i++) + materials[i] = Material.MangroveLog; + materials[22] = Material.MangrovePlanks; + for (int i = 5726; i <= 5727; i++) + materials[i] = Material.MangrovePressurePlate; + for (int i = 39; i <= 78; i++) + materials[i] = Material.MangrovePropagule; + for (int i = 150; i <= 151; i++) + materials[i] = Material.MangroveRoots; + for (int i = 4522; i <= 4553; i++) + materials[i] = Material.MangroveSign; + for (int i = 11059; i <= 11064; i++) + materials[i] = Material.MangroveSlab; + for (int i = 9980; i <= 10059; i++) + materials[i] = Material.MangroveStairs; + for (int i = 6406; i <= 6469; i++) + materials[i] = Material.MangroveTrapdoor; + for (int i = 5590; i <= 5597; i++) + materials[i] = Material.MangroveWallHangingSign; + for (int i = 4814; i <= 4821; i++) + materials[i] = Material.MangroveWallSign; + for (int i = 206; i <= 208; i++) + materials[i] = Material.MangroveWood; + for (int i = 20898; i <= 20909; i++) + materials[i] = Material.MediumAmethystBud; + materials[6808] = Material.Melon; + for (int i = 6825; i <= 6832; i++) + materials[i] = Material.MelonStem; + materials[21986] = Material.MossBlock; + materials[21969] = Material.MossCarpet; + materials[2349] = Material.MossyCobblestone; + for (int i = 13947; i <= 13952; i++) + materials[i] = Material.MossyCobblestoneSlab; + for (int i = 13123; i <= 13202; i++) + materials[i] = Material.MossyCobblestoneStairs; + for (int i = 8239; i <= 8562; i++) + materials[i] = Material.MossyCobblestoneWall; + for (int i = 13935; i <= 13940; i++) + materials[i] = Material.MossyStoneBrickSlab; + for (int i = 12963; i <= 13042; i++) + materials[i] = Material.MossyStoneBrickStairs; + for (int i = 14973; i <= 15296; i++) + materials[i] = Material.MossyStoneBrickWall; + materials[6535] = Material.MossyStoneBricks; + for (int i = 2059; i <= 2070; i++) + materials[i] = Material.MovingPiston; + materials[22046] = Material.Mud; + for (int i = 11125; i <= 11130; i++) + materials[i] = Material.MudBrickSlab; + for (int i = 7185; i <= 7264; i++) + materials[i] = Material.MudBrickStairs; + for (int i = 15945; i <= 16268; i++) + materials[i] = Material.MudBrickWall; + materials[6539] = Material.MudBricks; + for (int i = 152; i <= 154; i++) + materials[i] = Material.MuddyMangroveRoots; + for (int i = 6674; i <= 6737; i++) + materials[i] = Material.MushroomStem; + for (int i = 7265; i <= 7266; i++) + materials[i] = Material.Mycelium; + for (int i = 7269; i <= 7300; i++) + materials[i] = Material.NetherBrickFence; + for (int i = 11131; i <= 11136; i++) + materials[i] = Material.NetherBrickSlab; + for (int i = 7301; i <= 7380; i++) + materials[i] = Material.NetherBrickStairs; + for (int i = 16269; i <= 16592; i++) + materials[i] = Material.NetherBrickWall; + materials[7268] = Material.NetherBricks; + materials[125] = Material.NetherGoldOre; + for (int i = 5861; i <= 5862; i++) + materials[i] = Material.NetherPortal; + materials[9080] = Material.NetherQuartzOre; + materials[18436] = Material.NetherSprouts; + for (int i = 7381; i <= 7384; i++) + materials[i] = Material.NetherWart; + materials[12388] = Material.NetherWartBlock; + materials[19288] = Material.NetheriteBlock; + materials[5846] = Material.Netherrack; + for (int i = 534; i <= 1683; i++) + materials[i] = Material.NoteBlock; + for (int i = 8607; i <= 8630; i++) + materials[i] = Material.OakButton; + for (int i = 4586; i <= 4649; i++) + materials[i] = Material.OakDoor; + for (int i = 5813; i <= 5844; i++) + materials[i] = Material.OakFence; + for (int i = 6993; i <= 7024; i++) + materials[i] = Material.OakFenceGate; + for (int i = 4830; i <= 4893; i++) + materials[i] = Material.OakHangingSign; + for (int i = 233; i <= 260; i++) + materials[i] = Material.OakLeaves; + for (int i = 126; i <= 128; i++) + materials[i] = Material.OakLog; + materials[15] = Material.OakPlanks; + for (int i = 5712; i <= 5713; i++) + materials[i] = Material.OakPressurePlate; + for (int i = 25; i <= 26; i++) + materials[i] = Material.OakSapling; + for (int i = 4298; i <= 4329; i++) + materials[i] = Material.OakSign; + for (int i = 11017; i <= 11022; i++) + materials[i] = Material.OakSlab; + for (int i = 2870; i <= 2949; i++) + materials[i] = Material.OakStairs; + for (int i = 5958; i <= 6021; i++) + materials[i] = Material.OakTrapdoor; + for (int i = 5534; i <= 5541; i++) + materials[i] = Material.OakWallHangingSign; + for (int i = 4758; i <= 4765; i++) + materials[i] = Material.OakWallSign; + for (int i = 185; i <= 187; i++) + materials[i] = Material.OakWood; + for (int i = 12394; i <= 12405; i++) + materials[i] = Material.Observer; + materials[2350] = Material.Obsidian; + for (int i = 23706; i <= 23708; i++) + materials[i] = Material.OchreFroglight; + for (int i = 10630; i <= 10645; i++) + materials[i] = Material.OrangeBanner; + for (int i = 1700; i <= 1715; i++) + materials[i] = Material.OrangeBed; + for (int i = 20598; i <= 20613; i++) + materials[i] = Material.OrangeCandle; + for (int i = 20842; i <= 20843; i++) + materials[i] = Material.OrangeCandleCake; + materials[10584] = Material.OrangeCarpet; + materials[12573] = Material.OrangeConcrete; + materials[12589] = Material.OrangeConcretePowder; + for (int i = 12512; i <= 12515; i++) + materials[i] = Material.OrangeGlazedTerracotta; + for (int i = 12418; i <= 12423; i++) + materials[i] = Material.OrangeShulkerBox; + materials[5943] = Material.OrangeStainedGlass; + for (int i = 9260; i <= 9291; i++) + materials[i] = Material.OrangeStainedGlassPane; + materials[9213] = Material.OrangeTerracotta; + materials[2078] = Material.OrangeTulip; + for (int i = 10874; i <= 10877; i++) + materials[i] = Material.OrangeWallBanner; + materials[2044] = Material.OrangeWool; + materials[2081] = Material.OxeyeDaisy; + materials[21161] = Material.OxidizedCopper; + materials[21167] = Material.OxidizedCutCopper; + for (int i = 21491; i <= 21496; i++) + materials[i] = Material.OxidizedCutCopperSlab; + for (int i = 21171; i <= 21250; i++) + materials[i] = Material.OxidizedCutCopperStairs; + materials[10601] = Material.PackedIce; + materials[6538] = Material.PackedMud; + for (int i = 23712; i <= 23714; i++) + materials[i] = Material.PearlescentFroglight; + for (int i = 10608; i <= 10609; i++) + materials[i] = Material.Peony; + for (int i = 11101; i <= 11106; i++) + materials[i] = Material.PetrifiedOakSlab; + for (int i = 8943; i <= 8958; i++) + materials[i] = Material.PiglinHead; + for (int i = 8959; i <= 8962; i++) + materials[i] = Material.PiglinWallHead; + for (int i = 10710; i <= 10725; i++) + materials[i] = Material.PinkBanner; + for (int i = 1780; i <= 1795; i++) + materials[i] = Material.PinkBed; + for (int i = 20678; i <= 20693; i++) + materials[i] = Material.PinkCandle; + for (int i = 20852; i <= 20853; i++) + materials[i] = Material.PinkCandleCake; + materials[10589] = Material.PinkCarpet; + materials[12578] = Material.PinkConcrete; + materials[12594] = Material.PinkConcretePowder; + for (int i = 12532; i <= 12535; i++) + materials[i] = Material.PinkGlazedTerracotta; + for (int i = 21970; i <= 21985; i++) + materials[i] = Material.PinkPetals; + for (int i = 12448; i <= 12453; i++) + materials[i] = Material.PinkShulkerBox; + materials[5948] = Material.PinkStainedGlass; + for (int i = 9420; i <= 9451; i++) + materials[i] = Material.PinkStainedGlassPane; + materials[9218] = Material.PinkTerracotta; + materials[2080] = Material.PinkTulip; + for (int i = 10894; i <= 10897; i++) + materials[i] = Material.PinkWallBanner; + materials[2049] = Material.PinkWool; + for (int i = 2007; i <= 2018; i++) + materials[i] = Material.Piston; + for (int i = 2019; i <= 2042; i++) + materials[i] = Material.PistonHead; + for (int i = 8883; i <= 8898; i++) + materials[i] = Material.PlayerHead; + for (int i = 8899; i <= 8902; i++) + materials[i] = Material.PlayerWallHead; + for (int i = 12; i <= 13; i++) + materials[i] = Material.Podzol; + for (int i = 21891; i <= 21910; i++) + materials[i] = Material.PointedDripstone; + materials[7] = Material.PolishedAndesite; + for (int i = 13989; i <= 13994; i++) + materials[i] = Material.PolishedAndesiteSlab; + for (int i = 13763; i <= 13842; i++) + materials[i] = Material.PolishedAndesiteStairs; + for (int i = 5852; i <= 5854; i++) + materials[i] = Material.PolishedBasalt; + materials[19712] = Material.PolishedBlackstone; + for (int i = 19716; i <= 19721; i++) + materials[i] = Material.PolishedBlackstoneBrickSlab; + for (int i = 19722; i <= 19801; i++) + materials[i] = Material.PolishedBlackstoneBrickStairs; + for (int i = 19802; i <= 20125; i++) + materials[i] = Material.PolishedBlackstoneBrickWall; + materials[19713] = Material.PolishedBlackstoneBricks; + for (int i = 20215; i <= 20238; i++) + materials[i] = Material.PolishedBlackstoneButton; + for (int i = 20213; i <= 20214; i++) + materials[i] = Material.PolishedBlackstonePressurePlate; + for (int i = 20207; i <= 20212; i++) + materials[i] = Material.PolishedBlackstoneSlab; + for (int i = 20127; i <= 20206; i++) + materials[i] = Material.PolishedBlackstoneStairs; + for (int i = 20239; i <= 20562; i++) + materials[i] = Material.PolishedBlackstoneWall; + materials[22461] = Material.PolishedDeepslate; + for (int i = 22542; i <= 22547; i++) + materials[i] = Material.PolishedDeepslateSlab; + for (int i = 22462; i <= 22541; i++) + materials[i] = Material.PolishedDeepslateStairs; + for (int i = 22548; i <= 22871; i++) + materials[i] = Material.PolishedDeepslateWall; + materials[5] = Material.PolishedDiorite; + for (int i = 13941; i <= 13946; i++) + materials[i] = Material.PolishedDioriteSlab; + for (int i = 13043; i <= 13122; i++) + materials[i] = Material.PolishedDioriteStairs; + materials[3] = Material.PolishedGranite; + for (int i = 13923; i <= 13928; i++) + materials[i] = Material.PolishedGraniteSlab; + for (int i = 12803; i <= 12882; i++) + materials[i] = Material.PolishedGraniteStairs; + materials[2073] = Material.Poppy; + for (int i = 8599; i <= 8606; i++) + materials[i] = Material.Potatoes; + materials[8569] = Material.PottedAcaciaSapling; + materials[8577] = Material.PottedAllium; + materials[23704] = Material.PottedAzaleaBush; + materials[8578] = Material.PottedAzureBluet; + materials[12798] = Material.PottedBamboo; + materials[8567] = Material.PottedBirchSapling; + materials[8576] = Material.PottedBlueOrchid; + materials[8588] = Material.PottedBrownMushroom; + materials[8590] = Material.PottedCactus; + materials[8570] = Material.PottedCherrySapling; + materials[8584] = Material.PottedCornflower; + materials[19296] = Material.PottedCrimsonFungus; + materials[19298] = Material.PottedCrimsonRoots; + materials[8574] = Material.PottedDandelion; + materials[8571] = Material.PottedDarkOakSapling; + materials[8589] = Material.PottedDeadBush; + materials[8573] = Material.PottedFern; + materials[23705] = Material.PottedFloweringAzaleaBush; + materials[8568] = Material.PottedJungleSapling; + materials[8585] = Material.PottedLilyOfTheValley; + materials[8572] = Material.PottedMangrovePropagule; + materials[8565] = Material.PottedOakSapling; + materials[8580] = Material.PottedOrangeTulip; + materials[8583] = Material.PottedOxeyeDaisy; + materials[8582] = Material.PottedPinkTulip; + materials[8575] = Material.PottedPoppy; + materials[8587] = Material.PottedRedMushroom; + materials[8579] = Material.PottedRedTulip; + materials[8566] = Material.PottedSpruceSapling; + materials[8564] = Material.PottedTorchflower; + materials[19297] = Material.PottedWarpedFungus; + materials[19299] = Material.PottedWarpedRoots; + materials[8581] = Material.PottedWhiteTulip; + materials[8586] = Material.PottedWitherRose; + materials[20925] = Material.PowderSnow; + for (int i = 7399; i <= 7401; i++) + materials[i] = Material.PowderSnowCauldron; + for (int i = 1940; i <= 1963; i++) + materials[i] = Material.PoweredRail; + materials[10318] = Material.Prismarine; + for (int i = 10567; i <= 10572; i++) + materials[i] = Material.PrismarineBrickSlab; + for (int i = 10401; i <= 10480; i++) + materials[i] = Material.PrismarineBrickStairs; + materials[10319] = Material.PrismarineBricks; + for (int i = 10561; i <= 10566; i++) + materials[i] = Material.PrismarineSlab; + for (int i = 10321; i <= 10400; i++) + materials[i] = Material.PrismarineStairs; + for (int i = 14325; i <= 14648; i++) + materials[i] = Material.PrismarineWall; + materials[5845] = Material.Pumpkin; + for (int i = 6817; i <= 6824; i++) + materials[i] = Material.PumpkinStem; + for (int i = 10774; i <= 10789; i++) + materials[i] = Material.PurpleBanner; + for (int i = 1844; i <= 1859; i++) + materials[i] = Material.PurpleBed; + for (int i = 20742; i <= 20757; i++) + materials[i] = Material.PurpleCandle; + for (int i = 20860; i <= 20861; i++) + materials[i] = Material.PurpleCandleCake; + materials[10593] = Material.PurpleCarpet; + materials[12582] = Material.PurpleConcrete; + materials[12598] = Material.PurpleConcretePowder; + for (int i = 12548; i <= 12551; i++) + materials[i] = Material.PurpleGlazedTerracotta; + for (int i = 12472; i <= 12477; i++) + materials[i] = Material.PurpleShulkerBox; + materials[5952] = Material.PurpleStainedGlass; + for (int i = 9548; i <= 9579; i++) + materials[i] = Material.PurpleStainedGlassPane; + materials[9222] = Material.PurpleTerracotta; + for (int i = 10910; i <= 10913; i++) + materials[i] = Material.PurpleWallBanner; + materials[2053] = Material.PurpleWool; + materials[12265] = Material.PurpurBlock; + for (int i = 12266; i <= 12268; i++) + materials[i] = Material.PurpurPillar; + for (int i = 11155; i <= 11160; i++) + materials[i] = Material.PurpurSlab; + for (int i = 12269; i <= 12348; i++) + materials[i] = Material.PurpurStairs; + materials[9091] = Material.QuartzBlock; + materials[20565] = Material.QuartzBricks; + for (int i = 9093; i <= 9095; i++) + materials[i] = Material.QuartzPillar; + for (int i = 11137; i <= 11142; i++) + materials[i] = Material.QuartzSlab; + for (int i = 9096; i <= 9175; i++) + materials[i] = Material.QuartzStairs; + for (int i = 4658; i <= 4677; i++) + materials[i] = Material.Rail; + materials[23702] = Material.RawCopperBlock; + materials[23703] = Material.RawGoldBlock; + materials[23701] = Material.RawIronBlock; + for (int i = 10838; i <= 10853; i++) + materials[i] = Material.RedBanner; + for (int i = 1908; i <= 1923; i++) + materials[i] = Material.RedBed; + for (int i = 20806; i <= 20821; i++) + materials[i] = Material.RedCandle; + for (int i = 20868; i <= 20869; i++) + materials[i] = Material.RedCandleCake; + materials[10597] = Material.RedCarpet; + materials[12586] = Material.RedConcrete; + materials[12602] = Material.RedConcretePowder; + for (int i = 12564; i <= 12567; i++) + materials[i] = Material.RedGlazedTerracotta; + materials[2086] = Material.RedMushroom; + for (int i = 6610; i <= 6673; i++) + materials[i] = Material.RedMushroomBlock; + for (int i = 13983; i <= 13988; i++) + materials[i] = Material.RedNetherBrickSlab; + for (int i = 13683; i <= 13762; i++) + materials[i] = Material.RedNetherBrickStairs; + for (int i = 16917; i <= 17240; i++) + materials[i] = Material.RedNetherBrickWall; + materials[12389] = Material.RedNetherBricks; + materials[117] = Material.RedSand; + materials[10934] = Material.RedSandstone; + for (int i = 11143; i <= 11148; i++) + materials[i] = Material.RedSandstoneSlab; + for (int i = 10937; i <= 11016; i++) + materials[i] = Material.RedSandstoneStairs; + for (int i = 14649; i <= 14972; i++) + materials[i] = Material.RedSandstoneWall; + for (int i = 12496; i <= 12501; i++) + materials[i] = Material.RedShulkerBox; + materials[5956] = Material.RedStainedGlass; + for (int i = 9676; i <= 9707; i++) + materials[i] = Material.RedStainedGlassPane; + materials[9226] = Material.RedTerracotta; + materials[2077] = Material.RedTulip; + for (int i = 10926; i <= 10929; i++) + materials[i] = Material.RedWallBanner; + materials[2057] = Material.RedWool; + materials[9079] = Material.RedstoneBlock; + for (int i = 7413; i <= 7414; i++) + materials[i] = Material.RedstoneLamp; + for (int i = 5730; i <= 5731; i++) + materials[i] = Material.RedstoneOre; + for (int i = 5734; i <= 5735; i++) + materials[i] = Material.RedstoneTorch; + for (int i = 5736; i <= 5743; i++) + materials[i] = Material.RedstoneWallTorch; + for (int i = 2974; i <= 4269; i++) + materials[i] = Material.RedstoneWire; + materials[23716] = Material.ReinforcedDeepslate; + for (int i = 5878; i <= 5941; i++) + materials[i] = Material.Repeater; + for (int i = 12359; i <= 12370; i++) + materials[i] = Material.RepeatingCommandBlock; + for (int i = 19291; i <= 19295; i++) + materials[i] = Material.RespawnAnchor; + materials[22045] = Material.RootedDirt; + for (int i = 10606; i <= 10607; i++) + materials[i] = Material.RoseBush; + materials[112] = Material.Sand; + materials[531] = Material.Sandstone; + for (int i = 11089; i <= 11094; i++) + materials[i] = Material.SandstoneSlab; + for (int i = 7427; i <= 7506; i++) + materials[i] = Material.SandstoneStairs; + for (int i = 17241; i <= 17564; i++) + materials[i] = Material.SandstoneWall; + for (int i = 18213; i <= 18244; i++) + materials[i] = Material.Scaffolding; + materials[21022] = Material.Sculk; + for (int i = 21151; i <= 21152; i++) + materials[i] = Material.SculkCatalyst; + for (int i = 20926; i <= 21021; i++) + materials[i] = Material.SculkSensor; + for (int i = 21153; i <= 21160; i++) + materials[i] = Material.SculkShrieker; + for (int i = 21023; i <= 21150; i++) + materials[i] = Material.SculkVein; + materials[10579] = Material.SeaLantern; + for (int i = 12774; i <= 12781; i++) + materials[i] = Material.SeaPickle; + materials[2004] = Material.Seagrass; + materials[18451] = Material.Shroomlight; + for (int i = 12406; i <= 12411; i++) + materials[i] = Material.ShulkerBox; + for (int i = 8823; i <= 8838; i++) + materials[i] = Material.SkeletonSkull; + for (int i = 8839; i <= 8842; i++) + materials[i] = Material.SkeletonWallSkull; + materials[10220] = Material.SlimeBlock; + for (int i = 20910; i <= 20921; i++) + materials[i] = Material.SmallAmethystBud; + for (int i = 22027; i <= 22042; i++) + materials[i] = Material.SmallDripleaf; + materials[18307] = Material.SmithingTable; + for (int i = 18261; i <= 18268; i++) + materials[i] = Material.Smoker; + materials[23700] = Material.SmoothBasalt; + materials[11163] = Material.SmoothQuartz; + for (int i = 13965; i <= 13970; i++) + materials[i] = Material.SmoothQuartzSlab; + for (int i = 13443; i <= 13522; i++) + materials[i] = Material.SmoothQuartzStairs; + materials[11164] = Material.SmoothRedSandstone; + for (int i = 13929; i <= 13934; i++) + materials[i] = Material.SmoothRedSandstoneSlab; + for (int i = 12883; i <= 12962; i++) + materials[i] = Material.SmoothRedSandstoneStairs; + materials[11162] = Material.SmoothSandstone; + for (int i = 13959; i <= 13964; i++) + materials[i] = Material.SmoothSandstoneSlab; + for (int i = 13363; i <= 13442; i++) + materials[i] = Material.SmoothSandstoneStairs; + materials[11161] = Material.SmoothStone; + for (int i = 11083; i <= 11088; i++) + materials[i] = Material.SmoothStoneSlab; + for (int i = 5768; i <= 5775; i++) + materials[i] = Material.Snow; + materials[5777] = Material.SnowBlock; + for (int i = 18384; i <= 18415; i++) + materials[i] = Material.SoulCampfire; + materials[2868] = Material.SoulFire; + for (int i = 18348; i <= 18351; i++) + materials[i] = Material.SoulLantern; + materials[5847] = Material.SoulSand; + materials[5848] = Material.SoulSoil; + materials[5855] = Material.SoulTorch; + for (int i = 5856; i <= 5859; i++) + materials[i] = Material.SoulWallTorch; + materials[2869] = Material.Spawner; + materials[513] = Material.Sponge; + materials[21966] = Material.SporeBlossom; + for (int i = 8631; i <= 8654; i++) + materials[i] = Material.SpruceButton; + for (int i = 11677; i <= 11740; i++) + materials[i] = Material.SpruceDoor; + for (int i = 11421; i <= 11452; i++) + materials[i] = Material.SpruceFence; + for (int i = 11165; i <= 11196; i++) + materials[i] = Material.SpruceFenceGate; + for (int i = 4894; i <= 4957; i++) + materials[i] = Material.SpruceHangingSign; + for (int i = 261; i <= 288; i++) + materials[i] = Material.SpruceLeaves; + for (int i = 129; i <= 131; i++) + materials[i] = Material.SpruceLog; + materials[16] = Material.SprucePlanks; + for (int i = 5714; i <= 5715; i++) + materials[i] = Material.SprucePressurePlate; + for (int i = 27; i <= 28; i++) + materials[i] = Material.SpruceSapling; + for (int i = 4330; i <= 4361; i++) + materials[i] = Material.SpruceSign; + for (int i = 11023; i <= 11028; i++) + materials[i] = Material.SpruceSlab; + for (int i = 7662; i <= 7741; i++) + materials[i] = Material.SpruceStairs; + for (int i = 6022; i <= 6085; i++) + materials[i] = Material.SpruceTrapdoor; + for (int i = 5542; i <= 5549; i++) + materials[i] = Material.SpruceWallHangingSign; + for (int i = 4766; i <= 4773; i++) + materials[i] = Material.SpruceWallSign; + for (int i = 188; i <= 190; i++) + materials[i] = Material.SpruceWood; + for (int i = 1988; i <= 1999; i++) + materials[i] = Material.StickyPiston; + materials[1] = Material.Stone; + for (int i = 11119; i <= 11124; i++) + materials[i] = Material.StoneBrickSlab; + for (int i = 7105; i <= 7184; i++) + materials[i] = Material.StoneBrickStairs; + for (int i = 15621; i <= 15944; i++) + materials[i] = Material.StoneBrickWall; + materials[6534] = Material.StoneBricks; + for (int i = 5744; i <= 5767; i++) + materials[i] = Material.StoneButton; + for (int i = 5646; i <= 5647; i++) + materials[i] = Material.StonePressurePlate; + for (int i = 11077; i <= 11082; i++) + materials[i] = Material.StoneSlab; + for (int i = 13283; i <= 13362; i++) + materials[i] = Material.StoneStairs; + for (int i = 18308; i <= 18311; i++) + materials[i] = Material.Stonecutter; + for (int i = 167; i <= 169; i++) + materials[i] = Material.StrippedAcaciaLog; + for (int i = 221; i <= 223; i++) + materials[i] = Material.StrippedAcaciaWood; + for (int i = 182; i <= 184; i++) + materials[i] = Material.StrippedBambooBlock; + for (int i = 161; i <= 163; i++) + materials[i] = Material.StrippedBirchLog; + for (int i = 215; i <= 217; i++) + materials[i] = Material.StrippedBirchWood; + for (int i = 170; i <= 172; i++) + materials[i] = Material.StrippedCherryLog; + for (int i = 224; i <= 226; i++) + materials[i] = Material.StrippedCherryWood; + for (int i = 18446; i <= 18448; i++) + materials[i] = Material.StrippedCrimsonHyphae; + for (int i = 18440; i <= 18442; i++) + materials[i] = Material.StrippedCrimsonStem; + for (int i = 173; i <= 175; i++) + materials[i] = Material.StrippedDarkOakLog; + for (int i = 227; i <= 229; i++) + materials[i] = Material.StrippedDarkOakWood; + for (int i = 164; i <= 166; i++) + materials[i] = Material.StrippedJungleLog; + for (int i = 218; i <= 220; i++) + materials[i] = Material.StrippedJungleWood; + for (int i = 179; i <= 181; i++) + materials[i] = Material.StrippedMangroveLog; + for (int i = 230; i <= 232; i++) + materials[i] = Material.StrippedMangroveWood; + for (int i = 176; i <= 178; i++) + materials[i] = Material.StrippedOakLog; + for (int i = 209; i <= 211; i++) + materials[i] = Material.StrippedOakWood; + for (int i = 158; i <= 160; i++) + materials[i] = Material.StrippedSpruceLog; + for (int i = 212; i <= 214; i++) + materials[i] = Material.StrippedSpruceWood; + for (int i = 18429; i <= 18431; i++) + materials[i] = Material.StrippedWarpedHyphae; + for (int i = 18423; i <= 18425; i++) + materials[i] = Material.StrippedWarpedStem; + for (int i = 19197; i <= 19200; i++) + materials[i] = Material.StructureBlock; + materials[12393] = Material.StructureVoid; + for (int i = 5795; i <= 5810; i++) + materials[i] = Material.SugarCane; + for (int i = 10602; i <= 10603; i++) + materials[i] = Material.Sunflower; + for (int i = 113; i <= 116; i++) + materials[i] = Material.SuspiciousSand; + for (int i = 18416; i <= 18419; i++) + materials[i] = Material.SweetBerryBush; + for (int i = 10610; i <= 10611; i++) + materials[i] = Material.TallGrass; + for (int i = 2005; i <= 2006; i++) + materials[i] = Material.TallSeagrass; + for (int i = 19222; i <= 19237; i++) + materials[i] = Material.Target; + materials[10599] = Material.Terracotta; + materials[20924] = Material.TintedGlass; + for (int i = 2090; i <= 2091; i++) + materials[i] = Material.Tnt; + materials[2351] = Material.Torch; + materials[2072] = Material.Torchflower; + for (int i = 12350; i <= 12352; i++) + materials[i] = Material.TorchflowerCrop; + for (int i = 8975; i <= 8998; i++) + materials[i] = Material.TrappedChest; + for (int i = 7533; i <= 7660; i++) + materials[i] = Material.Tripwire; + for (int i = 7517; i <= 7532; i++) + materials[i] = Material.TripwireHook; + for (int i = 12664; i <= 12665; i++) + materials[i] = Material.TubeCoral; + materials[12649] = Material.TubeCoralBlock; + for (int i = 12684; i <= 12685; i++) + materials[i] = Material.TubeCoralFan; + for (int i = 12734; i <= 12741; i++) + materials[i] = Material.TubeCoralWallFan; + materials[20922] = Material.Tuff; + for (int i = 12632; i <= 12643; i++) + materials[i] = Material.TurtleEgg; + for (int i = 18479; i <= 18504; i++) + materials[i] = Material.TwistingVines; + materials[18505] = Material.TwistingVinesPlant; + for (int i = 23709; i <= 23711; i++) + materials[i] = Material.VerdantFroglight; + for (int i = 6833; i <= 6864; i++) + materials[i] = Material.Vine; + materials[12799] = Material.VoidAir; + for (int i = 2352; i <= 2355; i++) + materials[i] = Material.WallTorch; + for (int i = 18965; i <= 18988; i++) + materials[i] = Material.WarpedButton; + for (int i = 19053; i <= 19116; i++) + materials[i] = Material.WarpedDoor; + for (int i = 18557; i <= 18588; i++) + materials[i] = Material.WarpedFence; + for (int i = 18749; i <= 18780; i++) + materials[i] = Material.WarpedFenceGate; + materials[18433] = Material.WarpedFungus; + for (int i = 5342; i <= 5405; i++) + materials[i] = Material.WarpedHangingSign; + for (int i = 18426; i <= 18428; i++) + materials[i] = Material.WarpedHyphae; + materials[18432] = Material.WarpedNylium; + materials[18508] = Material.WarpedPlanks; + for (int i = 18523; i <= 18524; i++) + materials[i] = Material.WarpedPressurePlate; + materials[18435] = Material.WarpedRoots; + for (int i = 19149; i <= 19180; i++) + materials[i] = Material.WarpedSign; + for (int i = 18515; i <= 18520; i++) + materials[i] = Material.WarpedSlab; + for (int i = 18861; i <= 18940; i++) + materials[i] = Material.WarpedStairs; + for (int i = 18420; i <= 18422; i++) + materials[i] = Material.WarpedStem; + for (int i = 18653; i <= 18716; i++) + materials[i] = Material.WarpedTrapdoor; + for (int i = 5606; i <= 5613; i++) + materials[i] = Material.WarpedWallHangingSign; + for (int i = 19189; i <= 19196; i++) + materials[i] = Material.WarpedWallSign; + materials[18434] = Material.WarpedWartBlock; + for (int i = 80; i <= 95; i++) + materials[i] = Material.Water; + for (int i = 7395; i <= 7397; i++) + materials[i] = Material.WaterCauldron; + materials[21515] = Material.WaxedCopperBlock; + materials[21522] = Material.WaxedCutCopper; + for (int i = 21861; i <= 21866; i++) + materials[i] = Material.WaxedCutCopperSlab; + for (int i = 21763; i <= 21842; i++) + materials[i] = Material.WaxedCutCopperStairs; + materials[21517] = Material.WaxedExposedCopper; + materials[21521] = Material.WaxedExposedCutCopper; + for (int i = 21855; i <= 21860; i++) + materials[i] = Material.WaxedExposedCutCopperSlab; + for (int i = 21683; i <= 21762; i++) + materials[i] = Material.WaxedExposedCutCopperStairs; + materials[21518] = Material.WaxedOxidizedCopper; + materials[21519] = Material.WaxedOxidizedCutCopper; + for (int i = 21843; i <= 21848; i++) + materials[i] = Material.WaxedOxidizedCutCopperSlab; + for (int i = 21523; i <= 21602; i++) + materials[i] = Material.WaxedOxidizedCutCopperStairs; + materials[21516] = Material.WaxedWeatheredCopper; + materials[21520] = Material.WaxedWeatheredCutCopper; + for (int i = 21849; i <= 21854; i++) + materials[i] = Material.WaxedWeatheredCutCopperSlab; + for (int i = 21603; i <= 21682; i++) + materials[i] = Material.WaxedWeatheredCutCopperStairs; + materials[21162] = Material.WeatheredCopper; + materials[21168] = Material.WeatheredCutCopper; + for (int i = 21497; i <= 21502; i++) + materials[i] = Material.WeatheredCutCopperSlab; + for (int i = 21251; i <= 21330; i++) + materials[i] = Material.WeatheredCutCopperStairs; + for (int i = 18452; i <= 18477; i++) + materials[i] = Material.WeepingVines; + materials[18478] = Material.WeepingVinesPlant; + materials[514] = Material.WetSponge; + for (int i = 4274; i <= 4281; i++) + materials[i] = Material.Wheat; + for (int i = 10614; i <= 10629; i++) + materials[i] = Material.WhiteBanner; + for (int i = 1684; i <= 1699; i++) + materials[i] = Material.WhiteBed; + for (int i = 20582; i <= 20597; i++) + materials[i] = Material.WhiteCandle; + for (int i = 20840; i <= 20841; i++) + materials[i] = Material.WhiteCandleCake; + materials[10583] = Material.WhiteCarpet; + materials[12572] = Material.WhiteConcrete; + materials[12588] = Material.WhiteConcretePowder; + for (int i = 12508; i <= 12511; i++) + materials[i] = Material.WhiteGlazedTerracotta; + for (int i = 12412; i <= 12417; i++) + materials[i] = Material.WhiteShulkerBox; + materials[5942] = Material.WhiteStainedGlass; + for (int i = 9228; i <= 9259; i++) + materials[i] = Material.WhiteStainedGlassPane; + materials[9212] = Material.WhiteTerracotta; + materials[2079] = Material.WhiteTulip; + for (int i = 10870; i <= 10873; i++) + materials[i] = Material.WhiteWallBanner; + materials[2043] = Material.WhiteWool; + materials[2083] = Material.WitherRose; + for (int i = 8843; i <= 8858; i++) + materials[i] = Material.WitherSkeletonSkull; + for (int i = 8859; i <= 8862; i++) + materials[i] = Material.WitherSkeletonWallSkull; + for (int i = 10678; i <= 10693; i++) + materials[i] = Material.YellowBanner; + for (int i = 1748; i <= 1763; i++) + materials[i] = Material.YellowBed; + for (int i = 20646; i <= 20661; i++) + materials[i] = Material.YellowCandle; + for (int i = 20848; i <= 20849; i++) + materials[i] = Material.YellowCandleCake; + materials[10587] = Material.YellowCarpet; + materials[12576] = Material.YellowConcrete; + materials[12592] = Material.YellowConcretePowder; + for (int i = 12524; i <= 12527; i++) + materials[i] = Material.YellowGlazedTerracotta; + for (int i = 12436; i <= 12441; i++) + materials[i] = Material.YellowShulkerBox; + materials[5946] = Material.YellowStainedGlass; + for (int i = 9356; i <= 9387; i++) + materials[i] = Material.YellowStainedGlassPane; + materials[9216] = Material.YellowTerracotta; + for (int i = 10886; i <= 10889; i++) + materials[i] = Material.YellowWallBanner; + materials[2047] = Material.YellowWool; + for (int i = 8863; i <= 8878; i++) + materials[i] = Material.ZombieHead; + for (int i = 8879; i <= 8882; i++) + materials[i] = Material.ZombieWallHead; + } + + protected override Dictionary GetDict() + { + return materials; + } + } +} diff --git a/MinecraftClient/Mapping/EntityMetaDataType.cs b/MinecraftClient/Mapping/EntityMetaDataType.cs new file mode 100644 index 00000000..e435c40d --- /dev/null +++ b/MinecraftClient/Mapping/EntityMetaDataType.cs @@ -0,0 +1,73 @@ +namespace MinecraftClient.Mapping; + +public enum EntityMetaDataType +{ + Byte, + VarInt, + VarLong, + Float, + String, + Chat, + OptionalChat, + Slot, + Boolean, + /// + /// Float x3 + /// + Rotation, + Position, + OptionalPosition, + /// + /// VarInt + /// + Direction, + OptionalUuid, + /// + /// VarInt + /// + BlockId, + /// + /// VarInt (0 for absent) + /// + OptionalBlockId, + Nbt, + Particle, + /// + /// VarInt x3 + /// + VillagerData, + OptionalVarInt, + /// + /// VarInt + /// + Pose, + /// + /// VarInt + /// + CatVariant, + FrogVariant, + /// + /// String + Position + /// + GlobalPosition, + /// + /// Boolean + String + Position + /// + OptionalGlobalPosition, + /// + /// VarInt + /// + PaintingVariant, + /// + /// VarInt + /// + SnifferState, + /// + /// Float x3 + /// + Vector3, + /// + /// Float x4 + /// + Quaternion +} \ No newline at end of file diff --git a/MinecraftClient/Mapping/EntityMetadataPalette.cs b/MinecraftClient/Mapping/EntityMetadataPalette.cs new file mode 100644 index 00000000..bcb0b52a --- /dev/null +++ b/MinecraftClient/Mapping/EntityMetadataPalette.cs @@ -0,0 +1,32 @@ +using MinecraftClient.Mapping.EntityMetadataPalettes; +using MinecraftClient.Protocol.Handlers; +using System; +using System.Collections.Generic; + +namespace MinecraftClient.Mapping; + +public abstract class EntityMetadataPalette +{ + public abstract Dictionary GetEntityMetadataMappingsList(); + + public EntityMetaDataType GetDataType(int typeId) + { + return GetEntityMetadataMappingsList()[typeId]; + } + + public static EntityMetadataPalette GetPalette(int protocolVersion) + { + if (protocolVersion < Protocol18Handler.MC_1_9_Version) + throw new NotImplementedException(); + else if (protocolVersion <= Protocol18Handler.MC_1_12_2_Version) + return new EntityMetadataPalette1122(); // 1.9 - 1.12.2 + else if (protocolVersion <= Protocol18Handler.MC_1_19_2_Version) + return new EntityMetadataPalette1191(); // 1.13 - 1.19.2 + else if (protocolVersion <= Protocol18Handler.MC_1_19_3_Version) + return new EntityMetadataPalette1193(); // 1.19.3 + else if (protocolVersion <= Protocol18Handler.MC_1_19_4_Version) + return new EntityMetadataPalette1194(); // 1.19.4 + else + throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/MinecraftClient/Mapping/EntityMetadataPalettes/EntityMetadataPalette1122.cs b/MinecraftClient/Mapping/EntityMetadataPalettes/EntityMetadataPalette1122.cs new file mode 100644 index 00000000..1bb24765 --- /dev/null +++ b/MinecraftClient/Mapping/EntityMetadataPalettes/EntityMetadataPalette1122.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; + +namespace MinecraftClient.Mapping.EntityMetadataPalettes; + +public class EntityMetadataPalette1122 : EntityMetadataPalette +{ + // 1.9 - 1.12.2 + private readonly Dictionary entityMetadataMappings = new() + { + { 0, EntityMetaDataType.Byte }, + { 1, EntityMetaDataType.VarInt }, + { 2, EntityMetaDataType.Float }, + { 3, EntityMetaDataType.String }, + { 4, EntityMetaDataType.Chat }, + { 5, EntityMetaDataType.Slot }, + { 6, EntityMetaDataType.Boolean }, + { 7, EntityMetaDataType.Rotation }, + { 8, EntityMetaDataType.Position }, + { 9, EntityMetaDataType.OptionalPosition }, + { 10, EntityMetaDataType.Direction }, + { 11, EntityMetaDataType.OptionalUuid }, + { 12, EntityMetaDataType.OptionalBlockId }, + { 13, EntityMetaDataType.Nbt }, + }; + + public override Dictionary GetEntityMetadataMappingsList() + { + return entityMetadataMappings; + } +} \ No newline at end of file diff --git a/MinecraftClient/Mapping/EntityMetadataPalettes/EntityMetadataPalette1191.cs b/MinecraftClient/Mapping/EntityMetadataPalettes/EntityMetadataPalette1191.cs new file mode 100644 index 00000000..bea16c9a --- /dev/null +++ b/MinecraftClient/Mapping/EntityMetadataPalettes/EntityMetadataPalette1191.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; + +namespace MinecraftClient.Mapping.EntityMetadataPalettes; + +/// +/// 1.13 - 1.19.2 +/// +public class EntityMetadataPalette1191 : EntityMetadataPalette +{ + private readonly Dictionary entityMetadataMappings = new() + { + { 0, EntityMetaDataType.Byte }, + { 1, EntityMetaDataType.VarInt }, + { 2, EntityMetaDataType.Float }, + { 3, EntityMetaDataType.String }, + { 4, EntityMetaDataType.Chat }, + { 5, EntityMetaDataType.OptionalChat }, + { 6, EntityMetaDataType.Slot }, + { 7, EntityMetaDataType.Boolean }, + { 8, EntityMetaDataType.Rotation }, + { 9, EntityMetaDataType.Position }, + { 10, EntityMetaDataType.OptionalPosition }, + { 11, EntityMetaDataType.Direction }, + { 12, EntityMetaDataType.OptionalUuid }, + { 13, EntityMetaDataType.OptionalBlockId }, + { 14, EntityMetaDataType.Nbt }, + { 15, EntityMetaDataType.Particle }, + { 16, EntityMetaDataType.VillagerData }, + { 17, EntityMetaDataType.OptionalVarInt }, + { 18, EntityMetaDataType.Pose }, + { 19, EntityMetaDataType.CatVariant }, + { 20, EntityMetaDataType.FrogVariant }, + { 21, EntityMetaDataType.OptionalGlobalPosition }, + { 22, EntityMetaDataType.PaintingVariant } + }; + + public override Dictionary GetEntityMetadataMappingsList() + { + return entityMetadataMappings; + } +} \ No newline at end of file diff --git a/MinecraftClient/Mapping/EntityMetadataPalettes/EntityMetadataPalette1193.cs b/MinecraftClient/Mapping/EntityMetadataPalettes/EntityMetadataPalette1193.cs new file mode 100644 index 00000000..b6dffe4c --- /dev/null +++ b/MinecraftClient/Mapping/EntityMetadataPalettes/EntityMetadataPalette1193.cs @@ -0,0 +1,42 @@ +using System.Collections.Generic; + +namespace MinecraftClient.Mapping.EntityMetadataPalettes; + +/// +/// For 1.19.3 +/// +public class EntityMetadataPalette1193 : EntityMetadataPalette +{ + private readonly Dictionary entityMetadataMappings = new() + { + { 0, EntityMetaDataType.Byte }, + { 1, EntityMetaDataType.VarInt }, + { 2, EntityMetaDataType.VarLong }, + { 3, EntityMetaDataType.Float }, + { 4, EntityMetaDataType.String }, + { 5, EntityMetaDataType.Chat }, + { 6, EntityMetaDataType.OptionalChat }, + { 7, EntityMetaDataType.Slot }, + { 8, EntityMetaDataType.Boolean }, + { 9, EntityMetaDataType.Rotation }, + { 10, EntityMetaDataType.Position }, + { 11, EntityMetaDataType.OptionalPosition }, + { 12, EntityMetaDataType.Direction }, + { 13, EntityMetaDataType.OptionalUuid }, + { 14, EntityMetaDataType.OptionalBlockId }, + { 15, EntityMetaDataType.Nbt }, + { 16, EntityMetaDataType.Particle }, + { 17, EntityMetaDataType.VillagerData }, + { 18, EntityMetaDataType.OptionalVarInt }, + { 19, EntityMetaDataType.Pose }, + { 20, EntityMetaDataType.CatVariant }, + { 21, EntityMetaDataType.FrogVariant }, + { 22, EntityMetaDataType.OptionalGlobalPosition }, + { 23, EntityMetaDataType.PaintingVariant } + }; + + public override Dictionary GetEntityMetadataMappingsList() + { + return entityMetadataMappings; + } +} \ No newline at end of file diff --git a/MinecraftClient/Mapping/EntityMetadataPalettes/EntityMetadataPalette1194.cs b/MinecraftClient/Mapping/EntityMetadataPalettes/EntityMetadataPalette1194.cs new file mode 100644 index 00000000..2ac0e467 --- /dev/null +++ b/MinecraftClient/Mapping/EntityMetadataPalettes/EntityMetadataPalette1194.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; + +namespace MinecraftClient.Mapping.EntityMetadataPalettes; + +/// +/// For 1.19.4 +/// +public class EntityMetadataPalette1194 : EntityMetadataPalette +{ + private readonly Dictionary entityMetadataMappings = new() + { + { 0, EntityMetaDataType.Byte }, + { 1, EntityMetaDataType.VarInt }, + { 2, EntityMetaDataType.VarLong }, + { 3, EntityMetaDataType.Float }, + { 4, EntityMetaDataType.String }, + { 5, EntityMetaDataType.Chat }, + { 6, EntityMetaDataType.OptionalChat }, + { 7, EntityMetaDataType.Slot }, + { 8, EntityMetaDataType.Boolean }, + { 9, EntityMetaDataType.Rotation }, + { 10, EntityMetaDataType.Position }, + { 11, EntityMetaDataType.OptionalPosition }, + { 12, EntityMetaDataType.Direction }, + { 13, EntityMetaDataType.OptionalUuid }, + { 14, EntityMetaDataType.BlockId }, + { 15, EntityMetaDataType.OptionalBlockId }, + { 16, EntityMetaDataType.Nbt }, + { 17, EntityMetaDataType.Particle }, + { 18, EntityMetaDataType.VillagerData }, + { 19, EntityMetaDataType.OptionalVarInt }, + { 20, EntityMetaDataType.Pose }, + { 21, EntityMetaDataType.CatVariant }, + { 22, EntityMetaDataType.FrogVariant }, + { 23, EntityMetaDataType.OptionalGlobalPosition }, + { 24, EntityMetaDataType.PaintingVariant }, + { 25, EntityMetaDataType.SnifferState }, + { 26, EntityMetaDataType.Vector3 }, + { 27, EntityMetaDataType.Quaternion }, + }; + + public override Dictionary GetEntityMetadataMappingsList() + { + return entityMetadataMappings; + } +} \ No newline at end of file diff --git a/MinecraftClient/Mapping/EntityMetadataPalettes/EntityMetadataPalette19.cs b/MinecraftClient/Mapping/EntityMetadataPalettes/EntityMetadataPalette19.cs new file mode 100644 index 00000000..39cd4963 --- /dev/null +++ b/MinecraftClient/Mapping/EntityMetadataPalettes/EntityMetadataPalette19.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; + +namespace MinecraftClient.Mapping.EntityMetadataPalettes; + +// TODO: Use this for 1.8 +public class EntityMetadataPalette19 : EntityMetadataPalette +{ + // 1.8 : https://wiki.vg/index.php?title=Entity_metadata&oldid=6220 (Requires a different algorithm) + // 1.9 : https://wiki.vg/index.php?title=Entity_metadata&oldid=7416 + private readonly Dictionary entityMetadataMappings = new() + { + { 0, EntityMetaDataType.Byte }, + { 1, EntityMetaDataType.VarInt }, + { 2, EntityMetaDataType.Float }, + { 3, EntityMetaDataType.String }, + { 4, EntityMetaDataType.Chat }, + { 5, EntityMetaDataType.Slot }, + { 6, EntityMetaDataType.Boolean }, + { 7, EntityMetaDataType.Vector3 }, + { 8, EntityMetaDataType.Position }, + { 9, EntityMetaDataType.OptionalPosition }, + { 10, EntityMetaDataType.Direction }, + { 11, EntityMetaDataType.OptionalUuid }, + { 12, EntityMetaDataType.OptionalBlockId } + }; + + public override Dictionary GetEntityMetadataMappingsList() + { + return entityMetadataMappings; + } +} \ No newline at end of file diff --git a/MinecraftClient/Mapping/EntityPalettes/EntityPalette11194.cs b/MinecraftClient/Mapping/EntityPalettes/EntityPalette11194.cs new file mode 100644 index 00000000..c715e07a --- /dev/null +++ b/MinecraftClient/Mapping/EntityPalettes/EntityPalette11194.cs @@ -0,0 +1,142 @@ +using System.Collections.Generic; + +namespace MinecraftClient.Mapping.EntityPalettes +{ + public class EntityPalette1194 : EntityPalette + { + private static readonly Dictionary mappings = new(); + + static EntityPalette1194() + { + 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.BlockDisplay; + mappings[9] = EntityType.Boat; + mappings[10] = EntityType.Camel; + mappings[11] = EntityType.Cat; + mappings[12] = EntityType.CaveSpider; + mappings[13] = EntityType.ChestBoat; + mappings[14] = EntityType.ChestMinecart; + mappings[15] = EntityType.Chicken; + mappings[16] = EntityType.Cod; + mappings[17] = EntityType.CommandBlockMinecart; + mappings[18] = EntityType.Cow; + mappings[19] = EntityType.Creeper; + mappings[20] = EntityType.Dolphin; + mappings[21] = EntityType.Donkey; + mappings[22] = EntityType.DragonFireball; + mappings[23] = EntityType.Drowned; + mappings[24] = EntityType.Egg; + mappings[25] = EntityType.ElderGuardian; + mappings[26] = EntityType.EndCrystal; + mappings[27] = EntityType.EnderDragon; + mappings[28] = EntityType.EnderPearl; + mappings[29] = EntityType.Enderman; + mappings[30] = EntityType.Endermite; + mappings[31] = EntityType.Evoker; + mappings[32] = EntityType.EvokerFangs; + mappings[33] = EntityType.ExperienceBottle; + mappings[34] = EntityType.ExperienceOrb; + mappings[35] = EntityType.EyeOfEnder; + mappings[36] = EntityType.FallingBlock; + mappings[57] = EntityType.Fireball; + mappings[37] = EntityType.FireworkRocket; + mappings[123] = EntityType.FishingBobber; + mappings[38] = EntityType.Fox; + mappings[39] = EntityType.Frog; + mappings[40] = EntityType.FurnaceMinecart; + mappings[41] = EntityType.Ghast; + mappings[42] = EntityType.Giant; + mappings[43] = EntityType.GlowItemFrame; + mappings[44] = EntityType.GlowSquid; + mappings[45] = EntityType.Goat; + mappings[46] = EntityType.Guardian; + mappings[47] = EntityType.Hoglin; + mappings[48] = EntityType.HopperMinecart; + mappings[49] = EntityType.Horse; + mappings[50] = EntityType.Husk; + mappings[51] = EntityType.Illusioner; + mappings[52] = EntityType.Interaction; + mappings[53] = EntityType.IronGolem; + mappings[54] = EntityType.Item; + mappings[55] = EntityType.ItemDisplay; + mappings[56] = EntityType.ItemFrame; + mappings[58] = EntityType.LeashKnot; + mappings[59] = EntityType.LightningBolt; + mappings[60] = EntityType.Llama; + mappings[61] = EntityType.LlamaSpit; + mappings[62] = EntityType.MagmaCube; + mappings[63] = EntityType.Marker; + mappings[64] = EntityType.Minecart; + mappings[65] = EntityType.Mooshroom; + mappings[66] = EntityType.Mule; + mappings[67] = EntityType.Ocelot; + mappings[68] = EntityType.Painting; + mappings[69] = EntityType.Panda; + mappings[70] = EntityType.Parrot; + mappings[71] = EntityType.Phantom; + mappings[72] = EntityType.Pig; + mappings[73] = EntityType.Piglin; + mappings[74] = EntityType.PiglinBrute; + mappings[75] = EntityType.Pillager; + mappings[122] = EntityType.Player; + mappings[76] = EntityType.PolarBear; + mappings[77] = EntityType.Potion; + mappings[78] = EntityType.Pufferfish; + mappings[79] = EntityType.Rabbit; + mappings[80] = EntityType.Ravager; + mappings[81] = EntityType.Salmon; + mappings[82] = EntityType.Sheep; + mappings[83] = EntityType.Shulker; + mappings[84] = EntityType.ShulkerBullet; + mappings[85] = EntityType.Silverfish; + mappings[86] = EntityType.Skeleton; + mappings[87] = EntityType.SkeletonHorse; + mappings[88] = EntityType.Slime; + mappings[89] = EntityType.SmallFireball; + mappings[90] = EntityType.Sniffer; + mappings[91] = EntityType.SnowGolem; + mappings[92] = EntityType.Snowball; + mappings[93] = EntityType.SpawnerMinecart; + mappings[94] = EntityType.SpectralArrow; + mappings[95] = EntityType.Spider; + mappings[96] = EntityType.Squid; + mappings[97] = EntityType.Stray; + mappings[98] = EntityType.Strider; + mappings[99] = EntityType.Tadpole; + mappings[100] = EntityType.TextDisplay; + mappings[101] = EntityType.Tnt; + mappings[102] = EntityType.TntMinecart; + mappings[103] = EntityType.TraderLlama; + mappings[104] = EntityType.Trident; + mappings[105] = EntityType.TropicalFish; + mappings[106] = EntityType.Turtle; + mappings[107] = EntityType.Vex; + mappings[108] = EntityType.Villager; + mappings[109] = EntityType.Vindicator; + mappings[110] = EntityType.WanderingTrader; + mappings[111] = EntityType.Warden; + mappings[112] = EntityType.Witch; + mappings[113] = EntityType.Wither; + mappings[114] = EntityType.WitherSkeleton; + mappings[115] = EntityType.WitherSkull; + mappings[116] = EntityType.Wolf; + mappings[117] = EntityType.Zoglin; + mappings[118] = EntityType.Zombie; + mappings[119] = EntityType.ZombieHorse; + mappings[120] = EntityType.ZombieVillager; + mappings[121] = EntityType.ZombifiedPiglin; + } + + protected override Dictionary GetDict() + { + return mappings; + } + } +} diff --git a/MinecraftClient/Mapping/EntityType.cs b/MinecraftClient/Mapping/EntityType.cs index 4351de3c..8b697e5f 100644 --- a/MinecraftClient/Mapping/EntityType.cs +++ b/MinecraftClient/Mapping/EntityType.cs @@ -22,6 +22,7 @@ Bat, Bee, Blaze, + BlockDisplay, Boat, Camel, Cat, @@ -67,8 +68,10 @@ Horse, Husk, Illusioner, + Interaction, IronGolem, Item, + ItemDisplay, ItemFrame, LeashKnot, LightningBolt, @@ -103,6 +106,7 @@ SkeletonHorse, Slime, SmallFireball, + Sniffer, SnowGolem, Snowball, SpawnerMinecart, @@ -112,6 +116,7 @@ Stray, Strider, Tadpole, + TextDisplay, Tnt, TntMinecart, TraderLlama, diff --git a/MinecraftClient/Mapping/Material.cs b/MinecraftClient/Mapping/Material.cs index f0023009..4c47e63b 100644 --- a/MinecraftClient/Mapping/Material.cs +++ b/MinecraftClient/Mapping/Material.cs @@ -177,6 +177,23 @@ CaveVinesPlant, Chain, ChainCommandBlock, + CherryButton, + CherryDoor, + CherryFence, + CherryFenceGate, + CherryHangingSign, + CherryLeaves, + CherryLog, + CherryPlanks, + CherryPressurePlate, + CherrySapling, + CherrySign, + CherrySlab, + CherryStairs, + CherryTrapdoor, + CherryWallHangingSign, + CherryWallSign, + CherryWood, Chest, ChippedAnvil, ChiseledBookshelf, @@ -302,6 +319,7 @@ DeadTubeCoralBlock, DeadTubeCoralFan, DeadTubeCoralWallFan, + DecoratedPot, Deepslate, DeepslateBrickSlab, DeepslateBrickStairs, @@ -638,6 +656,7 @@ PinkConcrete, PinkConcretePowder, PinkGlazedTerracotta, + PinkPetals, PinkShulkerBox, PinkStainedGlass, PinkStainedGlassPane, @@ -686,6 +705,7 @@ PottedBlueOrchid, PottedBrownMushroom, PottedCactus, + PottedCherrySapling, PottedCornflower, PottedCrimsonFungus, PottedCrimsonRoots, @@ -705,6 +725,7 @@ PottedRedMushroom, PottedRedTulip, PottedSpruceSapling, + PottedTorchflower, PottedWarpedFungus, PottedWarpedRoots, PottedWhiteTulip, @@ -866,6 +887,8 @@ StrippedBambooBlock, StrippedBirchLog, StrippedBirchWood, + StrippedCherryLog, + StrippedCherryWood, StrippedCrimsonHyphae, StrippedCrimsonStem, StrippedDarkOakLog, @@ -884,6 +907,7 @@ StructureVoid, SugarCane, Sunflower, + SuspiciousSand, SweetBerryBush, TallGrass, TallSeagrass, @@ -892,6 +916,8 @@ TintedGlass, Tnt, Torch, + Torchflower, + TorchflowerCrop, TrappedChest, Tripwire, TripwireHook, diff --git a/MinecraftClient/McClient.cs b/MinecraftClient/McClient.cs index fa94d196..df2f9cf4 100644 --- a/MinecraftClient/McClient.cs +++ b/MinecraftClient/McClient.cs @@ -2634,11 +2634,41 @@ namespace MinecraftClient List links = new(); string messageText; + // Used for 1.19+ to mark: system message, legal / illegal signature + string color = string.Empty; + if (message.isSignedChat) { if (!Config.Signature.ShowIllegalSignedChat && !message.isSystemChat && !(bool)message.isSignatureLegal!) return; messageText = ChatParser.ParseSignedChat(message, links); + + if (message.isSystemChat) + { + if (Config.Signature.MarkSystemMessage) + color = "§7▌§r"; // Background Gray + } + else + { + if ((bool)message.isSignatureLegal!) + { + if (Config.Signature.ShowModifiedChat && message.unsignedContent != null) + { + if (Config.Signature.MarkModifiedMsg) + color = "§6▌§r"; // Background Yellow + } + else + { + if (Config.Signature.MarkLegallySignedMsg) + color = "§2▌§r"; // Background Green + } + } + else + { + if (Config.Signature.MarkIllegallySignedMsg) + color = "§4▌§r"; // Background Red + } + } } else { @@ -2648,7 +2678,7 @@ namespace MinecraftClient messageText = message.content; } - Log.Chat(messageText); + Log.Chat(color + messageText); if (Config.Main.Advanced.ShowChatLinks) foreach (string link in links) diff --git a/MinecraftClient/Program.cs b/MinecraftClient/Program.cs index dd9dcbc0..06265949 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.3"; + public const string MCHighestVersion = "1.19.4"; public static readonly string? BuildInfo = null; private static Tuple? offlinePrompt = null; diff --git a/MinecraftClient/Protocol/Handlers/DataTypes.cs b/MinecraftClient/Protocol/Handlers/DataTypes.cs index 716312ec..1300b1eb 100644 --- a/MinecraftClient/Protocol/Handlers/DataTypes.cs +++ b/MinecraftClient/Protocol/Handlers/DataTypes.cs @@ -188,6 +188,7 @@ namespace MinecraftClient.Protocol.Handlers y = (int)((locEncoded >> 26) & 0xFFF); z = (int)(locEncoded << 38 >> 38); } + if (x >= 0x02000000) // 33,554,432 x -= 0x04000000; // 67,108,864 if (y >= 0x00000800) // 2,048 @@ -309,6 +310,7 @@ namespace MinecraftClient.Protocol.Handlers if (j > 5) throw new OverflowException("VarInt too big"); if ((b & 0x80) != 128) break; } + return i; } @@ -329,6 +331,7 @@ namespace MinecraftClient.Protocol.Handlers i |= (b & 0x7F) << j++ * 7; if (j > 5) throw new OverflowException("VarInt too big"); } while ((b & 0x80) == 128); + return i; } @@ -360,6 +363,7 @@ namespace MinecraftClient.Protocol.Handlers low &= 0x7FFF; high = ReadNextByte(cache); } + return ((high & 0xFF) << 15) | low; } @@ -385,6 +389,7 @@ namespace MinecraftClient.Protocol.Handlers throw new OverflowException("VarLong is too big"); } } while ((read & 0x80) != 0); + return result; } @@ -413,13 +418,18 @@ namespace MinecraftClient.Protocol.Handlers /// The item that was read or NULL for an empty slot public Item? ReadNextItemSlot(Queue cache, ItemPalette itemPalette) { + // MC 1.13.2 and greater if (protocolversion > Protocol18Handler.MC_1_13_Version) { - // MC 1.13 and greater bool itemPresent = ReadNextBool(cache); if (itemPresent) { - ItemType type = itemPalette.FromId(ReadNextVarInt(cache)); + int itemID = ReadNextVarInt(cache); + + if (itemID == -1) + return null; + + ItemType type = itemPalette.FromId(itemID); byte itemCount = ReadNextByte(cache); Dictionary nbt = ReadNextNbt(cache); return new Item(type, itemCount, nbt); @@ -428,12 +438,17 @@ namespace MinecraftClient.Protocol.Handlers } else { - // MC 1.12.2 and lower + // MC 1.13 and lower short itemID = ReadNextShort(cache); + if (itemID == -1) return null; + byte itemCount = ReadNextByte(cache); - short itemDamage = ReadNextShort(cache); + + if(protocolversion < Protocol18Handler.MC_1_13_Version) + ReadNextShort(cache); + Dictionary nbt = ReadNextNbt(cache); return new Item(itemPalette.FromId(itemID), itemCount, nbt); } @@ -487,7 +502,8 @@ namespace MinecraftClient.Protocol.Handlers short velocityY = ReadNextShort(cache); short velocityZ = ReadNextShort(cache); - return new Entity(entityID, entityType, new Location(entityX, entityY, entityZ), entityYaw, entityPitch, metadata); + return new Entity(entityID, entityType, new Location(entityX, entityY, entityZ), entityYaw, entityPitch, + metadata); } /// @@ -504,6 +520,7 @@ namespace MinecraftClient.Protocol.Handlers cache.Dequeue(); return nbtData; } + if (cache.Peek() != 10) // TAG_Compound throw new System.IO.InvalidDataException("Failed to decode NBT: Does not start with TAG_Compound"); ReadNextByte(cache); // Tag type (TAG_Compound) @@ -582,74 +599,62 @@ namespace MinecraftClient.Protocol.Handlers } } - public Dictionary ReadNextMetadata(Queue cache, ItemPalette itemPalette) + //TODO: Refactor this to use new Entity Metadata Palettes + public Dictionary ReadNextMetadata(Queue cache, ItemPalette itemPalette, EntityMetadataPalette metadataPalette) { + if (protocolversion <= Protocol18Handler.MC_1_8_Version) + throw new NotImplementedException(); // Require sepcial implementation + Dictionary data = new(); byte key = ReadNextByte(cache); while (key != 0xff) { - int type = ReadNextVarInt(cache); + int typeId = ReadNextVarInt(cache); + EntityMetaDataType type; + try + { + type = metadataPalette.GetDataType(typeId); + } + catch (KeyNotFoundException) + { + throw new System.IO.InvalidDataException("Unknown Metadata Type ID " + typeId + ". Is this up to date for new MC Version?"); + } // 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 - // - type ID larger than 4 - if (protocolversion < Protocol18Handler.MC_1_13_Version) - { - if (type > 4) - ++type; - } - else if (protocolversion >= Protocol18Handler.MC_1_19_3_Version) - { - if (type == 2) - { - value = ReadNextVarLong(cache); - type = -1; - } - else if (type >= 3) - { - --type; - } - } - - // 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 + case EntityMetaDataType.Byte: // byte value = ReadNextByte(cache); break; - case 1: // VarInt + case EntityMetaDataType.VarInt: // VarInt value = ReadNextVarInt(cache); break; - case 2: // Float + case EntityMetaDataType.VarLong: // Long + value = ReadNextVarLong(cache); + break; + case EntityMetaDataType.Float: // Float value = ReadNextFloat(cache); break; - case 3: // String + case EntityMetaDataType.String: // String value = ReadNextString(cache); break; - case 4: // Chat + case EntityMetaDataType.Chat: // Chat value = ReadNextString(cache); break; - case 5: // Optional Chat + case EntityMetaDataType.OptionalChat: // Optional Chat if (ReadNextBool(cache)) value = ReadNextString(cache); break; - case 6: // Slot + case EntityMetaDataType.Slot: // Slot value = ReadNextItemSlot(cache, itemPalette); break; - case 7: // Boolean + case EntityMetaDataType.Boolean: // Boolean value = ReadNextBool(cache); break; - case 8: // Rotation (3x floats) + case EntityMetaDataType.Rotation: // Rotation (3x floats) value = new List { ReadNextFloat(cache), @@ -657,103 +662,38 @@ namespace MinecraftClient.Protocol.Handlers ReadNextFloat(cache) }; break; - case 9: // Position + case EntityMetaDataType.Position: // Position value = ReadNextLocation(cache); break; - case 10: // Optional Position + case EntityMetaDataType.OptionalPosition: // Optional Position if (ReadNextBool(cache)) { value = ReadNextLocation(cache); } break; - case 11: // Direction (VarInt) + case EntityMetaDataType.Direction: // Direction (VarInt) value = ReadNextVarInt(cache); break; - case 12: // Optional UUID + case EntityMetaDataType.OptionalUuid: // Optional UUID if (ReadNextBool(cache)) { value = ReadNextUUID(cache); } break; - case 13: // Optional BlockID (VarInt) + case EntityMetaDataType.BlockId: // BlockID (VarInt) value = ReadNextVarInt(cache); break; - case 14: // NBT + case EntityMetaDataType.OptionalBlockId: // Optional BlockID (VarInt) + value = ReadNextVarInt(cache); + break; + case EntityMetaDataType.Nbt: // NBT value = ReadNextNbt(cache); break; - case 15: // Particle - // Currecutly not handled. Reading data only - int ParticleID = ReadNextVarInt(cache); - // Need to check the exact version where the change occurred!!!!! - if (protocolversion >= Protocol18Handler.MC_1_19_3_Version) - { - 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; - } - } + case EntityMetaDataType.Particle: // Particle + // Skip data only, not used + ReadParticleData(cache, itemPalette); break; - case 16: // Villager Data (3x VarInt) + case EntityMetaDataType.VillagerData: // Villager Data (3x VarInt) value = new List { ReadNextVarInt(cache), @@ -761,42 +701,223 @@ namespace MinecraftClient.Protocol.Handlers ReadNextVarInt(cache) }; break; - case 17: // Optional VarInt + case EntityMetaDataType.OptionalVarInt: // Optional VarInt if (ReadNextBool(cache)) { value = ReadNextVarInt(cache); } break; - case 18: // Pose + case EntityMetaDataType.Pose: // Pose value = ReadNextVarInt(cache); break; - case 19: // Cat Variant + case EntityMetaDataType.CatVariant: // Cat Variant value = ReadNextVarInt(cache); break; - case 20: // Frog Varint + case EntityMetaDataType.FrogVariant: // Frog Varint value = ReadNextVarInt(cache); break; - case 21: // GlobalPos at 1.19.2+; Painting Variant at 1.19- - if (protocolversion <= Protocol18Handler.MC_1_19_Version) - value = ReadNextVarInt(cache); - else + case EntityMetaDataType.GlobalPosition: // GlobalPos + // Dimension and blockPos, currently not in use + value = new Tuple(ReadNextString(cache), ReadNextLocation(cache)); + break; + case EntityMetaDataType.OptionalGlobalPosition: + // FIXME: wiki.vg is bool + string + location + // but minecraft-data is bool + string + if (ReadNextBool(cache)) { // Dimension and blockPos, currently not in use value = new Tuple(ReadNextString(cache), ReadNextLocation(cache)); } break; - case 22: // Painting Variant + case EntityMetaDataType.PaintingVariant: // Painting Variant value = ReadNextVarInt(cache); break; - default: - throw new System.IO.InvalidDataException("Unknown Metadata Type ID " + type + ". Is this up to date for new MC Version?"); + case EntityMetaDataType.SnifferState: // Sniffer state + value = ReadNextVarInt(cache); + break; + case EntityMetaDataType.Vector3: // Vector 3f + value = new List + { + ReadNextFloat(cache), + ReadNextFloat(cache), + ReadNextFloat(cache) + }; + break; + case EntityMetaDataType.Quaternion: // Quaternion + value = new List + { + ReadNextFloat(cache), + ReadNextFloat(cache), + ReadNextFloat(cache), + ReadNextFloat(cache) + }; + break; } + data[key] = value; key = ReadNextByte(cache); } return data; } + // Currently not handled. Reading data only + protected void ReadParticleData(Queue cache, ItemPalette itemPalette) + { + if (protocolversion < Protocol18Handler.MC_1_13_Version) + return; + + int ParticleID = ReadNextVarInt(cache); + + // Refernece: + // 1.19.3 - https://wiki.vg/index.php?title=Data_types&oldid=17986 + // 1.18 - https://wiki.vg/index.php?title=Data_types&oldid=17180 + // 1.17 - https://wiki.vg/index.php?title=Data_types&oldid=16740 + // 1.15 - https://wiki.vg/index.php?title=Data_types&oldid=15338 + // 1.13 - https://wiki.vg/index.php?title=Data_types&oldid=14271 + + switch (ParticleID) + { + case 2: + // 1.18 + + if (protocolversion > Protocol18Handler.MC_1_17_1_Version) + ReadNextVarInt(cache); // Block state (minecraft:block) + break; + case 3: + if (protocolversion < Protocol18Handler.MC_1_17_Version + || protocolversion > Protocol18Handler.MC_1_17_1_Version) + ReadNextVarInt(cache); // Block State (minecraft:block before 1.18, minecraft:block_marker after 1.18) + break; + case 4: + if (protocolversion == Protocol18Handler.MC_1_17_Version + || protocolversion == Protocol18Handler.MC_1_17_1_Version) + ReadNextVarInt(cache); // Block State (minecraft:block) + break; + case 11: + // 1.13 - 1.14.4 + if (protocolversion < Protocol18Handler.MC_1_15_Version) + ReadDustParticle(cache); + break; + case 14: + // 1.15 - 1.16.5 and 1.18 - 1.19.4 + if ((protocolversion >= Protocol18Handler.MC_1_15_Version && protocolversion < Protocol18Handler.MC_1_17_Version) + || protocolversion > Protocol18Handler.MC_1_17_1_Version) + ReadDustParticle(cache); + break; + case 15: + if (protocolversion == Protocol18Handler.MC_1_17_Version || protocolversion == Protocol18Handler.MC_1_17_1_Version) + ReadDustParticle(cache); + else + { + if (protocolversion > Protocol18Handler.MC_1_17_1_Version) + ReadDustParticleColorTransition(cache); + } + break; + case 16: + if (protocolversion == Protocol18Handler.MC_1_17_Version || protocolversion == Protocol18Handler.MC_1_17_1_Version) + ReadDustParticleColorTransition(cache); + break; + case 23: + // 1.15 - 1.16.5 + if (protocolversion >= Protocol18Handler.MC_1_15_Version && protocolversion < Protocol18Handler.MC_1_17_Version) + ReadNextVarInt(cache); // Block State (minecraft:falling_dust) + break; + case 24: + // 1.18 - 1.19.2 onwards + if (protocolversion > Protocol18Handler.MC_1_17_1_Version && protocolversion < Protocol18Handler.MC_1_19_3_Version) + ReadNextVarInt(cache); // Block State (minecraft:falling_dust) + break; + case 25: + // 1.17 - 1.17.1 and 1.19.3 onwards + if (protocolversion == Protocol18Handler.MC_1_17_Version + || protocolversion == Protocol18Handler.MC_1_17_1_Version + || protocolversion >= Protocol18Handler.MC_1_19_3_Version) + ReadNextVarInt(cache); // Block State (minecraft:falling_dust) + break; + case 27: + // 1.13 - 1.14.4 + if (protocolversion < Protocol18Handler.MC_1_15_Version) + ReadNextItemSlot(cache, itemPalette); // Item (minecraft:item) + break; + case 30: + if (protocolversion >= Protocol18Handler.MC_1_19_3_Version) + ReadNextFloat(cache); // Roll (minecraft:sculk_charge) + break; + case 32: + // 1.15 - 1.16.5 + if (protocolversion >= Protocol18Handler.MC_1_15_Version && protocolversion < Protocol18Handler.MC_1_17_Version) + ReadNextItemSlot(cache, itemPalette); // Item (minecraft:item) + break; + case 36: + // 1.17 - 1.17.1 + if (protocolversion == Protocol18Handler.MC_1_17_Version || protocolversion == Protocol18Handler.MC_1_17_1_Version) + { + ReadNextItemSlot(cache, itemPalette); // Item (minecraft:item) + } + else if (protocolversion > Protocol18Handler.MC_1_17_1_Version && protocolversion < Protocol18Handler.MC_1_19_3_Version) + { + // minecraft:vibration + ReadNextLocation(cache); // Origin (Starting Position) + ReadNextLocation(cache); // Desitination (Ending Position) + ReadNextVarInt(cache); // Ticks + } + break; + case 37: + // minecraft:vibration + if (protocolversion == Protocol18Handler.MC_1_17_Version + || protocolversion == Protocol18Handler.MC_1_17_1_Version) + { + ReadNextDouble(cache); // Origin X + ReadNextDouble(cache); // Origin Y + ReadNextDouble(cache); // Origin Z + ReadNextDouble(cache); // Destination X + ReadNextDouble(cache); // Destination Y + ReadNextDouble(cache); // Destination Z + ReadNextInt(cache); // Ticks + } + break; + case 39: + if (protocolversion >= Protocol18Handler.MC_1_19_3_Version) + ReadNextItemSlot(cache, itemPalette); // Item (minecraft:item) + break; + case 40: + if (protocolversion >= Protocol18Handler.MC_1_19_3_Version) + { + string positionSourceType = ReadNextString(cache); + if (positionSourceType == "minecraft:block") + { + ReadNextLocation(cache); + } + else if (positionSourceType == "minecraft:entity") + { + ReadNextVarInt(cache); + ReadNextFloat(cache); + } + + ReadNextVarInt(cache); + } + break; + } + } + + private void ReadDustParticle(Queue cache) + { + ReadNextFloat(cache); // Red + ReadNextFloat(cache); // Green + ReadNextFloat(cache); // Blue + ReadNextFloat(cache); // Scale + } + + private void ReadDustParticleColorTransition(Queue cache) + { + ReadNextFloat(cache); // From red + ReadNextFloat(cache); // From green + ReadNextFloat(cache); // From blue + ReadNextFloat(cache); // Scale + ReadNextFloat(cache); // To red + ReadNextFloat(cache); // To green + ReadNextFloat(cache); // To Blue + } + /// /// Read a single villager trade from a cache of bytes and remove it from the cache /// @@ -823,7 +944,8 @@ namespace MinecraftClient.Protocol.Handlers int specialPrice = ReadNextInt(cache); float priceMultiplier = ReadNextFloat(cache); int demand = ReadNextInt(cache); - return new VillagerTrade(inputItem1, outputItem, inputItem2, tradeDisabled, numberOfTradeUses, maximumNumberOfTradeUses, xp, specialPrice, priceMultiplier, demand); + return new VillagerTrade(inputItem1, outputItem, inputItem2, tradeDisabled, numberOfTradeUses, + maximumNumberOfTradeUses, xp, specialPrice, priceMultiplier, demand); } /// @@ -956,11 +1078,13 @@ namespace MinecraftClient.Protocol.Handlers subsequentItemsBytes.AddRange(GetNbtField(item, out byte subsequentItemType)); if (subsequentItemType != firstItemType) throw new System.IO.InvalidDataException( - "GetNbt: Cannot encode object[] list with mixed types: " + firstItemTypeString + ", " + item.GetType().Name + " into NBT!"); + "GetNbt: Cannot encode object[] list with mixed types: " + firstItemTypeString + ", " + + item.GetType().Name + " into NBT!"); } // Build NBT list: type, length, item array - return ConcatBytes(new[] { firstItemType }, GetInt(arrayLengthTotal), firstItemBytes, subsequentItemsBytes.ToArray()); + return ConcatBytes(new[] { firstItemType }, GetInt(arrayLengthTotal), firstItemBytes, + subsequentItemsBytes.ToArray()); } else if (obj is Dictionary) { @@ -1008,6 +1132,7 @@ namespace MinecraftClient.Protocol.Handlers bytes.Add((byte)(paramInt & 127 | 128)); paramInt = (int)(((uint)paramInt) >> 7); } + bytes.Add((byte)paramInt); return bytes.ToArray(); } @@ -1152,9 +1277,15 @@ namespace MinecraftClient.Protocol.Handlers byte[] locationBytes; if (protocolversion >= Protocol18Handler.MC_1_14_Version) { - locationBytes = BitConverter.GetBytes(((((ulong)location.X) & 0x3FFFFFF) << 38) | ((((ulong)location.Z) & 0x3FFFFFF) << 12) | (((ulong)location.Y) & 0xFFF)); + locationBytes = BitConverter.GetBytes(((((ulong)location.X) & 0x3FFFFFF) << 38) | + ((((ulong)location.Z) & 0x3FFFFFF) << 12) | + (((ulong)location.Y) & 0xFFF)); } - else locationBytes = BitConverter.GetBytes(((((ulong)location.X) & 0x3FFFFFF) << 38) | ((((ulong)location.Y) & 0xFFF) << 26) | (((ulong)location.Z) & 0x3FFFFFF)); + else + locationBytes = BitConverter.GetBytes(((((ulong)location.X) & 0x3FFFFFF) << 38) | + ((((ulong)location.Y) & 0xFFF) << 26) | + (((ulong)location.Z) & 0x3FFFFFF)); + Array.Reverse(locationBytes); //Endianness return locationBytes; } @@ -1193,6 +1324,7 @@ namespace MinecraftClient.Protocol.Handlers slotData.AddRange(GetNbt(item.NBT)); } } + return slotData.ToArray(); } @@ -1278,17 +1410,18 @@ namespace MinecraftClient.Protocol.Handlers public byte[] GetLastSeenMessageList(Message.LastSeenMessageList msgList, bool isOnlineMode) { if (!isOnlineMode) - return GetVarInt(0); // Message list size + return GetVarInt(0); // Message list size else { List fields = new(); - fields.AddRange(GetVarInt(msgList.entries.Length)); // Message list size + fields.AddRange(GetVarInt(msgList.entries.Length)); // Message list size foreach (Message.LastSeenMessageList.AcknowledgedMessage entry in msgList.entries) { - fields.AddRange(entry.profileId.ToBigEndianBytes()); // UUID - fields.AddRange(GetVarInt(entry.signature.Length)); // Signature length - fields.AddRange(entry.signature); // Signature data + fields.AddRange(entry.profileId.ToBigEndianBytes()); // UUID + fields.AddRange(GetVarInt(entry.signature.Length)); // Signature length + fields.AddRange(entry.signature); // Signature data } + return fields.ToArray(); } } @@ -1304,15 +1437,16 @@ namespace MinecraftClient.Protocol.Handlers List fields = new(); fields.AddRange(GetLastSeenMessageList(ack.lastSeen, isOnlineMode)); if (!isOnlineMode || ack.lastReceived == null) - fields.AddRange(GetBool(false)); // Has last received message + fields.AddRange(GetBool(false)); // Has last received message else { fields.AddRange(GetBool(true)); - fields.AddRange(ack.lastReceived.profileId.ToBigEndianBytes()); // Has last received message - fields.AddRange(GetVarInt(ack.lastReceived.signature.Length)); // Last received message signature length - fields.AddRange(ack.lastReceived.signature); // Last received message signature data + fields.AddRange(ack.lastReceived.profileId.ToBigEndianBytes()); // Has last received message + 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(); } } -} +} \ No newline at end of file diff --git a/MinecraftClient/Protocol/Handlers/PacketPalettes/PacketPalette1194.cs b/MinecraftClient/Protocol/Handlers/PacketPalettes/PacketPalette1194.cs new file mode 100644 index 00000000..6bf06c83 --- /dev/null +++ b/MinecraftClient/Protocol/Handlers/PacketPalettes/PacketPalette1194.cs @@ -0,0 +1,188 @@ +using System.Collections.Generic; + +namespace MinecraftClient.Protocol.Handlers.PacketPalettes +{ + public class PacketPalette1194 : PacketTypePalette + { + private readonly Dictionary typeIn = new() + { + { 0x00, PacketTypesIn.Bundle }, // Added in 1.19.4 + { 0x01, PacketTypesIn.SpawnEntity }, // Changed in 1.19 (Wiki name: Spawn Entity) + { 0x02, PacketTypesIn.SpawnExperienceOrb }, // (Wiki name: Spawn Exeprience Orb) + { 0x03, PacketTypesIn.SpawnPlayer }, // + { 0x04, PacketTypesIn.EntityAnimation }, // (Wiki name: Entity Animation (clientbound)) + { 0x05, PacketTypesIn.Statistics }, // (Wiki name: Award Statistics) + { 0x06, PacketTypesIn.BlockChangedAck }, // Added 1.19 (Wiki name: Acknowledge Block Change) + { 0x07, PacketTypesIn.BlockBreakAnimation }, // (Wiki name: Set Block Destroy Stage) + { 0x08, PacketTypesIn.BlockEntityData }, // + { 0x09, PacketTypesIn.BlockAction }, // + { 0x0A, PacketTypesIn.BlockChange }, // (Wiki name: Block Update) + { 0x0B, PacketTypesIn.BossBar }, // + { 0x0C, PacketTypesIn.ServerDifficulty }, // (Wiki name: Change Difficulty) + { 0x0D, PacketTypesIn.ChunksBiomes }, // Added in 1.19.4 + { 0x0E, PacketTypesIn.ClearTiles }, // + { 0x0F, PacketTypesIn.TabComplete }, // (Wiki name: Command Suggestions Response) + { 0x10, PacketTypesIn.DeclareCommands }, // (Wiki name: Commands) + { 0x11, PacketTypesIn.CloseWindow }, // (Wiki name: Close Container (clientbound)) + { 0x12, PacketTypesIn.WindowItems }, // (Wiki name: Set Container Content) + { 0x13, PacketTypesIn.WindowProperty }, // (Wiki name: Set Container Property) + { 0x14, PacketTypesIn.SetSlot }, // (Wiki name: Set Container Slot) + { 0x15, PacketTypesIn.SetCooldown }, // + { 0x16, PacketTypesIn.ChatSuggestions }, // Added in 1.19.1 + { 0x17, PacketTypesIn.PluginMessage }, // (Wiki name: Plugin Message (clientbound)) + { 0x18, PacketTypesIn.DamageEvent }, // Added in 1.19.4 + { 0x19, PacketTypesIn.HideMessage }, // Added in 1.19.1 + { 0x1A, PacketTypesIn.Disconnect }, // + { 0x1B, PacketTypesIn.ProfilelessChatMessage }, // Added in 1.19.3 (Wiki name: Disguised Chat Message) + { 0x1C, PacketTypesIn.EntityStatus }, // (Wiki name: Entity Event) + { 0x1D, PacketTypesIn.Explosion }, // Changed in 1.19 (Location fields are now Double instead of Float) (Wiki name: Explosion) + { 0x1E, PacketTypesIn.UnloadChunk }, // (Wiki name: Forget Chunk) + { 0x1F, PacketTypesIn.ChangeGameState }, // (Wiki name: Game Event) + { 0x20, PacketTypesIn.OpenHorseWindow }, // (Wiki name: Horse Screen Open) + { 0x21, PacketTypesIn.HurtAnimation }, // 1.19.4 + { 0x22, PacketTypesIn.InitializeWorldBorder }, // + { 0x23, PacketTypesIn.KeepAlive }, // + { 0x24, PacketTypesIn.ChunkData }, // + { 0x25, PacketTypesIn.Effect }, // (Wiki name: World Event) + { 0x26, 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) + { 0x27, PacketTypesIn.UpdateLight }, // (Wiki name: Light Update) + { 0x28, PacketTypesIn.JoinGame }, // Changed in 1.19 (lot's of changes) (Wiki name: Login (play)) + { 0x29, PacketTypesIn.MapData }, // (Wiki name: Map Item Data) + { 0x2A, PacketTypesIn.TradeList }, // (Wiki name: Merchant Offers) + { 0x2B, PacketTypesIn.EntityPosition }, // (Wiki name: Move Entity Position) + { 0x2C, PacketTypesIn.EntityPositionAndRotation }, // (Wiki name: Move Entity Position and Rotation) + { 0x2D, PacketTypesIn.EntityRotation }, // (Wiki name: Move Entity Rotation) + { 0x2E, PacketTypesIn.VehicleMove }, // (Wiki name: Move Vehicle) + { 0x2F, PacketTypesIn.OpenBook }, // + { 0x30, PacketTypesIn.OpenWindow }, // (Wiki name: Open Screen) + { 0x31, PacketTypesIn.OpenSignEditor }, // + { 0x32, PacketTypesIn.Ping }, // (Wiki name: Ping (play)) + { 0x33, PacketTypesIn.CraftRecipeResponse }, // (Wiki name: Place Ghost Recipe) + { 0x34, PacketTypesIn.PlayerAbilities }, // + { 0x35, PacketTypesIn.ChatMessage }, // Changed in 1.19 (Completely changed) (Wiki name: Player Chat Message) - TODO + { 0x36, PacketTypesIn.EndCombatEvent }, // (Wiki name: Player Combat End) + { 0x37, PacketTypesIn.EnterCombatEvent }, // (Wiki name: Player Combat Enter) + { 0x38, PacketTypesIn.DeathCombatEvent }, // (Wiki name: Player Combat Kill) + { 0x39, PacketTypesIn.PlayerRemove }, // Added in 1.19.3 (Not used) + { 0x3A, PacketTypesIn.PlayerInfo }, // Changed in 1.19 (Heavy changes) + { 0x3B, PacketTypesIn.FacePlayer }, // (Wiki name: Player Look At) + { 0x3C, PacketTypesIn.PlayerPositionAndLook }, // (Wiki name: Player Position) + { 0x3D, PacketTypesIn.UnlockRecipes }, // (Wiki name: Recipe) + { 0x3E, PacketTypesIn.DestroyEntities }, // (Wiki name: Remove Entites) + { 0x3F, PacketTypesIn.RemoveEntityEffect }, // + { 0x40, PacketTypesIn.ResourcePackSend }, // (Wiki name: Resource Pack) + { 0x41, PacketTypesIn.Respawn }, // Changed in 1.19 (Heavy changes) + { 0x42, PacketTypesIn.EntityHeadLook }, // (Wiki name: Rotate Head) + { 0x43, PacketTypesIn.MultiBlockChange }, // (Wiki name: Sections Block Update) + { 0x44, PacketTypesIn.SelectAdvancementTab }, // + { 0x45, PacketTypesIn.ServerData }, // Added in 1.19 + { 0x46, PacketTypesIn.ActionBar }, // (Wiki name: Set Action Bar Text) + { 0x47, PacketTypesIn.WorldBorderCenter }, // (Wiki name: Set Border Center) + { 0x48, PacketTypesIn.WorldBorderLerpSize }, // + { 0x49, PacketTypesIn.WorldBorderSize }, // (Wiki name: Set World Border Size) + { 0x4A, PacketTypesIn.WorldBorderWarningDelay }, // (Wiki name: Set World Border Warning Delay) + { 0x4B, PacketTypesIn.WorldBorderWarningReach }, // (Wiki name: Set Border Warning Distance) + { 0x4C, PacketTypesIn.Camera }, // (Wiki name: Set Camera) + { 0x4D, PacketTypesIn.HeldItemChange }, // (Wiki name: Set Carried Item (clientbound)) + { 0x4E, PacketTypesIn.UpdateViewPosition }, // (Wiki name: Set Chunk Cache Center) + { 0x4F, PacketTypesIn.UpdateViewDistance }, // (Wiki name: Set Chunk Cache Radius) + { 0x50, PacketTypesIn.SpawnPosition }, // (Wiki name: Set Default Spawn Position) + { 0x51, PacketTypesIn.DisplayScoreboard }, // (Wiki name: Set Display Objective) + { 0x52, PacketTypesIn.EntityMetadata }, // (Wiki name: Set Entity Metadata) + { 0x53, PacketTypesIn.AttachEntity }, // (Wiki name: Set Entity Link) + { 0x54, PacketTypesIn.EntityVelocity }, // (Wiki name: Set Entity Motion) + { 0x55, PacketTypesIn.EntityEquipment }, // (Wiki name: Set Equipment) + { 0x56, PacketTypesIn.SetExperience }, // + { 0x57, PacketTypesIn.UpdateHealth }, // (Wiki name: Set Health) + { 0x58, PacketTypesIn.ScoreboardObjective }, // (Wiki name: Set Objective) + { 0x59, PacketTypesIn.SetPassengers }, // + { 0x5A, PacketTypesIn.Teams }, // (Wiki name: Set Player Team) + { 0x5B, PacketTypesIn.UpdateScore }, // (Wiki name: Set Score) + { 0x5C, PacketTypesIn.UpdateSimulationDistance }, // (Wiki name: Set Simulation Distance) + { 0x5D, PacketTypesIn.SetTitleSubTitle }, // (Wiki name: Set Subtitle Test) + { 0x5E, PacketTypesIn.TimeUpdate }, // (Wiki name: Set Time) + { 0x5F, PacketTypesIn.SetTitleText }, // (Wiki name: Set Title) + { 0x60, PacketTypesIn.SetTitleTime }, // (Wiki name: Set Titles Animation) + { 0x61, PacketTypesIn.EntitySoundEffect }, // (Wiki name: Sound Entity) + { 0x62, PacketTypesIn.SoundEffect }, // Changed in 1.19 (Added "Seed" field) (Wiki name: Sound Effect) (No need to be implemented) + { 0x63, PacketTypesIn.StopSound }, // + { 0x64, PacketTypesIn.SystemChat }, // Added in 1.19 (Wiki name: System Chat Message) + { 0x65, PacketTypesIn.PlayerListHeaderAndFooter }, // (Wiki name: Tab List) + { 0x66, PacketTypesIn.NBTQueryResponse }, // (Wiki name: Tab Query) + { 0x67, PacketTypesIn.CollectItem }, // (Wiki name: Take Item Entity) + { 0x68, PacketTypesIn.EntityTeleport }, // (Wiki name: Teleport Entity) + { 0x69, PacketTypesIn.Advancements }, // (Wiki name: Update Advancements) + { 0x6A, PacketTypesIn.EntityProperties }, // (Wiki name: Update Attributes) + { 0x6B, PacketTypesIn.FeatureFlags }, // Added in 1.19.3 (Not yet clear what is the purpose of this packet) + { 0x6C, PacketTypesIn.EntityEffect }, // Changed in 1.19 (Added "Has Factor Data" and "Factor Codec" fields) (Wiki name: Entity Effect) + { 0x6D, PacketTypesIn.DeclareRecipes }, // (Wiki name: Update Recipes) + { 0x6E, 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.PlayerSession }, // Added in 1.19.3 + { 0x07, PacketTypesOut.ClientStatus }, // (Wiki name: Client Command) + { 0x08, PacketTypesOut.ClientSettings }, // (Wiki name: Client Information) + { 0x09, PacketTypesOut.TabComplete }, // (Wiki name: Command Suggestions Request) + { 0x0A, PacketTypesOut.ClickWindowButton }, // (Wiki name: Click Container Button) + { 0x0B, PacketTypesOut.ClickWindow }, // (Wiki name: Click Container) + { 0x0C, PacketTypesOut.CloseWindow }, // (Wiki name: Close Container (serverbound)) + { 0x0D, PacketTypesOut.PluginMessage }, // (Wiki name: Plugin Message (serverbound)) + { 0x0E, PacketTypesOut.EditBook }, // + { 0x0F, PacketTypesOut.EntityNBTRequest }, // (Wiki name: Query Entity Tag) + { 0x10, PacketTypesOut.InteractEntity }, // (Wiki name: Interact) + { 0x11, PacketTypesOut.GenerateStructure }, // (Wiki name: Jigsaw Generate) + { 0x12, PacketTypesOut.KeepAlive }, // + { 0x13, PacketTypesOut.LockDifficulty }, // + { 0x14, PacketTypesOut.PlayerPosition }, // (Wiki name: Move Player Position) + { 0x15, PacketTypesOut.PlayerPositionAndRotation }, // (Wiki name: Set Player Position and Rotation) + { 0x16, PacketTypesOut.PlayerRotation }, // (Wiki name: Set Player Rotation) + { 0x17, PacketTypesOut.PlayerMovement }, // (Wiki name: Set Player On Ground) + { 0x18, PacketTypesOut.VehicleMove }, // (Wiki name: Move Vehicle (serverbound)) + { 0x19, PacketTypesOut.SteerBoat }, // (Wiki name: Paddle Boat) + { 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) + { 0x1E, PacketTypesOut.EntityAction }, // (Wiki name: Player Command) + { 0x1F, PacketTypesOut.SteerVehicle }, // (Wiki name: Player Input) + { 0x20, PacketTypesOut.Pong }, // (Wiki name: Pong (play)) + + { 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 110a1efc..ee2f2afb 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_3_Version) + if (protocol > Protocol18Handler.MC_1_19_4_Version) throw new NotImplementedException(Translations.exception_palette_packet); if (protocol <= Protocol18Handler.MC_1_8_Version) @@ -60,7 +60,7 @@ namespace MinecraftClient.Protocol.Handlers p = new PacketPalette1122(); else if (protocol < Protocol18Handler.MC_1_14_Version) p = new PacketPalette113(); - else if (protocol <= Protocol18Handler.MC_1_15_Version) + else if (protocol < Protocol18Handler.MC_1_15_Version) p = new PacketPalette114(); else if (protocol <= Protocol18Handler.MC_1_15_2_Version) p = new PacketPalette115(); @@ -76,8 +76,10 @@ namespace MinecraftClient.Protocol.Handlers p = new PacketPalette119(); else if (protocol <= Protocol18Handler.MC_1_19_2_Version) p = new PacketPalette1192(); - else + else if (protocol <= Protocol18Handler.MC_1_19_3_Version) p = new PacketPalette1193(); + else + p = new PacketPalette1194(); p.SetForgeEnabled(forgeEnabled); return p; diff --git a/MinecraftClient/Protocol/Handlers/PacketTypesIn.cs b/MinecraftClient/Protocol/Handlers/PacketTypesIn.cs index 8529fd0a..3b13f499 100644 --- a/MinecraftClient/Protocol/Handlers/PacketTypesIn.cs +++ b/MinecraftClient/Protocol/Handlers/PacketTypesIn.cs @@ -9,6 +9,7 @@ ActionBar, // Advancements, // AttachEntity, // + Bundle, // Added in 1.19.4 BlockAction, // BlockBreakAnimation, // BlockChange, // @@ -20,12 +21,14 @@ ChatMessage, // ChatPreview, // Added in 1.19 ChatSuggestions, // Added in 1.19.1 (1.19.2) + ChunksBiomes, // Added in 1.19.4 ChunkData, // ClearTiles, // CloseWindow, // CollectItem, // CombatEvent, // CraftRecipeResponse, // + DamageEvent, // Added in 1.19.4 DeathCombatEvent, // DeclareCommands, // DeclareRecipes, // @@ -54,6 +57,7 @@ FeatureFlags, // Added in 1.19.3 HeldItemChange, // HideMessage, // Added in 1.19.1 (1.19.2) + HurtAnimation, // Added in 1.19.4 InitializeWorldBorder, // JoinGame, // KeepAlive, // diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs index 2f73451a..53e19404 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs @@ -64,6 +64,7 @@ namespace MinecraftClient.Protocol.Handlers 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; + internal const int MC_1_19_4_Version = 762; private int compression_treshold = 0; private int autocomplete_transaction_id = 0; @@ -85,6 +86,7 @@ namespace MinecraftClient.Protocol.Handlers readonly Protocol18Terrain pTerrain; readonly IMinecraftComHandler handler; readonly EntityPalette entityPalette; + readonly EntityMetadataPalette entityMetadataPalette; readonly ItemPalette itemPalette; readonly PacketTypePalette packetPalette; readonly SocketWrapper socketWrapper; @@ -94,7 +96,8 @@ namespace MinecraftClient.Protocol.Handlers readonly ILogger log; readonly RandomNumberGenerator randomGen; - public Protocol18Handler(TcpClient Client, int protocolVersion, IMinecraftComHandler handler, ForgeInfo? forgeInfo) + public Protocol18Handler(TcpClient Client, int protocolVersion, IMinecraftComHandler handler, + ForgeInfo? forgeInfo) { ConsoleIO.SetAutoCompleteEngine(this); ChatParser.InitTranslations(); @@ -109,28 +112,33 @@ namespace MinecraftClient.Protocol.Handlers randomGen = RandomNumberGenerator.Create(); lastSeenMessagesCollector = protocolVersion >= MC_1_19_3_Version ? new(20) : new(5); - if (handler.GetTerrainEnabled() && protocolVersion > MC_1_19_3_Version) + if (handler.GetTerrainEnabled() && protocolVersion > MC_1_19_4_Version) { log.Error("§c" + Translations.extra_terrainandmovement_disabled); handler.SetTerrainEnabled(false); } - if (handler.GetInventoryEnabled() && (protocolVersion < MC_1_10_Version || protocolVersion > MC_1_19_3_Version)) + if (handler.GetInventoryEnabled() && + (protocolVersion < MC_1_10_Version || protocolVersion > MC_1_19_4_Version)) { log.Error("§c" + Translations.extra_inventory_disabled); handler.SetInventoryEnabled(false); } - if (handler.GetEntityHandlingEnabled() && (protocolVersion < MC_1_10_Version || protocolVersion > MC_1_19_3_Version)) + + if (handler.GetEntityHandlingEnabled() && + (protocolVersion < MC_1_10_Version || protocolVersion > MC_1_19_4_Version)) { log.Error("§c" + Translations.extra_entity_disabled); handler.SetEntityHandlingEnabled(false); } // Block palette - if (protocolVersion > MC_1_19_3_Version && handler.GetTerrainEnabled()) + if (protocolVersion > MC_1_19_4_Version && handler.GetTerrainEnabled()) throw new NotImplementedException(Translations.exception_palette_block); - if (protocolVersion >= MC_1_19_3_Version) + if (protocolVersion >= MC_1_19_4_Version) + Block.Palette = new Palette1194(); + else if (protocolVersion >= MC_1_19_3_Version) Block.Palette = new Palette1193(); else if (protocolVersion >= MC_1_19_Version) Block.Palette = new Palette119(); @@ -148,10 +156,12 @@ namespace MinecraftClient.Protocol.Handlers Block.Palette = new Palette112(); // Entity palette - if (protocolVersion > MC_1_19_3_Version && handler.GetEntityHandlingEnabled()) + if (protocolVersion > MC_1_19_4_Version && handler.GetEntityHandlingEnabled()) throw new NotImplementedException(Translations.exception_palette_entity); - if (protocolVersion >= MC_1_19_3_Version) + if (protocolVersion >= MC_1_19_4_Version) + entityPalette = new EntityPalette1194(); + else if (protocolVersion >= MC_1_19_3_Version) entityPalette = new EntityPalette1193(); else if (protocolVersion >= MC_1_19_Version) entityPalette = new EntityPalette119(); @@ -170,11 +180,15 @@ namespace MinecraftClient.Protocol.Handlers else entityPalette = new EntityPalette112(); + entityMetadataPalette = EntityMetadataPalette.GetPalette(protocolVersion); + // Item palette - if (protocolVersion > MC_1_19_3_Version && handler.GetInventoryEnabled()) + if (protocolVersion > MC_1_19_4_Version && handler.GetInventoryEnabled()) throw new NotImplementedException(Translations.exception_palette_item); - if (protocolVersion >= MC_1_19_3_Version) + if (protocolVersion >= MC_1_19_4_Version) + itemPalette = new ItemPalette1194(); + else if (protocolVersion >= MC_1_19_3_Version) itemPalette = new ItemPalette1193(); else if (protocolVersion >= MC_1_19_Version) itemPalette = new ItemPalette119(); @@ -194,25 +208,25 @@ namespace MinecraftClient.Protocol.Handlers if (this.protocolVersion >= MC_1_19_2_Version) ChatParser.ChatId2Type = new() { - { 0, ChatParser.MessageType.CHAT }, - { 1, ChatParser.MessageType.SAY_COMMAND }, - { 2, ChatParser.MessageType.MSG_COMMAND_INCOMING }, - { 3, ChatParser.MessageType.MSG_COMMAND_OUTGOING }, - { 4, ChatParser.MessageType.TEAM_MSG_COMMAND_INCOMING }, - { 5, ChatParser.MessageType.TEAM_MSG_COMMAND_OUTGOING }, - { 6, ChatParser.MessageType.EMOTE_COMMAND }, + { 0, ChatParser.MessageType.CHAT }, + { 1, ChatParser.MessageType.SAY_COMMAND }, + { 2, ChatParser.MessageType.MSG_COMMAND_INCOMING }, + { 3, ChatParser.MessageType.MSG_COMMAND_OUTGOING }, + { 4, ChatParser.MessageType.TEAM_MSG_COMMAND_INCOMING }, + { 5, ChatParser.MessageType.TEAM_MSG_COMMAND_OUTGOING }, + { 6, ChatParser.MessageType.EMOTE_COMMAND }, }; else if (this.protocolVersion == MC_1_19_Version) ChatParser.ChatId2Type = new() { - { 0, ChatParser.MessageType.CHAT }, - { 1, ChatParser.MessageType.RAW_MSG }, - { 2, ChatParser.MessageType.RAW_MSG }, - { 3, ChatParser.MessageType.SAY_COMMAND }, - { 4, ChatParser.MessageType.MSG_COMMAND_INCOMING }, - { 5, ChatParser.MessageType.TEAM_MSG_COMMAND_INCOMING }, - { 6, ChatParser.MessageType.EMOTE_COMMAND }, - { 7, ChatParser.MessageType.RAW_MSG }, + { 0, ChatParser.MessageType.CHAT }, + { 1, ChatParser.MessageType.RAW_MSG }, + { 2, ChatParser.MessageType.RAW_MSG }, + { 3, ChatParser.MessageType.SAY_COMMAND }, + { 4, ChatParser.MessageType.MSG_COMMAND_INCOMING }, + { 5, ChatParser.MessageType.TEAM_MSG_COMMAND_INCOMING }, + { 6, ChatParser.MessageType.EMOTE_COMMAND }, + { 7, ChatParser.MessageType.RAW_MSG }, }; } @@ -253,9 +267,15 @@ namespace MinecraftClient.Protocol.Handlers Thread.Sleep(sleepLength); } } - catch (ObjectDisposedException) { } - catch (OperationCanceledException) { } - catch (NullReferenceException) { } + catch (ObjectDisposedException) + { + } + catch (OperationCanceledException) + { + } + catch (NullReferenceException) + { + } if (cancelToken.IsCancellationRequested) return; @@ -281,16 +301,29 @@ namespace MinecraftClient.Protocol.Handlers break; } } - catch (System.IO.IOException) { break; } - catch (SocketException) { break; } - catch (NullReferenceException) { break; } - catch (Ionic.Zlib.ZlibException) { break; } + catch (System.IO.IOException) + { + break; + } + catch (SocketException) + { + break; + } + catch (NullReferenceException) + { + break; + } + catch (Ionic.Zlib.ZlibException) + { + break; + } if (cancelToken.IsCancellationRequested) break; Thread.Sleep(10); } + packetQueue.CompleteAdding(); } @@ -358,7 +391,8 @@ namespace MinecraftClient.Protocol.Handlers } } // Regular in-game packets - else switch (packetPalette.GetIncommingTypeById(packetID)) + else + switch (packetPalette.GetIncommingTypeById(packetID)) { case PacketTypesIn.KeepAlive: SendPacket(PacketTypesOut.KeepAlive, packetData); @@ -368,34 +402,40 @@ namespace MinecraftClient.Protocol.Handlers SendPacket(PacketTypesOut.Pong, packetData); break; case PacketTypesIn.JoinGame: - { // Temporary fix - log.Debug("Receive JoinGame"); + { + // Temporary fix + log.Debug("Receive JoinGame"); - receiveDeclareCommands = receivePlayerInfo = false; + receiveDeclareCommands = receivePlayerInfo = false; - messageIndex = 0; - pendingAcknowledgments = 0; + messageIndex = 0; + pendingAcknowledgments = 0; - lastReceivedMessage = null; - lastSeenMessagesCollector = protocolVersion >= MC_1_19_3_Version ? new(20) : new(5); - } + lastReceivedMessage = null; + lastSeenMessagesCollector = protocolVersion >= MC_1_19_3_Version ? new(20) : new(5); + } handler.OnGameJoined(isOnlineMode); int playerEntityID = dataTypes.ReadNextInt(packetData); handler.OnReceivePlayerEntityID(playerEntityID); if (protocolVersion >= MC_1_16_2_Version) - dataTypes.ReadNextBool(packetData); // Is hardcore - 1.16.2 and above + dataTypes.ReadNextBool(packetData); // Is hardcore - 1.16.2 and above handler.OnGamemodeUpdate(Guid.Empty, dataTypes.ReadNextByte(packetData)); if (protocolVersion >= MC_1_16_Version) { - dataTypes.ReadNextByte(packetData); // Previous Gamemode - 1.16 and above - int worldCount = dataTypes.ReadNextVarInt(packetData); // Dimension Count (World Count) - 1.16 and above + dataTypes.ReadNextByte(packetData); // Previous Gamemode - 1.16 and above + int worldCount = + dataTypes.ReadNextVarInt( + packetData); // Dimension Count (World Count) - 1.16 and above 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 + 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()) @@ -413,9 +453,11 @@ namespace MinecraftClient.Protocol.Handlers if (protocolVersion >= MC_1_16_Version) { if (protocolVersion >= MC_1_19_Version) - dimensionTypeName = dataTypes.ReadNextString(packetData); // Dimension Type: Identifier + dimensionTypeName = + dataTypes.ReadNextString(packetData); // Dimension Type: Identifier else if (protocolVersion >= MC_1_16_2_Version) - dimensionType = dataTypes.ReadNextNbt(packetData); // Dimension Type: NBT Tag Compound + dimensionType = + dataTypes.ReadNextNbt(packetData); // Dimension Type: NBT Tag Compound else dataTypes.ReadNextString(packetData); currentDimension = 0; @@ -426,11 +468,13 @@ namespace MinecraftClient.Protocol.Handlers currentDimension = (sbyte)dataTypes.ReadNextByte(packetData); if (protocolVersion < MC_1_14_Version) - dataTypes.ReadNextByte(packetData); // Difficulty - 1.13 and below + dataTypes.ReadNextByte(packetData); // Difficulty - 1.13 and below if (protocolVersion >= MC_1_16_Version) { - string dimensionName = dataTypes.ReadNextString(packetData); // Dimension Name (World Name) - 1.16 and above + string dimensionName = + dataTypes.ReadNextString( + packetData); // Dimension Name (World Name) - 1.16 and above if (handler.GetTerrainEnabled()) { if (protocolVersion >= MC_1_16_2_Version && protocolVersion <= MC_1_18_2_Version) @@ -446,26 +490,27 @@ namespace MinecraftClient.Protocol.Handlers } if (protocolVersion >= MC_1_15_Version) - dataTypes.ReadNextLong(packetData); // Hashed world seed - 1.15 and above + dataTypes.ReadNextLong(packetData); // Hashed world seed - 1.15 and above if (protocolVersion >= MC_1_16_2_Version) - dataTypes.ReadNextVarInt(packetData); // Max Players - 1.16.2 and above + dataTypes.ReadNextVarInt(packetData); // Max Players - 1.16.2 and above else - dataTypes.ReadNextByte(packetData); // Max Players - 1.16.1 and below + dataTypes.ReadNextByte(packetData); // Max Players - 1.16.1 and below if (protocolVersion < MC_1_16_Version) - dataTypes.SkipNextString(packetData); // Level Type - 1.15 and below + dataTypes.SkipNextString(packetData); // Level Type - 1.15 and below if (protocolVersion >= MC_1_14_Version) - dataTypes.ReadNextVarInt(packetData); // View distance - 1.14 and above + dataTypes.ReadNextVarInt(packetData); // View distance - 1.14 and above if (protocolVersion >= MC_1_18_1_Version) - dataTypes.ReadNextVarInt(packetData); // Simulation Distance - 1.18 and above + dataTypes.ReadNextVarInt(packetData); // Simulation Distance - 1.18 and above if (protocolVersion >= MC_1_8_Version) - dataTypes.ReadNextBool(packetData); // Reduced debug info - 1.8 and above + dataTypes.ReadNextBool(packetData); // Reduced debug info - 1.8 and above if (protocolVersion >= MC_1_15_Version) - dataTypes.ReadNextBool(packetData); // Enable respawn screen - 1.15 and above + dataTypes.ReadNextBool(packetData); // Enable respawn screen - 1.15 and above if (protocolVersion >= MC_1_16_Version) { - dataTypes.ReadNextBool(packetData); // Is Debug - 1.16 and above - dataTypes.ReadNextBool(packetData); // Is Flat - 1.16 and above + dataTypes.ReadNextBool(packetData); // Is Debug - 1.16 and above + dataTypes.ReadNextBool(packetData); // Is Flat - 1.16 and above } + if (protocolVersion >= MC_1_19_Version) { bool hasDeathLocation = dataTypes.ReadNextBool(packetData); // Has death location @@ -488,6 +533,7 @@ namespace MinecraftClient.Protocol.Handlers if (receivePlayerInfo) handler.SetCanSendMessage(true); } + break; case PacketTypesIn.ChatMessage: int messageType = 0; @@ -519,18 +565,21 @@ namespace MinecraftClient.Protocol.Handlers string signedChat = dataTypes.ReadNextString(packetData); bool hasUnsignedChatContent = dataTypes.ReadNextBool(packetData); - string? unsignedChatContent = hasUnsignedChatContent ? dataTypes.ReadNextString(packetData) : null; + string? unsignedChatContent = + hasUnsignedChatContent ? dataTypes.ReadNextString(packetData) : null; messageType = dataTypes.ReadNextVarInt(packetData); if ((messageType == 1 && !Config.Main.Advanced.ShowSystemMessages) - || (messageType == 2 && !Config.Main.Advanced.ShowXPBarMessages)) + || (messageType == 2 && !Config.Main.Advanced.ShowXPBarMessages)) break; Guid senderUUID = dataTypes.ReadNextUUID(packetData); string senderDisplayName = ChatParser.ParseText(dataTypes.ReadNextString(packetData)); bool hasSenderTeamName = dataTypes.ReadNextBool(packetData); - string? senderTeamName = hasSenderTeamName ? ChatParser.ParseText(dataTypes.ReadNextString(packetData)) : null; + string? senderTeamName = hasSenderTeamName + ? ChatParser.ParseText(dataTypes.ReadNextString(packetData)) + : null; long timestamp = dataTypes.ReadNextLong(packetData); @@ -546,36 +595,46 @@ namespace MinecraftClient.Protocol.Handlers else { PlayerInfo? player = handler.GetPlayerInfo(senderUUID); - verifyResult = player != null && player.VerifyMessage(signedChat, timestamp, salt, ref messageSignature); + verifyResult = player != null && player.VerifyMessage(signedChat, timestamp, salt, + ref messageSignature); } - ChatMessage chat = new(signedChat, true, messageType, senderUUID, unsignedChatContent, senderDisplayName, senderTeamName, timestamp, messageSignature, verifyResult); + ChatMessage chat = new(signedChat, true, messageType, senderUUID, unsignedChatContent, + senderDisplayName, senderTeamName, timestamp, messageSignature, verifyResult); handler.OnTextReceived(chat); } else if (protocolVersion == MC_1_19_2_Version) { // 1.19.1 - 1.19.2 - byte[]? precedingSignature = dataTypes.ReadNextBool(packetData) ? dataTypes.ReadNextByteArray(packetData) : null; + byte[]? precedingSignature = dataTypes.ReadNextBool(packetData) + ? dataTypes.ReadNextByteArray(packetData) + : null; Guid senderUUID = dataTypes.ReadNextUUID(packetData); byte[] headerSignature = dataTypes.ReadNextByteArray(packetData); string signedChat = dataTypes.ReadNextString(packetData); - string? decorated = dataTypes.ReadNextBool(packetData) ? dataTypes.ReadNextString(packetData) : null; + string? decorated = dataTypes.ReadNextBool(packetData) + ? dataTypes.ReadNextString(packetData) + : null; long timestamp = dataTypes.ReadNextLong(packetData); long salt = dataTypes.ReadNextLong(packetData); int lastSeenMessageListLen = dataTypes.ReadNextVarInt(packetData); - LastSeenMessageList.AcknowledgedMessage[] lastSeenMessageList = new LastSeenMessageList.AcknowledgedMessage[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, true); } + LastSeenMessageList lastSeenMessages = new(lastSeenMessageList); - string? unsignedChatContent = dataTypes.ReadNextBool(packetData) ? dataTypes.ReadNextString(packetData) : null; + string? unsignedChatContent = dataTypes.ReadNextBool(packetData) + ? dataTypes.ReadNextString(packetData) + : null; MessageFilterType filterEnum = (MessageFilterType)dataTypes.ReadNextVarInt(packetData); if (filterEnum == MessageFilterType.PartiallyFiltered) @@ -583,20 +642,28 @@ namespace MinecraftClient.Protocol.Handlers int chatTypeId = dataTypes.ReadNextVarInt(packetData); string chatName = dataTypes.ReadNextString(packetData); - string? targetName = dataTypes.ReadNextBool(packetData) ? dataTypes.ReadNextString(packetData) : null; + string? targetName = dataTypes.ReadNextBool(packetData) + ? dataTypes.ReadNextString(packetData) + : null; Dictionary chatInfo = Json.ParseJson(chatName).Properties; - string senderDisplayName = (chatInfo.ContainsKey("insertion") ? chatInfo["insertion"] : chatInfo["text"]).StringValue; + string senderDisplayName = + (chatInfo.ContainsKey("insertion") ? chatInfo["insertion"] : chatInfo["text"]) + .StringValue; string? senderTeamName = null; - ChatParser.MessageType messageTypeEnum = ChatParser.ChatId2Type!.GetValueOrDefault(chatTypeId, ChatParser.MessageType.CHAT); + ChatParser.MessageType messageTypeEnum = + ChatParser.ChatId2Type!.GetValueOrDefault(chatTypeId, ChatParser.MessageType.CHAT); 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; + (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)) + if (player != null && (player.DisplayName != null || player.Name != null) && + string.IsNullOrWhiteSpace(senderDisplayName)) { senderDisplayName = ChatParser.ParseText(player.DisplayName ?? player.Name); if (string.IsNullOrWhiteSpace(senderDisplayName)) @@ -619,13 +686,16 @@ namespace MinecraftClient.Protocol.Handlers else { bool lastVerifyResult = player.IsMessageChainLegal(); - verifyResult = player.VerifyMessage(signedChat, timestamp, salt, ref headerSignature, ref precedingSignature, lastSeenMessages); + verifyResult = player.VerifyMessage(signedChat, timestamp, salt, + ref headerSignature, ref precedingSignature, lastSeenMessages); if (lastVerifyResult && !verifyResult) - log.Warn(string.Format(Translations.chat_message_chain_broken, senderDisplayName)); + log.Warn(string.Format(Translations.chat_message_chain_broken, + senderDisplayName)); } } - ChatMessage chat = new(signedChat, false, chatTypeId, senderUUID, unsignedChatContent, senderDisplayName, senderTeamName, timestamp, headerSignature, verifyResult); + ChatMessage chat = new(signedChat, false, chatTypeId, senderUUID, unsignedChatContent, + senderDisplayName, senderTeamName, timestamp, headerSignature, verifyResult); if (isOnlineMode && !chat.LacksSender()) Acknowledge(chat); handler.OnTextReceived(chat); @@ -638,7 +708,9 @@ namespace MinecraftClient.Protocol.Handlers 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; + byte[]? messageSignature = dataTypes.ReadNextBool(packetData) + ? dataTypes.ReadNextByteArray(packetData, 256) + : null; // Body // net.minecraft.network.message.MessageBody.Serialized#write @@ -650,19 +722,23 @@ namespace MinecraftClient.Protocol.Handlers // net.minecraft.network.message.LastSeenMessageList.Indexed#write // net.minecraft.network.message.MessageSignatureData.Indexed#write int totalPreviousMessages = dataTypes.ReadNextVarInt(packetData); - Tuple[] previousMessageSignatures = new Tuple[totalPreviousMessages]; + 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)); + 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; + string? unsignedChatContent = dataTypes.ReadNextBool(packetData) + ? dataTypes.ReadNextString(packetData) + : null; MessageFilterType filterType = (MessageFilterType)dataTypes.ReadNextVarInt(packetData); @@ -673,21 +749,30 @@ namespace MinecraftClient.Protocol.Handlers // 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; + string? targetName = dataTypes.ReadNextBool(packetData) + ? dataTypes.ReadNextString(packetData) + : null; - ChatParser.MessageType messageTypeEnum = ChatParser.ChatId2Type!.GetValueOrDefault(chatTypeId, ChatParser.MessageType.CHAT); + 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; + 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; + (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)) + if (player != null && (player.DisplayName != null || player.Name != null) && + string.IsNullOrWhiteSpace(senderDisplayName)) { senderDisplayName = ChatParser.ParseText(player.DisplayName ?? player.Name); if (string.IsNullOrWhiteSpace(senderDisplayName)) @@ -712,20 +797,25 @@ namespace MinecraftClient.Protocol.Handlers else { verifyResult = false; - verifyResult = player.VerifyMessage(message, senderUUID, player.ChatUuid, index, timestamp, salt, ref messageSignature, previousMessageSignatures); + 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); + 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})"); + ConsoleIO.WriteLine( + $"HideMessage was not processed! (SigLen={hideMessageSignature.Length})"); break; case PacketTypesIn.SystemChat: string systemMessage = dataTypes.ReadNextString(packetData); @@ -742,6 +832,7 @@ namespace MinecraftClient.Protocol.Handlers if (!Config.Main.Advanced.ShowSystemMessages) break; } + handler.OnTextReceived(new(systemMessage, null, true, -1, Guid.Empty, true)); } else @@ -751,13 +842,17 @@ namespace MinecraftClient.Protocol.Handlers 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); + 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; @@ -787,11 +882,36 @@ namespace MinecraftClient.Protocol.Handlers ChatParser.ParseText(dataTypes.ReadNextString(packetData)) ); + break; + case PacketTypesIn.DamageEvent: // 1.19.4 + if (handler.GetEntityHandlingEnabled() && protocolVersion >= MC_1_19_4_Version) + { + var entityId = dataTypes.ReadNextVarInt(packetData); + var sourceTypeId = dataTypes.ReadNextVarInt(packetData); + var sourceCauseId = dataTypes.ReadNextVarInt(packetData); + var sourceDirectId = dataTypes.ReadNextVarInt(packetData); + + Location? sourcePos; + if (dataTypes.ReadNextBool(packetData)) + { + sourcePos = new Location() + { + X = dataTypes.ReadNextDouble(packetData), + Y = dataTypes.ReadNextDouble(packetData), + Z = dataTypes.ReadNextDouble(packetData) + }; + } + + // TODO: Write a function to use this data ? But seems not too useful + } + break; case PacketTypesIn.MessageHeader: // 1.19.2 only if (protocolVersion == MC_1_19_2_Version) { - byte[]? precedingSignature = dataTypes.ReadNextBool(packetData) ? dataTypes.ReadNextByteArray(packetData) : null; + byte[]? precedingSignature = dataTypes.ReadNextBool(packetData) + ? dataTypes.ReadNextByteArray(packetData) + : null; Guid senderUUID = dataTypes.ReadNextUUID(packetData); byte[] headerSignature = dataTypes.ReadNextByteArray(packetData); byte[] bodyDigest = dataTypes.ReadNextByteArray(packetData); @@ -811,9 +931,11 @@ namespace MinecraftClient.Protocol.Handlers else { bool lastVerifyResult = player.IsMessageChainLegal(); - verifyResult = player.VerifyMessageHead(ref precedingSignature, ref headerSignature, ref bodyDigest); + verifyResult = player.VerifyMessageHead(ref precedingSignature, + ref headerSignature, ref bodyDigest); if (lastVerifyResult && !verifyResult) - log.Warn(string.Format(Translations.chat_message_chain_broken, player.Name)); + log.Warn(string.Format(Translations.chat_message_chain_broken, + player.Name)); } } } @@ -825,21 +947,26 @@ namespace MinecraftClient.Protocol.Handlers if (protocolVersion >= MC_1_16_Version) { if (protocolVersion >= MC_1_19_Version) - dimensionTypeNameRespawn = dataTypes.ReadNextString(packetData); // Dimension Type: Identifier + dimensionTypeNameRespawn = + dataTypes.ReadNextString(packetData); // Dimension Type: Identifier else if (protocolVersion >= MC_1_16_2_Version) - dimensionTypeRespawn = dataTypes.ReadNextNbt(packetData); // Dimension Type: NBT Tag Compound + dimensionTypeRespawn = + dataTypes.ReadNextNbt(packetData); // Dimension Type: NBT Tag Compound else dataTypes.ReadNextString(packetData); currentDimension = 0; } else - { // 1.15 and below + { + // 1.15 and below currentDimension = dataTypes.ReadNextInt(packetData); } if (protocolVersion >= MC_1_16_Version) { - string dimensionName = dataTypes.ReadNextString(packetData); // Dimension Name (World Name) - 1.16 and above + string dimensionName = + dataTypes.ReadNextString( + packetData); // Dimension Name (World Name) - 1.16 and above if (handler.GetTerrainEnabled()) { if (protocolVersion >= MC_1_16_2_Version && protocolVersion <= MC_1_18_2_Version) @@ -855,81 +982,92 @@ namespace MinecraftClient.Protocol.Handlers } if (protocolVersion < MC_1_14_Version) - dataTypes.ReadNextByte(packetData); // Difficulty - 1.13 and below + dataTypes.ReadNextByte(packetData); // Difficulty - 1.13 and below if (protocolVersion >= MC_1_15_Version) - dataTypes.ReadNextLong(packetData); // Hashed world seed - 1.15 and above - dataTypes.ReadNextByte(packetData); // Gamemode + dataTypes.ReadNextLong(packetData); // Hashed world seed - 1.15 and above + dataTypes.ReadNextByte(packetData); // Gamemode if (protocolVersion >= MC_1_16_Version) - dataTypes.ReadNextByte(packetData); // Previous Game mode - 1.16 and above + dataTypes.ReadNextByte(packetData); // Previous Game mode - 1.16 and above if (protocolVersion < MC_1_16_Version) - dataTypes.SkipNextString(packetData); // Level Type - 1.15 and below + dataTypes.SkipNextString(packetData); // Level Type - 1.15 and below if (protocolVersion >= MC_1_16_Version) { - dataTypes.ReadNextBool(packetData); // Is Debug - 1.16 and above - dataTypes.ReadNextBool(packetData); // Is Flat - 1.16 and above - dataTypes.ReadNextBool(packetData); // Copy metadata - 1.16 and above + dataTypes.ReadNextBool(packetData); // Is Debug - 1.16 and above + dataTypes.ReadNextBool(packetData); // Is Flat - 1.16 and above + dataTypes.ReadNextBool(packetData); // Copy metadata - 1.16 and above } + if (protocolVersion >= MC_1_19_Version) { bool hasDeathLocation = dataTypes.ReadNextBool(packetData); // Has death location if (hasDeathLocation) { - dataTypes.ReadNextString(packetData); // Death dimension name: Identifier - dataTypes.ReadNextLocation(packetData); // Death location + dataTypes.ReadNextString(packetData); // Death dimension name: Identifier + dataTypes.ReadNextLocation(packetData); // Death location } } + handler.OnRespawn(); break; case PacketTypesIn.PlayerPositionAndLook: + { + // These always need to be read, since we need the field after them for teleport confirm + double x = dataTypes.ReadNextDouble(packetData); + double y = dataTypes.ReadNextDouble(packetData); + double z = dataTypes.ReadNextDouble(packetData); + Location location = new(x, y, z); + float yaw = dataTypes.ReadNextFloat(packetData); + float pitch = dataTypes.ReadNextFloat(packetData); + byte locMask = dataTypes.ReadNextByte(packetData); + + // entity handling require player pos for distance calculating + if (handler.GetTerrainEnabled() || handler.GetEntityHandlingEnabled()) { - // These always need to be read, since we need the field after them for teleport confirm - double x = dataTypes.ReadNextDouble(packetData); - double y = dataTypes.ReadNextDouble(packetData); - double z = dataTypes.ReadNextDouble(packetData); - Location location = new(x, y, z); - float yaw = dataTypes.ReadNextFloat(packetData); - float pitch = dataTypes.ReadNextFloat(packetData); - byte locMask = dataTypes.ReadNextByte(packetData); - - // entity handling require player pos for distance calculating - if (handler.GetTerrainEnabled() || handler.GetEntityHandlingEnabled()) + if (protocolVersion >= MC_1_8_Version) { - if (protocolVersion >= MC_1_8_Version) - { - Location current = handler.GetCurrentLocation(); - location.X = (locMask & 1 << 0) != 0 ? current.X + x : x; - location.Y = (locMask & 1 << 1) != 0 ? current.Y + y : y; - location.Z = (locMask & 1 << 2) != 0 ? current.Z + z : z; - } + Location current = handler.GetCurrentLocation(); + location.X = (locMask & 1 << 0) != 0 ? current.X + x : x; + location.Y = (locMask & 1 << 1) != 0 ? current.Y + y : y; + location.Z = (locMask & 1 << 2) != 0 ? current.Z + z : z; } + } - if (protocolVersion >= MC_1_9_Version) + if (protocolVersion >= MC_1_9_Version) + { + int teleportID = dataTypes.ReadNextVarInt(packetData); + + if (teleportID < 0) { - int teleportID = dataTypes.ReadNextVarInt(packetData); - - if (teleportID < 0) { yaw = LastYaw; pitch = LastPitch; } - else { LastYaw = yaw; LastPitch = pitch; } - - handler.UpdateLocation(location, yaw, pitch); - - // Teleport confirm packet - SendPacket(PacketTypesOut.TeleportConfirm, DataTypes.GetVarInt(teleportID)); - if (Config.Main.Advanced.TemporaryFixBadpacket) - { - SendLocationUpdate(location, true, yaw, pitch, true); - if (teleportID == 1) - SendLocationUpdate(location, true, yaw, pitch, true); - } + yaw = LastYaw; + pitch = LastPitch; } else { - handler.UpdateLocation(location, yaw, pitch); - LastYaw = yaw; LastPitch = pitch; + LastYaw = yaw; + LastPitch = pitch; } - if (protocolVersion >= MC_1_17_Version) - dataTypes.ReadNextBool(packetData); // Dismount Vehicle - 1.17 and above + handler.UpdateLocation(location, yaw, pitch); + + // Teleport confirm packet + SendPacket(PacketTypesOut.TeleportConfirm, DataTypes.GetVarInt(teleportID)); + if (Config.Main.Advanced.TemporaryFixBadpacket) + { + SendLocationUpdate(location, true, yaw, pitch, true); + if (teleportID == 1) + SendLocationUpdate(location, true, yaw, pitch, true); + } } + else + { + handler.UpdateLocation(location, yaw, pitch); + LastYaw = yaw; + LastPitch = pitch; + } + + if (protocolVersion >= MC_1_17_Version && protocolVersion < MC_1_19_4_Version) + dataTypes.ReadNextBool(packetData); // Dismount Vehicle - 1.17 to 1.19.3 + } break; case PacketTypesIn.ChunkData: if (handler.GetTerrainEnabled()) @@ -944,7 +1082,9 @@ namespace MinecraftClient.Protocol.Handlers ulong[]? verticalStripBitmask = null; if (protocolVersion == MC_1_17_Version || protocolVersion == MC_1_17_1_Version) - verticalStripBitmask = dataTypes.ReadNextULongArray(packetData); // Bit Mask Length and Primary Bit Mask + verticalStripBitmask = + dataTypes.ReadNextULongArray( + packetData); // Bit Mask Length and Primary Bit Mask dataTypes.ReadNextNbt(packetData); // Heightmaps @@ -978,17 +1118,21 @@ namespace MinecraftClient.Protocol.Handlers byte[] compressed = dataTypes.ReadData(compressedDataSize, packetData); byte[] decompressed = ZlibUtils.Decompress(compressed); - pTerrain.ProcessChunkColumnData(chunkX, chunkZ, chunkMask, addBitmap, currentDimension == 0, chunksContinuous, currentDimension, new Queue(decompressed)); + pTerrain.ProcessChunkColumnData(chunkX, chunkZ, chunkMask, addBitmap, + currentDimension == 0, chunksContinuous, currentDimension, + new Queue(decompressed)); Interlocked.Decrement(ref handler.GetWorld().chunkLoadNotCompleted); } else { if (protocolVersion >= MC_1_14_Version) - dataTypes.ReadNextNbt(packetData); // Heightmaps - 1.14 and above + dataTypes.ReadNextNbt(packetData); // Heightmaps - 1.14 and above int biomesLength = 0; if (protocolVersion >= MC_1_16_2_Version) if (chunksContinuous) - biomesLength = dataTypes.ReadNextVarInt(packetData); // Biomes length - 1.16.2 and above + biomesLength = + dataTypes.ReadNextVarInt( + packetData); // Biomes length - 1.16.2 and above if (protocolVersion >= MC_1_15_Version && chunksContinuous) { if (protocolVersion >= MC_1_16_2_Version) @@ -1002,13 +1146,19 @@ namespace MinecraftClient.Protocol.Handlers } else dataTypes.DropData(1024 * 4, packetData); // Biomes - 1.15 and above } + int dataSize = dataTypes.ReadNextVarInt(packetData); - pTerrain.ProcessChunkColumnData(chunkX, chunkZ, chunkMask, 0, false, chunksContinuous, currentDimension, packetData); + pTerrain.ProcessChunkColumnData(chunkX, chunkZ, chunkMask, 0, false, + chunksContinuous, currentDimension, packetData); Interlocked.Decrement(ref handler.GetWorld().chunkLoadNotCompleted); } } } + + break; + case PacketTypesIn.ChunksBiomes: // 1.19.4 + // Biomes are not handled by MCC break; case PacketTypesIn.MapData: if (protocolVersion < MC_1_8_Version) @@ -1089,7 +1239,8 @@ namespace MinecraftClient.Protocol.Handlers mapIcon.Direction = dataTypes.ReadNextByte(packetData); if (dataTypes.ReadNextBool(packetData)) // Has Display Name? - mapIcon.DisplayName = ChatParser.ParseText(dataTypes.ReadNextString(packetData)); + mapIcon.DisplayName = + ChatParser.ParseText(dataTypes.ReadNextString(packetData)); } icons.Add(mapIcon); @@ -1110,7 +1261,8 @@ namespace MinecraftClient.Protocol.Handlers colors = dataTypes.ReadNextByteArray(packetData); } - handler.OnMapData(mapid, scale, trackingPosition, locked, icons, columnsUpdated, rowsUpdated, mapCoulmnX, mapRowZ, colors); + handler.OnMapData(mapid, scale, trackingPosition, locked, icons, columnsUpdated, + rowsUpdated, mapCoulmnX, mapRowZ, colors); break; case PacketTypesIn.TradeList: if ((protocolVersion >= MC_1_14_Version) && (handler.GetInventoryEnabled())) @@ -1124,6 +1276,7 @@ namespace MinecraftClient.Protocol.Handlers VillagerTrade trade = dataTypes.ReadNextTrade(packetData, itemPalette); trades.Add(trade); } + VillagerInfo villagerInfo = new() { Level = dataTypes.ReadNextVarInt(packetData), @@ -1133,6 +1286,7 @@ namespace MinecraftClient.Protocol.Handlers }; handler.OnTradeList(windowID, trades, villagerInfo); } + break; case PacketTypesIn.Title: if (protocolVersion >= MC_1_8_Version) @@ -1188,8 +1342,11 @@ namespace MinecraftClient.Protocol.Handlers fadeout = dataTypes.ReadNextInt(packetData); } } - handler.OnTitle(action2, titletext, subtitletext, actionbartext, fadein, stay, fadeout, json); + + handler.OnTitle(action2, titletext, subtitletext, actionbartext, fadein, stay, fadeout, + json); } + break; case PacketTypesIn.MultiBlockChange: if (handler.GetTerrainEnabled()) @@ -1256,12 +1413,24 @@ namespace MinecraftClient.Protocol.Handlers } } } + break; case PacketTypesIn.ServerData: string motd = "-"; - bool hasMotd = dataTypes.ReadNextBool(packetData); - if (hasMotd) + + bool hasMotd = false; + if (protocolVersion < MC_1_19_4_Version) + { + hasMotd = dataTypes.ReadNextBool(packetData); + + if (hasMotd) + motd = ChatParser.ParseText(dataTypes.ReadNextString(packetData)); + } + else + { + hasMotd = true; motd = ChatParser.ParseText(dataTypes.ReadNextString(packetData)); + } string iconBase64 = "-"; bool hasIcon = dataTypes.ReadNextBool(packetData); @@ -1296,6 +1465,7 @@ namespace MinecraftClient.Protocol.Handlers handler.OnBlockChange(location, block); } } + break; case PacketTypesIn.SetDisplayChatPreview: bool previewsChatSetting = dataTypes.ReadNextBool(packetData); @@ -1344,11 +1514,13 @@ namespace MinecraftClient.Protocol.Handlers //Process chunk records for (int chunkColumnNo = 0; chunkColumnNo < chunkCount; chunkColumnNo++) { - pTerrain.ProcessChunkColumnData(chunkXs[chunkColumnNo], chunkZs[chunkColumnNo], chunkMasks[chunkColumnNo], addBitmaps[chunkColumnNo], hasSkyLight, true, currentDimension, chunkData); + pTerrain.ProcessChunkColumnData(chunkXs[chunkColumnNo], chunkZs[chunkColumnNo], + chunkMasks[chunkColumnNo], addBitmaps[chunkColumnNo], hasSkyLight, true, + currentDimension, chunkData); Interlocked.Decrement(ref handler.GetWorld().chunkLoadNotCompleted); } - } + break; case PacketTypesIn.UnloadChunk: if (protocolVersion >= MC_1_9_Version && handler.GetTerrainEnabled()) @@ -1364,6 +1536,7 @@ namespace MinecraftClient.Protocol.Handlers handler.GetWorld()[chunkX, chunkZ] = null; } + break; case PacketTypesIn.ChangeGameState: if (protocolVersion >= MC_1_15_2_Version) @@ -1373,6 +1546,7 @@ namespace MinecraftClient.Protocol.Handlers handler.OnGameEvent(reason, state); } + break; case PacketTypesIn.PlayerInfo: if (protocolVersion >= MC_1_19_3_Version) @@ -1395,6 +1569,7 @@ namespace MinecraftClient.Protocol.Handlers if (dataTypes.ReadNextBool(packetData)) dataTypes.SkipNextString(packetData); } + player = new(name, playerUuid); handler.OnPlayerJoin(player); } @@ -1421,13 +1596,14 @@ namespace MinecraftClient.Protocol.Handlers long publicKeyExpiryTime = dataTypes.ReadNextLong(packetData); byte[] encodedPublicKey = dataTypes.ReadNextByteArray(packetData); byte[] publicKeySignature = dataTypes.ReadNextByteArray(packetData); - player.SetPublicKey(chatUuid, publicKeyExpiryTime, encodedPublicKey, publicKeySignature); + player.SetPublicKey(chatUuid, publicKeyExpiryTime, encodedPublicKey, + publicKeySignature); if (playerUuid == handler.GetUserUuid()) { log.Debug("Receive ChatUuid = " + chatUuid); this.chatUuid = chatUuid; - } + } } else { @@ -1446,19 +1622,23 @@ namespace MinecraftClient.Protocol.Handlers handler.SetCanSendMessage(true); } } + 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)) @@ -1470,66 +1650,78 @@ namespace MinecraftClient.Protocol.Handlers } else if (protocolVersion >= MC_1_8_Version) { - int action = dataTypes.ReadNextVarInt(packetData); // Action Name - int numberOfPlayers = dataTypes.ReadNextVarInt(packetData); // Number Of Players + int action = dataTypes.ReadNextVarInt(packetData); // Action Name + int numberOfPlayers = dataTypes.ReadNextVarInt(packetData); // Number Of Players for (int i = 0; i < numberOfPlayers; i++) { - Guid uuid = dataTypes.ReadNextUUID(packetData); // Player UUID + Guid uuid = dataTypes.ReadNextUUID(packetData); // Player UUID switch (action) { case 0x00: //Player Join (Add player since 1.19) - string name = dataTypes.ReadNextString(packetData); // Player name - int propNum = dataTypes.ReadNextVarInt(packetData); // Number of properties in the following array + string name = dataTypes.ReadNextString(packetData); // Player name + int propNum = + dataTypes.ReadNextVarInt( + packetData); // Number of properties in the following array // Property: Tuple[]? properties = useProperty ? - new Tuple[propNum] : null; + Tuple[]? properties = + useProperty ? new Tuple[propNum] : null; for (int p = 0; p < propNum; p++) { - string propertyName = dataTypes.ReadNextString(packetData); // Name: String (32767) - string val = dataTypes.ReadNextString(packetData); // Value: String (32767) + string propertyName = + dataTypes.ReadNextString(packetData); // Name: String (32767) + string val = + dataTypes.ReadNextString(packetData); // Value: String (32767) string? propertySignature = null; - if (dataTypes.ReadNextBool(packetData)) // Is Signed - propertySignature = dataTypes.ReadNextString(packetData); // Signature: String (32767) + if (dataTypes.ReadNextBool(packetData)) // Is Signed + propertySignature = + dataTypes.ReadNextString( + packetData); // Signature: String (32767) if (useProperty) properties![p] = new(propertyName, val, propertySignature); } #pragma warning restore CS0162 // Unreachable code detected - int gameMode = dataTypes.ReadNextVarInt(packetData); // Gamemode + int gameMode = dataTypes.ReadNextVarInt(packetData); // Gamemode handler.OnGamemodeUpdate(uuid, gameMode); - int ping = dataTypes.ReadNextVarInt(packetData); // Ping + int ping = dataTypes.ReadNextVarInt(packetData); // Ping string? displayName = null; - if (dataTypes.ReadNextBool(packetData)) // Has display name - displayName = dataTypes.ReadNextString(packetData); // Display name + if (dataTypes.ReadNextBool(packetData)) // Has display name + displayName = dataTypes.ReadNextString(packetData); // Display name // 1.19 Additions long? keyExpiration = null; byte[]? publicKey = null, signature = null; if (protocolVersion >= MC_1_19_Version) { - if (dataTypes.ReadNextBool(packetData)) // Has Sig Data (if true, red the following fields) + if (dataTypes.ReadNextBool( + packetData)) // Has Sig Data (if true, red the following fields) { - keyExpiration = dataTypes.ReadNextLong(packetData); // Timestamp + keyExpiration = dataTypes.ReadNextLong(packetData); // Timestamp - int publicKeyLength = dataTypes.ReadNextVarInt(packetData); // Public Key Length + int publicKeyLength = + dataTypes.ReadNextVarInt(packetData); // Public Key Length if (publicKeyLength > 0) - publicKey = dataTypes.ReadData(publicKeyLength, packetData); // Public key + publicKey = dataTypes.ReadData(publicKeyLength, + packetData); // Public key - int signatureLength = dataTypes.ReadNextVarInt(packetData); // Signature Length + int signatureLength = + dataTypes.ReadNextVarInt(packetData); // Signature Length if (signatureLength > 0) - signature = dataTypes.ReadData(signatureLength, packetData); // Public key + signature = dataTypes.ReadData(signatureLength, + packetData); // Public key } } - handler.OnPlayerJoin(new PlayerInfo(uuid, name, properties, gameMode, ping, displayName, keyExpiration, publicKey, signature)); + handler.OnPlayerJoin(new PlayerInfo(uuid, name, properties, gameMode, ping, + displayName, keyExpiration, publicKey, signature)); break; case 0x01: //Update gamemode handler.OnGamemodeUpdate(uuid, dataTypes.ReadNextVarInt(packetData)); @@ -1547,6 +1739,7 @@ namespace MinecraftClient.Protocol.Handlers else dataTypes.SkipNextString(packetData); } + break; case 0x04: //Player Leave handler.OnPlayerLeave(uuid); @@ -1562,11 +1755,13 @@ namespace MinecraftClient.Protocol.Handlers string name = dataTypes.ReadNextString(packetData); bool online = dataTypes.ReadNextBool(packetData); short ping = dataTypes.ReadNextShort(packetData); - Guid FakeUUID = new(MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(name)).Take(16).ToArray()); + Guid FakeUUID = new(MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(name)).Take(16) + .ToArray()); if (online) handler.OnPlayerJoin(new PlayerInfo(name, FakeUUID)); else handler.OnPlayerLeave(FakeUUID); } + break; case PacketTypesIn.PlayerRemove: int numberOfLeavePlayers = dataTypes.ReadNextVarInt(packetData); @@ -1575,6 +1770,7 @@ namespace MinecraftClient.Protocol.Handlers Guid playerUuid = dataTypes.ReadNextUUID(packetData); handler.OnPlayerLeave(playerUuid); } + break; case PacketTypesIn.TabComplete: int old_transaction_id = autocomplete_transaction_id; @@ -1598,6 +1794,7 @@ namespace MinecraftClient.Protocol.Handlers dataTypes.SkipNextString(packetData); } } + handler.OnAutoCompleteDone(old_transaction_id, autocomplete_result); break; case PacketTypesIn.PluginMessage: @@ -1608,7 +1805,8 @@ namespace MinecraftClient.Protocol.Handlers handler.OnPluginChannelMessage(channel, packetData.ToArray()); return pForge.HandlePluginMessage(channel, packetData, ref currentDimension); case PacketTypesIn.Disconnect: - handler.OnConnectionLost(ChatBot.DisconnectReason.InGameKick, ChatParser.ParseText(dataTypes.ReadNextString(packetData))); + handler.OnConnectionLost(ChatBot.DisconnectReason.InGameKick, + ChatParser.ParseText(dataTypes.ReadNextString(packetData))); return false; case PacketTypesIn.SetCompression: if (protocolVersion >= MC_1_8_Version && protocolVersion < MC_1_9_Version) @@ -1621,8 +1819,10 @@ namespace MinecraftClient.Protocol.Handlers { // MC 1.13 or lower byte windowID = dataTypes.ReadNextByte(packetData); - string type = dataTypes.ReadNextString(packetData).Replace("minecraft:", "").ToUpper(); - ContainerTypeOld inventoryType = (ContainerTypeOld)Enum.Parse(typeof(ContainerTypeOld), type); + string type = dataTypes.ReadNextString(packetData).Replace("minecraft:", "") + .ToUpper(); + ContainerTypeOld inventoryType = + (ContainerTypeOld)Enum.Parse(typeof(ContainerTypeOld), type); string title = dataTypes.ReadNextString(packetData); byte slots = dataTypes.ReadNextByte(packetData); Container inventory = new(windowID, inventoryType, ChatParser.ParseText(title)); @@ -1638,14 +1838,20 @@ namespace MinecraftClient.Protocol.Handlers handler.OnInventoryOpen(windowID, inventory); } } + break; case PacketTypesIn.CloseWindow: if (handler.GetInventoryEnabled()) { byte windowID = dataTypes.ReadNextByte(packetData); - lock (window_actions) { window_actions[windowID] = 0; } + lock (window_actions) + { + window_actions[windowID] = 0; + } + handler.OnInventoryClose(windowID); } + break; case PacketTypesIn.WindowItems: if (handler.GetInventoryEnabled()) @@ -1679,6 +1885,7 @@ namespace MinecraftClient.Protocol.Handlers handler.OnWindowItems(windowId, inventorySlots, stateId); } + break; case PacketTypesIn.WindowProperty: byte containerId = dataTypes.ReadNextByte(packetData); @@ -1698,6 +1905,7 @@ namespace MinecraftClient.Protocol.Handlers Item? item = dataTypes.ReadNextItemSlot(packetData, itemPalette); handler.OnSetSlot(windowID, slotID, item, stateId); } + break; case PacketTypesIn.WindowConfirmation: if (handler.GetInventoryEnabled()) @@ -1708,6 +1916,7 @@ namespace MinecraftClient.Protocol.Handlers if (!accepted) SendWindowConfirmation(windowID, actionID, true); } + break; case PacketTypesIn.ResourcePackSend: string url = dataTypes.ReadNextString(packetData); @@ -1716,19 +1925,26 @@ namespace MinecraftClient.Protocol.Handlers if (protocolVersion >= MC_1_17_Version) { forced = dataTypes.ReadNextBool(packetData); - bool hasPromptMessage = dataTypes.ReadNextBool(packetData); // Has Prompt Message (Boolean) - 1.17 and above + bool hasPromptMessage = + dataTypes.ReadNextBool(packetData); // Has Prompt Message (Boolean) - 1.17 and above if (hasPromptMessage) - dataTypes.SkipNextString(packetData); // Prompt Message (Optional Chat) - 1.17 and above + dataTypes.SkipNextString( + packetData); // Prompt Message (Optional Chat) - 1.17 and above } + // Some server plugins may send invalid resource packs to probe the client and we need to ignore them (issue #1056) if (!url.StartsWith("http") && hash.Length != 40) // Some server may have null hash value break; //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 + 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 break; case PacketTypesIn.SpawnEntity: if (handler.GetEntityHandlingEnabled()) @@ -1736,6 +1952,7 @@ namespace MinecraftClient.Protocol.Handlers Entity entity = dataTypes.ReadNextEntity(packetData, entityPalette, false); handler.OnSpawnEntity(entity); } + break; case PacketTypesIn.EntityEquipment: if (handler.GetEntityHandlingEnabled()) @@ -1761,6 +1978,7 @@ namespace MinecraftClient.Protocol.Handlers handler.OnEntityEquipment(entityid, slot2, item); } } + break; case PacketTypesIn.SpawnLivingEntity: if (handler.GetEntityHandlingEnabled()) @@ -1771,6 +1989,7 @@ namespace MinecraftClient.Protocol.Handlers // we are simply ignoring leftover data in packet handler.OnSpawnEntity(entity); } + break; case PacketTypesIn.SpawnPlayer: if (handler.GetEntityHandlingEnabled()) @@ -1787,14 +2006,16 @@ namespace MinecraftClient.Protocol.Handlers handler.OnSpawnPlayer(EntityID, UUID, EntityLocation, Yaw, Pitch); } + break; case PacketTypesIn.EntityEffect: if (handler.GetEntityHandlingEnabled()) { int entityid = dataTypes.ReadNextVarInt(packetData); Inventory.Effects effect = Effects.Speed; - int effectId = protocolVersion >= MC_1_18_2_Version ? - dataTypes.ReadNextVarInt(packetData) : dataTypes.ReadNextByte(packetData); + int effectId = protocolVersion >= MC_1_18_2_Version + ? dataTypes.ReadNextVarInt(packetData) + : dataTypes.ReadNextByte(packetData); if (Enum.TryParse(effectId.ToString(), out effect)) { int amplifier = dataTypes.ReadNextByte(packetData); @@ -1811,23 +2032,28 @@ namespace MinecraftClient.Protocol.Handlers factorCodec = dataTypes.ReadNextNbt(packetData); } - handler.OnEntityEffect(entityid, effect, amplifier, duration, flags, hasFactorData, factorCodec); + handler.OnEntityEffect(entityid, effect, amplifier, duration, flags, hasFactorData, + factorCodec); } } + break; case PacketTypesIn.DestroyEntities: if (handler.GetEntityHandlingEnabled()) { int entityCount = 1; // 1.17.0 has only one entity per packet if (protocolVersion != MC_1_17_Version) - entityCount = dataTypes.ReadNextVarInt(packetData); // All other versions have a "count" field + entityCount = + dataTypes.ReadNextVarInt(packetData); // All other versions have a "count" field int[] entityList = new int[entityCount]; for (int i = 0; i < entityCount; i++) { entityList[i] = dataTypes.ReadNextVarInt(packetData); } + handler.OnDestroyEntities(entityList); } + break; case PacketTypesIn.EntityPosition: if (handler.GetEntityHandlingEnabled()) @@ -1842,6 +2068,7 @@ namespace MinecraftClient.Protocol.Handlers DeltaZ /= (128 * 32); handler.OnEntityPosition(EntityID, DeltaX, DeltaY, DeltaZ, OnGround); } + break; case PacketTypesIn.EntityPositionAndRotation: if (handler.GetEntityHandlingEnabled()) @@ -1858,12 +2085,15 @@ namespace MinecraftClient.Protocol.Handlers DeltaZ /= (128 * 32); handler.OnEntityPosition(EntityID, DeltaX, DeltaY, DeltaZ, OnGround); } + break; case PacketTypesIn.EntityProperties: if (handler.GetEntityHandlingEnabled()) { int EntityID = dataTypes.ReadNextVarInt(packetData); - int NumberOfProperties = protocolVersion >= MC_1_17_Version ? dataTypes.ReadNextVarInt(packetData) : dataTypes.ReadNextInt(packetData); + int NumberOfProperties = protocolVersion >= MC_1_17_Version + ? dataTypes.ReadNextVarInt(packetData) + : dataTypes.ReadNextInt(packetData); Dictionary keys = new(); for (int i = 0; i < NumberOfProperties; i++) { @@ -1881,27 +2111,37 @@ namespace MinecraftClient.Protocol.Handlers byte operation = dataTypes.ReadNextByte(packetData); switch (operation) { - case 0: op0.Add(amount); break; - case 1: op1.Add(amount); break; - case 2: op2.Add(amount + 1); break; + case 0: + op0.Add(amount); + break; + case 1: + op1.Add(amount); + break; + case 2: + op2.Add(amount + 1); + break; } } + if (op0.Count > 0) _value += op0.Sum(); if (op1.Count > 0) _value *= 1 + op1.Sum(); if (op2.Count > 0) _value *= op2.Aggregate((a, _x) => a * _x); keys.Add(_key, _value); } + handler.OnEntityProperties(EntityID, keys); } + break; case PacketTypesIn.EntityMetadata: if (handler.GetEntityHandlingEnabled()) { int EntityID = dataTypes.ReadNextVarInt(packetData); - Dictionary metadata = dataTypes.ReadNextMetadata(packetData, itemPalette); + Dictionary metadata = dataTypes.ReadNextMetadata(packetData, itemPalette, entityMetadataPalette); + // Also make a palette for field? Will be a lot of work int healthField; // See https://wiki.vg/Entity_metadata#Living_Entity - if (protocolVersion > MC_1_19_3_Version) + if (protocolVersion > MC_1_19_4_Version) throw new NotImplementedException(Translations.exception_palette_healthfield); else if (protocolVersion >= MC_1_17_Version) // 1.17 and above healthField = 9; @@ -1912,11 +2152,13 @@ namespace MinecraftClient.Protocol.Handlers else throw new NotImplementedException(Translations.exception_palette_healthfield); - if (metadata.TryGetValue(healthField, out object? healthObj) && healthObj != null && healthObj.GetType() == typeof(float)) + if (metadata.TryGetValue(healthField, out object? healthObj) && healthObj != null && + healthObj.GetType() == typeof(float)) handler.OnEntityHealth(EntityID, (float)healthObj); handler.OnEntityMetadata(EntityID, metadata); } + break; case PacketTypesIn.EntityStatus: if (handler.GetEntityHandlingEnabled()) @@ -1925,6 +2167,7 @@ namespace MinecraftClient.Protocol.Handlers byte status = dataTypes.ReadNextByte(packetData); handler.OnEntityStatus(entityId, status); } + break; case PacketTypesIn.TimeUpdate: long WorldAge = dataTypes.ReadNextLong(packetData); @@ -1943,6 +2186,7 @@ namespace MinecraftClient.Protocol.Handlers bool OnGround = dataTypes.ReadNextBool(packetData); handler.OnEntityTeleport(EntityID, X, Y, Z, OnGround); } + break; case PacketTypesIn.UpdateHealth: float health = dataTypes.ReadNextFloat(packetData); @@ -1964,9 +2208,11 @@ namespace MinecraftClient.Protocol.Handlers case PacketTypesIn.Explosion: Location explosionLocation; if (protocolVersion >= MC_1_19_3_Version) - explosionLocation = new(dataTypes.ReadNextDouble(packetData), dataTypes.ReadNextDouble(packetData), dataTypes.ReadNextDouble(packetData)); + explosionLocation = new(dataTypes.ReadNextDouble(packetData), + dataTypes.ReadNextDouble(packetData), dataTypes.ReadNextDouble(packetData)); else - explosionLocation = new(dataTypes.ReadNextFloat(packetData), dataTypes.ReadNextFloat(packetData), dataTypes.ReadNextFloat(packetData)); + explosionLocation = new(dataTypes.ReadNextFloat(packetData), + dataTypes.ReadNextFloat(packetData), dataTypes.ReadNextFloat(packetData)); float explosionStrength = dataTypes.ReadNextFloat(packetData); int explosionBlockCount = protocolVersion >= MC_1_17_Version @@ -1996,13 +2242,14 @@ namespace MinecraftClient.Protocol.Handlers objectivevalue = dataTypes.ReadNextString(packetData); type2 = dataTypes.ReadNextVarInt(packetData); } + handler.OnScoreboardObjective(objectivename, mode, objectivevalue, type2); break; case PacketTypesIn.UpdateScore: string entityname = dataTypes.ReadNextString(packetData); int action3 = protocolVersion >= MC_1_18_2_Version - ? dataTypes.ReadNextVarInt(packetData) - : dataTypes.ReadNextByte(packetData); + ? dataTypes.ReadNextVarInt(packetData) + : dataTypes.ReadNextByte(packetData); string objectivename2 = string.Empty; int value = -1; if (action3 != 1 || protocolVersion >= MC_1_8_Version) @@ -2022,6 +2269,7 @@ namespace MinecraftClient.Protocol.Handlers byte stage = dataTypes.ReadNextByte(packetData); handler.OnBlockBreakAnimation(playerId, blockLocation, stage); } + break; case PacketTypesIn.EntityAnimation: if (handler.GetEntityHandlingEnabled()) @@ -2030,10 +2278,12 @@ namespace MinecraftClient.Protocol.Handlers byte animation = dataTypes.ReadNextByte(packetData); handler.OnEntityAnimation(playerId2, animation); } + break; default: return false; //Ignored packet } + return true; //Packet processed } #if Release @@ -2051,9 +2301,18 @@ namespace MinecraftClient.Protocol.Handlers innerException); } #else - catch (SocketException) { throw; } - catch (ThreadAbortException) { throw; } - catch (ObjectDisposedException) { throw; } + catch (SocketException) + { + throw; + } + catch (ThreadAbortException) + { + throw; + } + catch (ObjectDisposedException) + { + throw; + } #endif } @@ -2097,13 +2356,16 @@ namespace MinecraftClient.Protocol.Handlers { netMain.Item2.Cancel(); } + if (netReader != null) { netReader.Item2.Cancel(); socketWrapper.Disconnect(); } } - catch { } + catch + { + } } /// @@ -2161,38 +2423,46 @@ namespace MinecraftClient.Protocol.Handlers string server_address = pForge.GetServerAddress(handler.GetServerHost()); byte[] server_port = dataTypes.GetUShort((ushort)handler.GetServerPort()); byte[] next_state = DataTypes.GetVarInt(2); - byte[] handshake_packet = dataTypes.ConcatBytes(protocol_version, dataTypes.GetString(server_address), server_port, next_state); + 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 + fullLoginPacket.AddRange(dataTypes.GetString(handler.GetUsername())); // Username // 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 + 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.GetArray(playerKeyPair.PublicKey.Key)); // Public key received from Microsoft API + fullLoginPacket.AddRange(dataTypes.GetBool(true)); // Has Sig Data + 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 + fullLoginPacket.AddRange( + dataTypes.GetArray(playerKeyPair.PublicKey + .SignatureV2!)); // Public key signature received from Microsoft API else - fullLoginPacket.AddRange(dataTypes.GetArray(playerKeyPair.PublicKey.Signature!)); // Public key signature received from Microsoft API + fullLoginPacket.AddRange( + dataTypes.GetArray(playerKeyPair.PublicKey + .Signature!)); // Public key signature received from Microsoft API } } + if (protocolVersion >= MC_1_19_2_Version) { Guid uuid = handler.GetUserUuid(); if (uuid == Guid.Empty) - fullLoginPacket.AddRange(dataTypes.GetBool(false)); // Has UUID + fullLoginPacket.AddRange(dataTypes.GetBool(false)); // Has UUID else { - fullLoginPacket.AddRange(dataTypes.GetBool(true)); // Has UUID - fullLoginPacket.AddRange(DataTypes.GetUUID(uuid)); // UUID + fullLoginPacket.AddRange(dataTypes.GetBool(true)); // Has UUID + fullLoginPacket.AddRange(DataTypes.GetUUID(uuid)); // UUID } } @@ -2203,7 +2473,8 @@ namespace MinecraftClient.Protocol.Handlers (int packetID, Queue packetData) = ReadNextPacket(); if (packetID == 0x00) //Login rejected { - handler.OnConnectionLost(ChatBot.DisconnectReason.LoginRejected, ChatParser.ParseText(dataTypes.ReadNextString(packetData))); + handler.OnConnectionLost(ChatBot.DisconnectReason.LoginRejected, + ChatParser.ParseText(dataTypes.ReadNextString(packetData))); return false; } else if (packetID == 0x01) //Encryption request @@ -2212,7 +2483,8 @@ namespace MinecraftClient.Protocol.Handlers string serverID = dataTypes.ReadNextString(packetData); byte[] serverPublicKey = dataTypes.ReadNextByteArray(packetData); byte[] token = dataTypes.ReadNextByteArray(packetData); - return StartEncryption(handler.GetUserUuidStr(), handler.GetSessionID(), token, serverID, serverPublicKey, playerKeyPair, session); + return StartEncryption(handler.GetUserUuidStr(), handler.GetSessionID(), token, serverID, + serverPublicKey, playerKeyPair, session); } else if (packetID == 0x02) //Login successful { @@ -2236,7 +2508,8 @@ namespace MinecraftClient.Protocol.Handlers /// Start network encryption. Automatically called by Login() if the server requests encryption. /// /// True if encryption was successful - private bool StartEncryption(string uuid, string sessionID, byte[] token, string serverIDhash, byte[] serverPublicKey, PlayerKeyPair? playerKeyPair, SessionToken session) + private bool StartEncryption(string uuid, string sessionID, byte[] token, string serverIDhash, + byte[] serverPublicKey, PlayerKeyPair? playerKeyPair, SessionToken session) { RSACryptoServiceProvider RSAService = CryptoHandler.DecodeRSAPublicKey(serverPublicKey)!; byte[] secretKey = CryptoHandler.ClientAESPrivateKey ?? CryptoHandler.GenerateAESPrivateKey(); @@ -2249,7 +2522,8 @@ namespace MinecraftClient.Protocol.Handlers bool needCheckSession = true; if (session.ServerPublicKey != null && session.SessionPreCheckTask != null - && serverIDhash == session.ServerIDhash && Enumerable.SequenceEqual(serverPublicKey, session.ServerPublicKey)) + && serverIDhash == session.ServerIDhash && + Enumerable.SequenceEqual(serverPublicKey, session.ServerPublicKey)) { session.SessionPreCheckTask.Wait(); if (session.SessionPreCheckTask.Result) // PreCheck Successed @@ -2276,14 +2550,14 @@ namespace MinecraftClient.Protocol.Handlers // Encryption Response packet List encryptionResponse = new(); - encryptionResponse.AddRange(dataTypes.GetArray(RSAService.Encrypt(secretKey, false))); // Shared Secret + encryptionResponse.AddRange(dataTypes.GetArray(RSAService.Encrypt(secretKey, false))); // Shared Secret // 1.19 - 1.19.2 if (protocolVersion >= MC_1_19_Version && protocolVersion < MC_1_19_3_Version) { if (playerKeyPair == null) { - encryptionResponse.AddRange(dataTypes.GetBool(true)); // Has Verify Token + encryptionResponse.AddRange(dataTypes.GetBool(true)); // Has Verify Token encryptionResponse.AddRange(dataTypes.GetArray(RSAService.Encrypt(token, false))); // Verify Token } else @@ -2291,14 +2565,14 @@ namespace MinecraftClient.Protocol.Handlers byte[] salt = GenerateSalt(); byte[] messageSignature = playerKeyPair.PrivateKey.SignData(dataTypes.ConcatBytes(token, salt)); - encryptionResponse.AddRange(dataTypes.GetBool(false)); // Has Verify Token - encryptionResponse.AddRange(salt); // Salt - encryptionResponse.AddRange(dataTypes.GetArray(messageSignature)); // Message Signature + encryptionResponse.AddRange(dataTypes.GetBool(false)); // Has Verify Token + encryptionResponse.AddRange(salt); // Salt + encryptionResponse.AddRange(dataTypes.GetArray(messageSignature)); // Message Signature } } else { - encryptionResponse.AddRange(dataTypes.GetArray(RSAService.Encrypt(token, false))); // Verify Token + encryptionResponse.AddRange(dataTypes.GetArray(RSAService.Encrypt(token, false))); // Verify Token } SendPacket(0x01, encryptionResponse); @@ -2313,12 +2587,14 @@ namespace MinecraftClient.Protocol.Handlers (int packetID, Queue packetData) = ReadNextPacket(); if (packetID < 0 || loopPrevention-- < 0) // Failed to read packet or too many iterations (issue #1150) { - handler.OnConnectionLost(ChatBot.DisconnectReason.ConnectionLost, "§8" + Translations.error_invalid_encrypt); + handler.OnConnectionLost(ChatBot.DisconnectReason.ConnectionLost, + "§8" + Translations.error_invalid_encrypt); return false; } else if (packetID == 0x00) //Login rejected { - handler.OnConnectionLost(ChatBot.DisconnectReason.LoginRejected, ChatParser.ParseText(dataTypes.ReadNextString(packetData))); + handler.OnConnectionLost(ChatBot.DisconnectReason.LoginRejected, + ChatParser.ParseText(dataTypes.ReadNextString(packetData))); return false; } else if (packetID == 0x02) //Login successful @@ -2343,6 +2619,7 @@ namespace MinecraftClient.Protocol.Handlers playerProperty[i] = new Tuple(name, value, signature); } } + handler.OnLoginSuccess(uuidReceived, userName, playerProperty); login_phase = false; @@ -2389,7 +2666,8 @@ namespace MinecraftClient.Protocol.Handlers if (protocolVersion >= MC_1_13_Version) { tabcomplete_packet = dataTypes.ConcatBytes(tabcomplete_packet, transaction_id); - tabcomplete_packet = dataTypes.ConcatBytes(tabcomplete_packet, dataTypes.GetString(BehindCursor.Replace(' ', (char)0x00))); + tabcomplete_packet = dataTypes.ConcatBytes(tabcomplete_packet, + dataTypes.GetString(BehindCursor.Replace(' ', (char)0x00))); } else { @@ -2405,6 +2683,7 @@ namespace MinecraftClient.Protocol.Handlers { tabcomplete_packet = dataTypes.ConcatBytes(dataTypes.GetString(BehindCursor)); } + ConsoleIO.AutoCompleteDone = false; SendPacket(PacketTypesOut.TabComplete, tabcomplete_packet); return autocomplete_transaction_id; @@ -2425,9 +2704,11 @@ namespace MinecraftClient.Protocol.Handlers byte[] packet_id = DataTypes.GetVarInt(0); byte[] protocol_version = DataTypes.GetVarInt(-1); - byte[] server_port = BitConverter.GetBytes((ushort)port); Array.Reverse(server_port); + byte[] server_port = BitConverter.GetBytes((ushort)port); + Array.Reverse(server_port); byte[] next_state = DataTypes.GetVarInt(1); - byte[] packet = dataTypes.ConcatBytes(packet_id, protocol_version, dataTypes.GetString(host), server_port, next_state); + byte[] packet = dataTypes.ConcatBytes(packet_id, protocol_version, dataTypes.GetString(host), server_port, + next_state); byte[] tosend = dataTypes.ConcatBytes(DataTypes.GetVarInt(packet.Length), packet); socketWrapper.SendDataRAW(tosend); @@ -2456,7 +2737,8 @@ namespace MinecraftClient.Protocol.Handlers if (!String.IsNullOrEmpty(result) && result.StartsWith("{") && result.EndsWith("}")) { Json.JSONData jsonData = Json.ParseJson(result); - if (jsonData.Type == Json.JSONData.DataType.Object && jsonData.Properties.ContainsKey("version")) + if (jsonData.Type == Json.JSONData.DataType.Object && + jsonData.Properties.ContainsKey("version")) { Json.JSONData versionData = jsonData.Properties["version"]; @@ -2466,18 +2748,21 @@ namespace MinecraftClient.Protocol.Handlers //Retrieve protocol version number for handling this server if (versionData.Properties.ContainsKey("protocol")) - protocolVersion = int.Parse(versionData.Properties["protocol"].StringValue, NumberStyles.Any, CultureInfo.CurrentCulture); + protocolVersion = int.Parse(versionData.Properties["protocol"].StringValue, + NumberStyles.Any, CultureInfo.CurrentCulture); // Check for forge on the server. Protocol18Forge.ServerInfoCheckForge(jsonData, ref forgeInfo); - ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.mcc_server_protocol, version, protocolVersion + (forgeInfo != null ? Translations.mcc_with_forge : ""))); + ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.mcc_server_protocol, version, + protocolVersion + (forgeInfo != null ? Translations.mcc_with_forge : ""))); return true; } } } } + return false; } @@ -2513,15 +2798,25 @@ namespace MinecraftClient.Protocol.Handlers { try { - byte[] fields = dataTypes.GetAcknowledgment(acknowledgment, isOnlineMode && Config.Signature.LoginWithSecureProfile); + byte[] fields = dataTypes.GetAcknowledgment(acknowledgment, + isOnlineMode && Config.Signature.LoginWithSecureProfile); SendPacket(PacketTypesOut.MessageAcknowledgment, fields); return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } /// @@ -2539,15 +2834,25 @@ namespace MinecraftClient.Protocol.Handlers return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } public LastSeenMessageList.Acknowledgment ConsumeAcknowledgment() { pendingAcknowledgments = 0; - return new LastSeenMessageList.Acknowledgment(lastSeenMessagesCollector.GetLastSeenMessages(), lastReceivedMessage); + return new LastSeenMessageList.Acknowledgment(lastSeenMessagesCollector.GetLastSeenMessages(), + lastReceivedMessage); } public void Acknowledge(ChatMessage message) @@ -2596,7 +2901,7 @@ namespace MinecraftClient.Protocol.Handlers try { - List>? needSigned = null; // List< Argument Name, Argument Value > + 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); @@ -2604,10 +2909,13 @@ namespace MinecraftClient.Protocol.Handlers lock (MessageSigningLock) { LastSeenMessageList.Acknowledgment? acknowledgment_1_19_2 = - (protocolVersion == MC_1_19_2_Version) ? ConsumeAcknowledgment() : null; + (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); + (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(); @@ -2620,31 +2928,33 @@ namespace MinecraftClient.Protocol.Handlers if (needSigned == null || needSigned!.Count == 0) { - fields.AddRange(DataTypes.GetLong(0)); // Salt: Long - fields.AddRange(DataTypes.GetVarInt(0)); // Signature Length: VarInt + 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 + 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 + 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); + 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); + 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(DataTypes.GetVarInt(sign.Length)); // Signature length: VarInt - fields.AddRange(sign); // Signature: Byte Array + fields.AddRange(sign); // Signature: Byte Array } } @@ -2654,7 +2964,8 @@ namespace MinecraftClient.Protocol.Handlers if (protocolVersion == MC_1_19_2_Version) { // Message Acknowledgment (1.19.2) - fields.AddRange(dataTypes.GetAcknowledgment(acknowledgment_1_19_2!, isOnlineMode && Config.Signature.LoginWithSecureProfile)); + fields.AddRange(dataTypes.GetAcknowledgment(acknowledgment_1_19_2!, + isOnlineMode && Config.Signature.LoginWithSecureProfile)); } else if (protocolVersion >= MC_1_19_3_Version) { @@ -2667,11 +2978,21 @@ namespace MinecraftClient.Protocol.Handlers SendPacket(PacketTypesOut.ChatCommand, fields); } + return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } /// @@ -2701,18 +3022,22 @@ namespace MinecraftClient.Protocol.Handlers lock (MessageSigningLock) { LastSeenMessageList.Acknowledgment? acknowledgment_1_19_2 = - (protocolVersion == MC_1_19_2_Version) ? ConsumeAcknowledgment() : null; + (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); + (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); // Timestamp: Instant(Long) DateTimeOffset timeNow = DateTimeOffset.UtcNow; fields.AddRange(DataTypes.GetLong(timeNow.ToUnixTimeMilliseconds())); - if (!isOnlineMode || playerKeyPair == null || !Config.Signature.LoginWithSecureProfile || !Config.Signature.SignChat) + if (!isOnlineMode || playerKeyPair == null || !Config.Signature.LoginWithSecureProfile || + !Config.Signature.SignChat) { - fields.AddRange(DataTypes.GetLong(0)); // Salt: Long + 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 @@ -2730,9 +3055,11 @@ namespace MinecraftClient.Protocol.Handlers 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); + 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); + 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)); @@ -2755,16 +3082,27 @@ namespace MinecraftClient.Protocol.Handlers else if (protocolVersion == MC_1_19_2_Version) { // Message Acknowledgment - fields.AddRange(dataTypes.GetAcknowledgment(acknowledgment_1_19_2!, isOnlineMode && Config.Signature.LoginWithSecureProfile)); + fields.AddRange(dataTypes.GetAcknowledgment(acknowledgment_1_19_2!, + isOnlineMode && Config.Signature.LoginWithSecureProfile)); } } } + SendPacket(PacketTypesOut.ChatMessage, fields); return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } public bool SendEntityAction(int PlayerEntityID, int ActionID) @@ -2778,9 +3116,18 @@ namespace MinecraftClient.Protocol.Handlers SendPacket(PacketTypesOut.EntityAction, fields); return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } /// @@ -2794,9 +3141,18 @@ namespace MinecraftClient.Protocol.Handlers SendPacket(PacketTypesOut.ClientStatus, new byte[] { 0 }); return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } /// @@ -2831,7 +3187,8 @@ namespace MinecraftClient.Protocol.Handlers /// Show skin layers /// 1.9+ main hand /// True if client settings were successfully sent - public bool SendClientSettings(string language, byte viewDistance, byte difficulty, byte chatMode, bool chatColors, byte skinParts, byte mainHand) + public bool SendClientSettings(string language, byte viewDistance, byte difficulty, byte chatMode, + bool chatColors, byte skinParts, byte mainHand) { try { @@ -2851,6 +3208,7 @@ namespace MinecraftClient.Protocol.Handlers fields.Add((byte)(skinParts & 0x1)); //show cape } else fields.Add(skinParts); + if (protocolVersion >= MC_1_9_Version) fields.AddRange(DataTypes.GetVarInt(mainHand)); if (protocolVersion >= MC_1_17_Version) @@ -2860,13 +3218,23 @@ namespace MinecraftClient.Protocol.Handlers else fields.Add(1); // 1.17 and 1.17.1 - Disable text filtering. (Always true) } + if (protocolVersion >= MC_1_18_1_Version) fields.Add(1); // 1.18 and above - Allow server listings SendPacket(PacketTypesOut.ClientSettings, fields); } - catch (SocketException) { } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } + return false; } @@ -2884,7 +3252,8 @@ namespace MinecraftClient.Protocol.Handlers return SendLocationUpdate(location, onGround, yaw, pitch, true); } - public bool SendLocationUpdate(Location location, bool onGround, float? yaw = null, float? pitch = null, bool forceUpdate = false) + public bool SendLocationUpdate(Location location, bool onGround, float? yaw = null, float? pitch = null, + bool forceUpdate = false) { if (handler.GetTerrainEnabled()) { @@ -2893,22 +3262,27 @@ namespace MinecraftClient.Protocol.Handlers if (Config.Main.Advanced.TemporaryFixBadpacket) { - if (yaw.HasValue && pitch.HasValue && (forceUpdate || yaw.Value != LastYaw || pitch.Value != LastPitch)) + if (yaw.HasValue && pitch.HasValue && + (forceUpdate || yaw.Value != LastYaw || pitch.Value != LastPitch)) { - yawpitch = dataTypes.ConcatBytes(dataTypes.GetFloat(yaw.Value), dataTypes.GetFloat(pitch.Value)); + yawpitch = dataTypes.ConcatBytes(dataTypes.GetFloat(yaw.Value), + dataTypes.GetFloat(pitch.Value)); packetType = PacketTypesOut.PlayerPositionAndRotation; - LastYaw = yaw.Value; LastPitch = pitch.Value; + LastYaw = yaw.Value; + LastPitch = pitch.Value; } } else { if (yaw.HasValue && pitch.HasValue) { - yawpitch = dataTypes.ConcatBytes(dataTypes.GetFloat(yaw.Value), dataTypes.GetFloat(pitch.Value)); + yawpitch = dataTypes.ConcatBytes(dataTypes.GetFloat(yaw.Value), + dataTypes.GetFloat(pitch.Value)); packetType = PacketTypesOut.PlayerPositionAndRotation; - LastYaw = yaw.Value; LastPitch = pitch.Value; + LastYaw = yaw.Value; + LastPitch = pitch.Value; } } @@ -2925,9 +3299,18 @@ namespace MinecraftClient.Protocol.Handlers new byte[] { onGround ? (byte)1 : (byte)0 })); return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } else return false; } @@ -2948,7 +3331,8 @@ namespace MinecraftClient.Protocol.Handlers byte[] length = BitConverter.GetBytes((short)data.Length); Array.Reverse(length); - SendPacket(PacketTypesOut.PluginMessage, dataTypes.ConcatBytes(dataTypes.GetString(channel), length, data)); + SendPacket(PacketTypesOut.PluginMessage, + dataTypes.ConcatBytes(dataTypes.GetString(channel), length, data)); } else { @@ -2957,9 +3341,18 @@ namespace MinecraftClient.Protocol.Handlers return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } /// @@ -2973,12 +3366,22 @@ 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; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } /// @@ -3004,9 +3407,18 @@ namespace MinecraftClient.Protocol.Handlers SendPacket(PacketTypesOut.InteractEntity, fields); return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } // TODO: Interact at block location (e.g. chest minecart) @@ -3029,10 +3441,20 @@ namespace MinecraftClient.Protocol.Handlers SendPacket(PacketTypesOut.InteractEntity, fields); return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } + public bool SendInteractEntity(int EntityID, int type, int hand) { try @@ -3049,10 +3471,20 @@ namespace MinecraftClient.Protocol.Handlers SendPacket(PacketTypesOut.InteractEntity, fields); return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } + public bool SendInteractEntity(int EntityID, int type, float X, float Y, float Z) { return false; @@ -3062,9 +3494,9 @@ namespace MinecraftClient.Protocol.Handlers { if (protocolVersion < MC_1_9_Version) return false; // Packet does not exist prior to MC 1.9 - // According to https://wiki.vg/index.php?title=Protocol&oldid=5486#Player_Block_Placement - // MC 1.7 does this using Player Block Placement with special values - // TODO once Player Block Placement is implemented for older versions + // According to https://wiki.vg/index.php?title=Protocol&oldid=5486#Player_Block_Placement + // MC 1.7 does this using Player Block Placement with special values + // TODO once Player Block Placement is implemented for older versions try { List packet = new(); @@ -3074,9 +3506,18 @@ namespace MinecraftClient.Protocol.Handlers SendPacket(PacketTypesOut.UseItem, packet); return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } public bool SendPlayerDigging(int status, Location location, Direction face, int sequenceId) @@ -3092,9 +3533,18 @@ namespace MinecraftClient.Protocol.Handlers SendPacket(PacketTypesOut.PlayerDigging, packet); return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } public bool SendPlayerBlockPlacement(int hand, Location location, Direction face, int sequenceId) @@ -3116,9 +3566,18 @@ namespace MinecraftClient.Protocol.Handlers SendPacket(PacketTypesOut.PlayerBlockPlacement, packet); return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } public bool SendHeldItemChange(short slot) @@ -3130,12 +3589,22 @@ namespace MinecraftClient.Protocol.Handlers SendPacket(PacketTypesOut.HeldItemChange, packet); return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } - public bool SendWindowAction(int windowId, int slotId, WindowActionType action, Item? item, List> changedSlots, int stateId) + public bool SendWindowAction(int windowId, int slotId, WindowActionType action, Item? item, + List> changedSlots, int stateId) { try { @@ -3153,21 +3622,82 @@ namespace MinecraftClient.Protocol.Handlers switch (action) { - case WindowActionType.LeftClick: button = 0; break; - case WindowActionType.RightClick: button = 1; break; - case WindowActionType.MiddleClick: button = 2; mode = 3; break; - case WindowActionType.ShiftClick: button = 0; mode = 1; item = new Item(ItemType.Null, 0, null); break; - case WindowActionType.DropItem: button = 0; mode = 4; item = new Item(ItemType.Null, 0, null); break; - case WindowActionType.DropItemStack: button = 1; mode = 4; item = new Item(ItemType.Null, 0, null); break; - case WindowActionType.StartDragLeft: button = 0; mode = 5; item = new Item(ItemType.Null, 0, null); slotId = -999; break; - case WindowActionType.StartDragRight: button = 4; mode = 5; item = new Item(ItemType.Null, 0, null); slotId = -999; break; - case WindowActionType.StartDragMiddle: button = 8; mode = 5; item = new Item(ItemType.Null, 0, null); slotId = -999; break; - case WindowActionType.EndDragLeft: button = 2; mode = 5; item = new Item(ItemType.Null, 0, null); slotId = -999; break; - case WindowActionType.EndDragRight: button = 6; mode = 5; item = new Item(ItemType.Null, 0, null); slotId = -999; break; - case WindowActionType.EndDragMiddle: button = 10; mode = 5; item = new Item(ItemType.Null, 0, null); slotId = -999; break; - case WindowActionType.AddDragLeft: button = 1; mode = 5; item = new Item(ItemType.Null, 0, null); break; - case WindowActionType.AddDragRight: button = 5; mode = 5; item = new Item(ItemType.Null, 0, null); break; - case WindowActionType.AddDragMiddle: button = 9; mode = 5; item = new Item(ItemType.Null, 0, null); break; + case WindowActionType.LeftClick: + button = 0; + break; + case WindowActionType.RightClick: + button = 1; + break; + case WindowActionType.MiddleClick: + button = 2; + mode = 3; + break; + case WindowActionType.ShiftClick: + button = 0; + mode = 1; + item = new Item(ItemType.Null, 0, null); + break; + case WindowActionType.DropItem: + button = 0; + mode = 4; + item = new Item(ItemType.Null, 0, null); + break; + case WindowActionType.DropItemStack: + button = 1; + mode = 4; + item = new Item(ItemType.Null, 0, null); + break; + case WindowActionType.StartDragLeft: + button = 0; + mode = 5; + item = new Item(ItemType.Null, 0, null); + slotId = -999; + break; + case WindowActionType.StartDragRight: + button = 4; + mode = 5; + item = new Item(ItemType.Null, 0, null); + slotId = -999; + break; + case WindowActionType.StartDragMiddle: + button = 8; + mode = 5; + item = new Item(ItemType.Null, 0, null); + slotId = -999; + break; + case WindowActionType.EndDragLeft: + button = 2; + mode = 5; + item = new Item(ItemType.Null, 0, null); + slotId = -999; + break; + case WindowActionType.EndDragRight: + button = 6; + mode = 5; + item = new Item(ItemType.Null, 0, null); + slotId = -999; + break; + case WindowActionType.EndDragMiddle: + button = 10; + mode = 5; + item = new Item(ItemType.Null, 0, null); + slotId = -999; + break; + case WindowActionType.AddDragLeft: + button = 1; + mode = 5; + item = new Item(ItemType.Null, 0, null); + break; + case WindowActionType.AddDragRight: + button = 5; + mode = 5; + item = new Item(ItemType.Null, 0, null); + break; + case WindowActionType.AddDragMiddle: + button = 9; + mode = 5; + item = new Item(ItemType.Null, 0, null); + break; } List packet = new() @@ -3218,9 +3748,18 @@ namespace MinecraftClient.Protocol.Handlers SendPacket(PacketTypesOut.ClickWindow, packet); return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } public bool SendCreativeInventoryAction(int slot, ItemType itemType, int count, Dictionary? nbt) @@ -3233,9 +3772,18 @@ namespace MinecraftClient.Protocol.Handlers SendPacket(PacketTypesOut.CreativeInventoryAction, packet); return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } public bool ClickContainerButton(int windowId, int buttonId) @@ -3248,9 +3796,18 @@ namespace MinecraftClient.Protocol.Handlers SendPacket(PacketTypesOut.ClickWindowButton, packet); return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } public bool SendAnimation(int animation, int playerid) @@ -3283,9 +3840,18 @@ namespace MinecraftClient.Protocol.Handlers return false; } } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } public bool SendCloseWindow(int windowId) @@ -3297,12 +3863,22 @@ namespace MinecraftClient.Protocol.Handlers if (window_actions.ContainsKey(windowId)) window_actions[windowId] = 0; } + SendPacket(PacketTypesOut.CloseWindow, new[] { (byte)windowId }); return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } public bool SendUpdateSign(Location sign, string line1, string line2, string line3, string line4) @@ -3327,12 +3903,22 @@ namespace MinecraftClient.Protocol.Handlers SendPacket(PacketTypesOut.UpdateSign, packet); return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } - public bool UpdateCommandBlock(Location location, string command, CommandBlockMode mode, CommandBlockFlags flags) + public bool UpdateCommandBlock(Location location, string command, CommandBlockMode mode, + CommandBlockFlags flags) { if (protocolVersion <= MC_1_13_Version) { @@ -3346,11 +3932,23 @@ namespace MinecraftClient.Protocol.Handlers SendPacket(PacketTypesOut.UpdateSign, packet); return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } + } + else + { + return false; } - else { return false; } } public bool SendWindowConfirmation(byte windowID, short actionID, bool accepted) @@ -3364,9 +3962,18 @@ namespace MinecraftClient.Protocol.Handlers SendPacket(PacketTypesOut.WindowConfirmation, packet); return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } } public bool SelectTrade(int selectedSlot) @@ -3381,11 +3988,23 @@ namespace MinecraftClient.Protocol.Handlers SendPacket(PacketTypesOut.SelectTrade, packet); return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } + } + else + { + return false; } - else { return false; } } public bool SendSpectate(Guid UUID) @@ -3400,11 +4019,23 @@ namespace MinecraftClient.Protocol.Handlers SendPacket(PacketTypesOut.Spectate, packet); return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } + } + else + { + return false; } - else { return false; } } public bool SendPlayerSession(PlayerKeyPair? playerKeyPair) @@ -3425,16 +4056,29 @@ namespace MinecraftClient.Protocol.Handlers packet.AddRange(DataTypes.GetVarInt(playerKeyPair.PublicKey.SignatureV2!.Length)); packet.AddRange(playerKeyPair.PublicKey.SignatureV2); - log.Debug($"SendPlayerSession MessageUUID = {chatUuid.ToString()}, len(PublicKey) = {playerKeyPair.PublicKey.Key.Length}, len(SignatureV2) = {playerKeyPair.PublicKey.SignatureV2!.Length}"); + log.Debug( + $"SendPlayerSession MessageUUID = {chatUuid.ToString()}, len(PublicKey) = {playerKeyPair.PublicKey.Key.Length}, len(SignatureV2) = {playerKeyPair.PublicKey.SignatureV2!.Length}"); SendPacket(PacketTypesOut.PlayerSession, packet); return true; } - catch (SocketException) { return false; } - catch (System.IO.IOException) { return false; } - catch (ObjectDisposedException) { return false; } + catch (SocketException) + { + return false; + } + catch (System.IO.IOException) + { + return false; + } + catch (ObjectDisposedException) + { + return false; + } + } + else + { + return false; } - else { return false; } } private byte[] GenerateSalt() @@ -3444,4 +4088,4 @@ namespace MinecraftClient.Protocol.Handlers return salt; } } -} +} \ No newline at end of file diff --git a/MinecraftClient/Protocol/Message/ChatMessage.cs b/MinecraftClient/Protocol/Message/ChatMessage.cs index 09048f3f..3088d85e 100644 --- a/MinecraftClient/Protocol/Message/ChatMessage.cs +++ b/MinecraftClient/Protocol/Message/ChatMessage.cs @@ -4,15 +4,19 @@ namespace MinecraftClient.Protocol.Message { public class ChatMessage { - // in 1.19 and above, isSignedChat = true + /// + /// In 1.19 and above, isSignedChat = true + /// public bool isSignedChat; public string content; 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 + /// + /// 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 int chatTypeId; public Guid senderUUID; diff --git a/MinecraftClient/Protocol/Message/ChatParser.cs b/MinecraftClient/Protocol/Message/ChatParser.cs index a1db8862..fb1a28fc 100644 --- a/MinecraftClient/Protocol/Message/ChatParser.cs +++ b/MinecraftClient/Protocol/Message/ChatParser.cs @@ -142,34 +142,7 @@ namespace MinecraftClient.Protocol.Message default: goto case MessageType.CHAT; } - string color = string.Empty; - if (message.isSystemChat) - { - if (Config.Signature.MarkSystemMessage) - color = "§7▌§r"; // Background Gray - } - else - { - if ((bool)message.isSignatureLegal!) - { - if (Config.Signature.ShowModifiedChat && message.unsignedContent != null) - { - if (Config.Signature.MarkModifiedMsg) - color = "§6▌§r"; // Background Yellow - } - else - { - if (Config.Signature.MarkLegallySignedMsg) - color = "§2▌§r"; // Background Green - } - } - else - { - if (Config.Signature.MarkIllegallySignedMsg) - color = "§4▌§r"; // Background Red - } - } - return color + text; + return text; } /// diff --git a/MinecraftClient/Protocol/ProtocolHandler.cs b/MinecraftClient/Protocol/ProtocolHandler.cs index 345fe2a8..90cd938d 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, 761 }; + 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, 762 }; if (Array.IndexOf(supportedVersions_Protocol18, ProtocolVersion) > -1) return new Protocol18Handler(Client, ProtocolVersion, Handler, forgeInfo); @@ -315,6 +315,8 @@ namespace MinecraftClient.Protocol return 760; case "1.19.3": return 761; + case "1.19.4": + return 762; default: return 0; } @@ -392,6 +394,7 @@ namespace MinecraftClient.Protocol case 759: return "1.19"; case 760: return "1.19.2"; case 761: return "1.19.3"; + case 762: return "1.19.4"; default: return "0.0"; } }