From 6891d446a560af63acb00ebb5e3a039ef55e9c07 Mon Sep 17 00:00:00 2001 From: Anon Date: Tue, 12 Mar 2024 11:15:05 +0100 Subject: [PATCH 1/7] Added 1.8 Item Mappings and Support --- MinecraftClient/Inventory/Item.cs | 10 + .../Inventory/ItemPalettes/ItemPalette.cs | 5 + .../Inventory/ItemPalettes/ItemPalette18.cs | 640 ++++++++++++++++++ .../Protocol/Handlers/DataTypes.cs | 72 +- .../Protocol/Handlers/Protocol18.cs | 5 +- 5 files changed, 697 insertions(+), 35 deletions(-) create mode 100644 MinecraftClient/Inventory/ItemPalettes/ItemPalette18.cs diff --git a/MinecraftClient/Inventory/Item.cs b/MinecraftClient/Inventory/Item.cs index 70b736ddb3..b9d867559a 100644 --- a/MinecraftClient/Inventory/Item.cs +++ b/MinecraftClient/Inventory/Item.cs @@ -22,6 +22,11 @@ public class Item /// public int Count; + /// + /// Item Count + /// + public int Data; + /// /// Item Metadata /// @@ -39,6 +44,11 @@ public Item(ItemType itemType, int count, Dictionary? nbt) Count = count; NBT = nbt; } + + public Item(ItemType itemType, int count, int data, Dictionary? nbt) : this(itemType, count, nbt) + { + Data = data; + } /// /// Check if the item slot is empty diff --git a/MinecraftClient/Inventory/ItemPalettes/ItemPalette.cs b/MinecraftClient/Inventory/ItemPalettes/ItemPalette.cs index 84f04bfacc..d6770fcdf2 100644 --- a/MinecraftClient/Inventory/ItemPalettes/ItemPalette.cs +++ b/MinecraftClient/Inventory/ItemPalettes/ItemPalette.cs @@ -11,7 +11,12 @@ public ItemPalette() { // Index reverse mappings for use in ToId() foreach (KeyValuePair entry in GetDict()) + { + if (DictReverse.ContainsKey(entry.Value)) + continue; + DictReverse.Add(entry.Value, entry.Key); + } // Hardcoded placeholder types for internal and network use DictReverse[ItemType.Unknown] = (int)ItemType.Unknown; diff --git a/MinecraftClient/Inventory/ItemPalettes/ItemPalette18.cs b/MinecraftClient/Inventory/ItemPalettes/ItemPalette18.cs new file mode 100644 index 0000000000..0d8cc23134 --- /dev/null +++ b/MinecraftClient/Inventory/ItemPalettes/ItemPalette18.cs @@ -0,0 +1,640 @@ +using System.Collections.Generic; + +namespace MinecraftClient.Inventory.ItemPalettes +{ + /// + /// For MC 1.8 + /// Done manually by Milutinke :( + /// + public class ItemPalette18 : ItemPalette + { + private static readonly Dictionary mappings = new(); + + static ItemPalette18() + { + // Mapping IDs are a derived from: (Item ID << 16) | Data + mappings[0] = ItemType.Air; + mappings[65536] = ItemType.Stone; + mappings[65537] = ItemType.Granite; + mappings[65538] = ItemType.PolishedGranite; + mappings[65539] = ItemType.Diorite; + mappings[65540] = ItemType.PolishedDiorite; + mappings[65541] = ItemType.Andesite; + mappings[65542] = ItemType.PolishedAndesite; + mappings[131072] = ItemType.GrassBlock; + mappings[196608] = ItemType.Dirt; + mappings[196609] = ItemType.CoarseDirt; + mappings[196610] = ItemType.Podzol; + mappings[262144] = ItemType.Cobblestone; + mappings[327680] = ItemType.OakPlanks; + mappings[327681] = ItemType.SprucePlanks; + mappings[327682] = ItemType.BirchPlanks; + mappings[327683] = ItemType.JunglePlanks; + mappings[327684] = ItemType.AcaciaPlanks; + mappings[327685] = ItemType.DarkOakPlanks; + mappings[393216] = ItemType.OakSapling; + mappings[393217] = ItemType.SpruceSapling; + mappings[393218] = ItemType.BirchSapling; + mappings[393219] = ItemType.JungleSapling; + mappings[393220] = ItemType.AcaciaSapling; + mappings[393221] = ItemType.DarkOakSapling; + mappings[458752] = ItemType.Bedrock; + mappings[524288] = ItemType.WaterBucket; // Still Water Block Item + mappings[589824] = ItemType.WaterBucket; // Flowing Water Block Item + mappings[655360] = ItemType.LavaBucket; // Still Lava Block Item + mappings[720896] = ItemType.LavaBucket; // Flowing Lava Block Item + mappings[786432] = ItemType.Sand; + mappings[786433] = ItemType.RedSand; + mappings[851968] = ItemType.Gravel; + mappings[917504] = ItemType.GoldOre; + mappings[983040] = ItemType.IronOre; + mappings[1048576] = ItemType.CoalOre; + mappings[1114112] = ItemType.OakLog; + mappings[1114113] = ItemType.SpruceLog; + mappings[1114114] = ItemType.BirchLog; + mappings[1114115] = ItemType.JungleLog; + mappings[1179648] = ItemType.OakLeaves; + mappings[1179649] = ItemType.SpruceLeaves; + mappings[1179650] = ItemType.BirchLeaves; + mappings[1179651] = ItemType.JungleLeaves; + mappings[1245184] = ItemType.Sponge; + mappings[1245185] = ItemType.WetSponge; + mappings[1310720] = ItemType.Glass; + mappings[1376256] = ItemType.LapisOre; + mappings[1441792] = ItemType.LapisBlock; + mappings[1507328] = ItemType.Dispenser; + mappings[1572864] = ItemType.Sandstone; + mappings[1572865] = ItemType.ChiseledSandstone; + mappings[1572866] = ItemType.SmoothSandstone; + mappings[1638400] = ItemType.NoteBlock; + mappings[1769472] = ItemType.PoweredRail; + mappings[1835008] = ItemType.DetectorRail; + mappings[1900544] = ItemType.StickyPiston; + mappings[2031617] = ItemType.Grass; + mappings[2031618] = ItemType.Fern; + mappings[2097152] = ItemType.DeadBush; + mappings[2162688] = ItemType.Piston; + mappings[2490368] = ItemType.Poppy; + mappings[2490369] = ItemType.BlueOrchid; + mappings[2490370] = ItemType.Allium; + mappings[2490371] = ItemType.AzureBluet; + mappings[2490372] = ItemType.RedTulip; + mappings[2490373] = ItemType.OrangeTulip; + mappings[2490374] = ItemType.WhiteTulip; + mappings[2490375] = ItemType.PinkTulip; + mappings[2490376] = ItemType.OxeyeDaisy; + mappings[2555904] = ItemType.BrownMushroom; + mappings[2621440] = ItemType.RedMushroom; + mappings[2686976] = ItemType.GoldBlock; + mappings[2752512] = ItemType.IronBlock; + mappings[2883584] = ItemType.StoneSlab; + mappings[2883585] = ItemType.SandstoneSlab; + mappings[2883587] = ItemType.CobblestoneSlab; + mappings[2883588] = ItemType.BrickSlab; + mappings[2883589] = ItemType.StoneBrickSlab; + mappings[2883590] = ItemType.NetherBrickSlab; + mappings[2883591] = ItemType.QuartzSlab; + mappings[2949120] = ItemType.Bricks; + mappings[3014656] = ItemType.Tnt; + mappings[3080192] = ItemType.Bookshelf; + mappings[3145728] = ItemType.MossyCobblestone; + mappings[3211264] = ItemType.Obsidian; + mappings[3276800] = ItemType.Torch; + mappings[3407872] = ItemType.Spawner; + mappings[3473408] = ItemType.OakStairs; + mappings[3538944] = ItemType.Chest; + mappings[3670016] = ItemType.DiamondOre; + mappings[3735552] = ItemType.DiamondBlock; + mappings[3801088] = ItemType.CraftingTable; + mappings[3932160] = ItemType.Farmland; + mappings[3997696] = ItemType.Furnace; + mappings[4259840] = ItemType.Ladder; + mappings[4325376] = ItemType.Rail; + mappings[4390912] = ItemType.CobblestoneStairs; + mappings[4521984] = ItemType.Lever; + mappings[4587520] = ItemType.StonePressurePlate; + mappings[4784128] = ItemType.RedstoneOre; + mappings[4980736] = ItemType.RedstoneTorch; + mappings[5046272] = ItemType.StoneButton; + mappings[5111808] = ItemType.Snow; + mappings[5177344] = ItemType.Ice; + mappings[5242880] = ItemType.SnowBlock; + mappings[5308416] = ItemType.Cactus; + mappings[5373952] = ItemType.Clay; + mappings[5505024] = ItemType.Jukebox; + mappings[5570560] = ItemType.OakFence; + mappings[5636096] = ItemType.Pumpkin; + mappings[5701632] = ItemType.Netherrack; + mappings[5767168] = ItemType.SoulSand; + mappings[5832704] = ItemType.Glowstone; + mappings[5963776] = ItemType.JackOLantern; + mappings[6225920] = ItemType.WhiteStainedGlass; + mappings[6225921] = ItemType.OrangeStainedGlass; + mappings[6225922] = ItemType.MagentaStainedGlass; + mappings[6225923] = ItemType.LightBlueStainedGlass; + mappings[6225924] = ItemType.YellowStainedGlass; + mappings[6225925] = ItemType.LimeStainedGlass; + mappings[6225926] = ItemType.PinkStainedGlass; + mappings[6225927] = ItemType.GrayStainedGlass; + mappings[6225928] = ItemType.LightGrayStainedGlass; + mappings[6225929] = ItemType.CyanStainedGlass; + mappings[6225930] = ItemType.PurpleStainedGlass; + mappings[6225931] = ItemType.BlueStainedGlass; + mappings[6225932] = ItemType.BrownStainedGlass; + mappings[6225933] = ItemType.GreenStainedGlass; + mappings[6225934] = ItemType.RedStainedGlass; + mappings[6225935] = ItemType.BlackStainedGlass; + mappings[6291456] = ItemType.OakTrapdoor; + mappings[6356992] = ItemType.InfestedStone; + mappings[6356993] = ItemType.InfestedCobblestone; + mappings[6356994] = ItemType.InfestedStoneBricks; + mappings[6356995] = ItemType.InfestedMossyStoneBricks; + mappings[6356996] = ItemType.InfestedCrackedStoneBricks; + mappings[6356997] = ItemType.InfestedChiseledStoneBricks; + mappings[6422528] = ItemType.StoneBricks; + mappings[6422529] = ItemType.MossyStoneBricks; + mappings[6422530] = ItemType.CrackedStoneBricks; + mappings[6422531] = ItemType.ChiseledStoneBricks; + mappings[6488064] = ItemType.BrownMushroomBlock; + mappings[6553600] = ItemType.RedMushroomBlock; + mappings[6619136] = ItemType.IronBars; + mappings[6684672] = ItemType.GlassPane; + mappings[6750208] = ItemType.Melon; + mappings[6946816] = ItemType.Vine; + mappings[7012352] = ItemType.OakFenceGate; + mappings[7077888] = ItemType.BrickStairs; + mappings[7143424] = ItemType.StoneBrickStairs; + mappings[7208960] = ItemType.Mycelium; + mappings[7340032] = ItemType.NetherBricks; + mappings[7405568] = ItemType.NetherBrickFence; + mappings[7471104] = ItemType.NetherBrickStairs; + mappings[7602176] = ItemType.EnchantingTable; + mappings[7864320] = ItemType.EndPortalFrame; + mappings[7929856] = ItemType.EndStone; + mappings[7995392] = ItemType.DragonEgg; + mappings[8060928] = ItemType.RedstoneLamp; + mappings[8388608] = ItemType.SandstoneStairs; + mappings[8454144] = ItemType.EmeraldOre; + mappings[8519680] = ItemType.EnderChest; + mappings[8585216] = ItemType.TripwireHook; + mappings[8716288] = ItemType.EmeraldBlock; + mappings[8781824] = ItemType.SpruceStairs; + mappings[8847360] = ItemType.BirchStairs; + mappings[8912896] = ItemType.JungleStairs; + mappings[8978432] = ItemType.CommandBlock; + mappings[9043968] = ItemType.Beacon; + mappings[9109504] = ItemType.CobblestoneWall; + mappings[9109505] = ItemType.MossyCobblestoneWall; + mappings[9502720] = ItemType.Anvil; + mappings[9502721] = ItemType.ChippedAnvil; + mappings[9502722] = ItemType.DamagedAnvil; + mappings[9568256] = ItemType.TrappedChest; + mappings[9633792] = ItemType.LightWeightedPressurePlate; + mappings[9699328] = ItemType.HeavyWeightedPressurePlate; + mappings[9895936] = ItemType.DaylightDetector; + mappings[9961472] = ItemType.RedstoneBlock; + mappings[10027008] = ItemType.NetherQuartzOre; + mappings[10092544] = ItemType.Hopper; + mappings[10158080] = ItemType.QuartzBlock; + mappings[10158081] = ItemType.ChiseledQuartzBlock; + mappings[10158082] = ItemType.QuartzPillar; + mappings[10223616] = ItemType.QuartzStairs; + mappings[10289152] = ItemType.ActivatorRail; + mappings[10354688] = ItemType.Dropper; + mappings[10420224] = ItemType.WhiteTerracotta; + mappings[10420225] = ItemType.OrangeTerracotta; + mappings[10420226] = ItemType.MagentaTerracotta; + mappings[10420227] = ItemType.LightBlueTerracotta; + mappings[10420228] = ItemType.YellowTerracotta; + mappings[10420229] = ItemType.LimeTerracotta; + mappings[10420230] = ItemType.PinkTerracotta; + mappings[10420231] = ItemType.GrayTerracotta; + mappings[10420232] = ItemType.LightGrayTerracotta; + mappings[10420233] = ItemType.CyanTerracotta; + mappings[10420234] = ItemType.PurpleTerracotta; + mappings[10420235] = ItemType.BlueTerracotta; + mappings[10420236] = ItemType.BrownTerracotta; + mappings[10420237] = ItemType.GreenTerracotta; + mappings[10420238] = ItemType.RedTerracotta; + mappings[10420239] = ItemType.BlackTerracotta; + mappings[10485760] = ItemType.WhiteStainedGlassPane; + mappings[10485761] = ItemType.OrangeStainedGlassPane; + mappings[10485762] = ItemType.MagentaStainedGlassPane; + mappings[10485763] = ItemType.LightBlueStainedGlassPane; + mappings[10485764] = ItemType.YellowStainedGlassPane; + mappings[10485765] = ItemType.LimeStainedGlassPane; + mappings[10485766] = ItemType.PinkStainedGlassPane; + mappings[10485767] = ItemType.GrayStainedGlassPane; + mappings[10485768] = ItemType.LightGrayStainedGlassPane; + mappings[10485769] = ItemType.CyanStainedGlassPane; + mappings[10485770] = ItemType.PurpleStainedGlassPane; + mappings[10485771] = ItemType.BlueStainedGlassPane; + mappings[10485772] = ItemType.BrownStainedGlassPane; + mappings[10485773] = ItemType.GreenStainedGlassPane; + mappings[10485774] = ItemType.RedStainedGlassPane; + mappings[10485775] = ItemType.BlackStainedGlassPane; + mappings[10616832] = ItemType.AcaciaLog; + mappings[10616833] = ItemType.DarkOakLog; + mappings[10682368] = ItemType.AcaciaStairs; + mappings[10747904] = ItemType.DarkOakStairs; + mappings[10813440] = ItemType.SlimeBlock; + mappings[10878976] = ItemType.Barrier; + mappings[10944512] = ItemType.IronTrapdoor; + mappings[11010048] = ItemType.Prismarine; + mappings[11010049] = ItemType.PrismarineBricks; + mappings[11010050] = ItemType.DarkPrismarine; + mappings[11075584] = ItemType.SeaLantern; + mappings[11141120] = ItemType.HayBlock; + mappings[11206656] = ItemType.WhiteCarpet; + mappings[11206657] = ItemType.OrangeCarpet; + mappings[11206658] = ItemType.MagentaCarpet; + mappings[11206659] = ItemType.LightBlueCarpet; + mappings[11206660] = ItemType.YellowCarpet; + mappings[11206661] = ItemType.LimeCarpet; + mappings[11206662] = ItemType.PinkCarpet; + mappings[11206663] = ItemType.GrayCarpet; + mappings[11206664] = ItemType.LightGrayCarpet; + mappings[11206665] = ItemType.CyanCarpet; + mappings[11206666] = ItemType.PurpleCarpet; + mappings[11206667] = ItemType.BlueCarpet; + mappings[11206668] = ItemType.BrownCarpet; + mappings[11206669] = ItemType.GreenCarpet; + mappings[11206670] = ItemType.RedCarpet; + mappings[11206671] = ItemType.BlackCarpet; + mappings[11272192] = ItemType.Terracotta; + mappings[11337728] = ItemType.CoalBlock; + mappings[11403264] = ItemType.PackedIce; + mappings[11468800] = ItemType.Sunflower; + mappings[11468801] = ItemType.Lilac; + mappings[11468802] = ItemType.TallGrass; + mappings[11468803] = ItemType.LargeFern; + mappings[11468804] = ItemType.RoseBush; + mappings[11468805] = ItemType.Peony; + mappings[11730944] = ItemType.RedSandstone; + mappings[11730945] = ItemType.ChiseledRedSandstone; + mappings[11730946] = ItemType.SmoothRedSandstone; + mappings[11796480] = ItemType.RedSandstoneStairs; + mappings[11927552] = ItemType.RedSandstoneSlab; + mappings[11993088] = ItemType.SpruceFenceGate; + mappings[12058624] = ItemType.BirchFenceGate; + mappings[12124160] = ItemType.JungleFenceGate; + mappings[12189696] = ItemType.DarkOakFenceGate; + mappings[12255232] = ItemType.AcaciaFenceGate; + mappings[12320768] = ItemType.SpruceFence; + mappings[12386304] = ItemType.BirchFence; + mappings[12451840] = ItemType.JungleFence; + mappings[12517376] = ItemType.DarkOakFence; + mappings[12582912] = ItemType.AcaciaFence; + mappings[16777216] = ItemType.IronShovel; + mappings[16842752] = ItemType.IronPickaxe; + mappings[16908288] = ItemType.IronAxe; + mappings[16973824] = ItemType.FlintAndSteel; + mappings[17039360] = ItemType.Apple; + mappings[17104896] = ItemType.Bow; + mappings[17170432] = ItemType.Arrow; + mappings[17235968] = ItemType.Coal; + mappings[17235969] = ItemType.Charcoal; + mappings[17301504] = ItemType.Diamond; + mappings[17367040] = ItemType.IronIngot; + mappings[17432576] = ItemType.GoldIngot; + mappings[17498112] = ItemType.IronSword; + mappings[17825792] = ItemType.StoneSword; + mappings[17891328] = ItemType.StoneShovel; + mappings[17956864] = ItemType.StonePickaxe; + mappings[18022400] = ItemType.StoneAxe; + mappings[18087936] = ItemType.DiamondSword; + mappings[18153472] = ItemType.DiamondShovel; + mappings[18219008] = ItemType.DiamondPickaxe; + mappings[18284544] = ItemType.DiamondAxe; + mappings[18350080] = ItemType.Stick; + mappings[18415616] = ItemType.Bowl; + mappings[18481152] = ItemType.MushroomStew; + mappings[18546688] = ItemType.GoldenSword; + mappings[18612224] = ItemType.GoldenShovel; + mappings[18677760] = ItemType.GoldenPickaxe; + mappings[18743296] = ItemType.GoldenAxe; + mappings[18808832] = ItemType.String; + mappings[18874368] = ItemType.Feather; + mappings[18939904] = ItemType.Gunpowder; + mappings[19070976] = ItemType.StoneHoe; + mappings[19136512] = ItemType.IronHoe; + mappings[19202048] = ItemType.DiamondHoe; + mappings[19267584] = ItemType.GoldenHoe; + mappings[19464192] = ItemType.Bread; + mappings[19791872] = ItemType.ChainmailHelmet; + mappings[19857408] = ItemType.ChainmailChestplate; + mappings[19922944] = ItemType.ChainmailLeggings; + mappings[19988480] = ItemType.ChainmailBoots; + mappings[20054016] = ItemType.IronHelmet; + mappings[20119552] = ItemType.IronChestplate; + mappings[20185088] = ItemType.IronLeggings; + mappings[20250624] = ItemType.IronBoots; + mappings[20316160] = ItemType.DiamondHelmet; + mappings[20381696] = ItemType.DiamondChestplate; + mappings[20447232] = ItemType.DiamondLeggings; + mappings[20512768] = ItemType.DiamondBoots; + mappings[20578304] = ItemType.GoldenHelmet; + mappings[20643840] = ItemType.GoldenChestplate; + mappings[20709376] = ItemType.GoldenLeggings; + mappings[20774912] = ItemType.GoldenBoots; + mappings[20840448] = ItemType.Flint; + mappings[20905984] = ItemType.Porkchop; + mappings[20971520] = ItemType.CookedPorkchop; + mappings[21037056] = ItemType.Painting; + mappings[21102592] = ItemType.GoldenApple; + mappings[21102593] = ItemType.EnchantedGoldenApple; + mappings[21168128] = ItemType.OakSign; + mappings[21299200] = ItemType.Bucket; + mappings[21495808] = ItemType.Minecart; + mappings[21561344] = ItemType.Saddle; + mappings[21626880] = ItemType.IronDoor; + mappings[21692416] = ItemType.Redstone; + mappings[21757952] = ItemType.Snowball; + mappings[21823488] = ItemType.OakBoat; + mappings[21954560] = ItemType.MilkBucket; + mappings[22020096] = ItemType.Brick; + mappings[22085632] = ItemType.ClayBall; + mappings[22151168] = ItemType.SugarCane; + mappings[22216704] = ItemType.Paper; + mappings[22282240] = ItemType.Book; + mappings[22347776] = ItemType.SlimeBall; + mappings[22413312] = ItemType.ChestMinecart; + mappings[22478848] = ItemType.FurnaceMinecart; + mappings[22544384] = ItemType.Egg; + mappings[22609920] = ItemType.Compass; + mappings[22675456] = ItemType.FishingRod; + mappings[22740992] = ItemType.Clock; + mappings[22806528] = ItemType.GlowstoneDust; + mappings[22872064] = ItemType.Salmon; + mappings[22872065] = ItemType.Salmon; + mappings[22872066] = ItemType.TropicalFish; + mappings[22872067] = ItemType.Pufferfish; + mappings[22937600] = ItemType.CookedSalmon; + mappings[22937601] = ItemType.CookedSalmon; + mappings[23003136] = ItemType.InkSac; + mappings[23003137] = ItemType.RedDye; + mappings[23003138] = ItemType.GreenDye; + mappings[23003139] = ItemType.CocoaBeans; + mappings[23003140] = ItemType.LapisLazuli; + mappings[23003141] = ItemType.PurpleDye; + mappings[23003142] = ItemType.CyanDye; + mappings[23003143] = ItemType.LightGrayDye; + mappings[23003144] = ItemType.GrayDye; + mappings[23003145] = ItemType.PinkDye; + mappings[23003146] = ItemType.LimeDye; + mappings[23003147] = ItemType.YellowDye; + mappings[23003148] = ItemType.LightBlueDye; + mappings[23003149] = ItemType.MagentaDye; + mappings[23003150] = ItemType.OrangeDye; + mappings[23003151] = ItemType.BoneMeal; + mappings[23068672] = ItemType.Bone; + mappings[23134208] = ItemType.Sugar; + mappings[23199744] = ItemType.Cake; + mappings[23265280] = ItemType.RedBed; + mappings[23330816] = ItemType.Repeater; + mappings[23396352] = ItemType.Cookie; + mappings[23461888] = ItemType.FilledMap; + mappings[23527424] = ItemType.Shears; + mappings[23592960] = ItemType.MelonSlice; + mappings[23658496] = ItemType.PumpkinSeeds; + mappings[23724032] = ItemType.MelonSeeds; + mappings[23789568] = ItemType.Beef; + mappings[23855104] = ItemType.CookedBeef; + mappings[23920640] = ItemType.Chicken; + mappings[23986176] = ItemType.CookedChicken; + mappings[24051712] = ItemType.RottenFlesh; + mappings[24117248] = ItemType.EnderPearl; + mappings[24182784] = ItemType.BlazeRod; + mappings[24248320] = ItemType.GhastTear; + mappings[24313856] = ItemType.GoldNugget; + mappings[24379392] = ItemType.NetherWart; + mappings[24444928] = ItemType.Potion; // Water Bottle + mappings[24453121] = ItemType.Potion; // Regeneration + mappings[24453122] = ItemType.Potion; // Speed/Swiftness + mappings[24453124] = ItemType.Potion; // Poison + mappings[24453129] = ItemType.Potion; // Strength 3 min + mappings[24453131] = ItemType.Potion; // Jump Boost potion + mappings[24453153] = ItemType.Potion; // Regeneration II + mappings[24453154] = ItemType.Potion; // Speed/Swiftness II + mappings[24453155] = ItemType.Potion; // Fire Resistance 3 min + mappings[24453156] = ItemType.Potion; // Poison II + mappings[24453157] = ItemType.Potion; // Instant Health II + mappings[24453158] = ItemType.Potion; // Night Vision 3 min + mappings[24453160] = ItemType.Potion; // Weakness 1 min + mappings[24453161] = ItemType.Potion; // Strength 2 min + mappings[24453162] = ItemType.Potion; // Slowness + mappings[24453163] = ItemType.Potion; // Jump Boost/Leaping 1 min + mappings[24453164] = ItemType.Potion; // Instant Damage II + mappings[24453165] = ItemType.Potion; // Water Breathing 3 min + mappings[24453166] = ItemType.Potion; // Invisibility 3 min + mappings[24453185] = ItemType.Potion; // Regeneration 1 min + mappings[24453186] = ItemType.Potion; // Speed 1 min + mappings[24453187] = ItemType.Potion; // Fire Resistance + mappings[24453188] = ItemType.Potion; // Poison + mappings[24453189] = ItemType.Potion; // Instant Health + mappings[24453190] = ItemType.Potion; // Night Vision 8 min + mappings[24453192] = ItemType.Potion; // Weakness 4 min + mappings[24453193] = ItemType.Potion; // Strength 8 min + mappings[24453194] = ItemType.Potion; // Speed/Swiftness 4 min + mappings[24453195] = ItemType.Potion; // Jump Boost + mappings[24453196] = ItemType.Potion; // Harming/Instant Damage + mappings[24453197] = ItemType.Potion; // Water Breathing 8 min + mappings[24453198] = ItemType.Potion; // Invisibility 8 min + mappings[24461313] = ItemType.Potion; // Splash potion of Regeneration + mappings[24461314] = ItemType.Potion; // Splash potion of Speed/Swiftness 3 min + mappings[24461316] = ItemType.Potion; // Splash potion of Poison + mappings[24461321] = ItemType.Potion; // Splash potion of Strength 3 min + mappings[24461323] = ItemType.Potion; // Splash potion of Jump Boost 3 min + mappings[24461345] = ItemType.Potion; // Splash potion of Regeneration + mappings[24461346] = ItemType.Potion; // Splash potion of Speed/Swiftness 1 min + mappings[24461347] = ItemType.Potion; // Splash potion of Resistance 3 min + mappings[24461348] = ItemType.Potion; // Splash potion of Poison II + mappings[24461349] = ItemType.Potion; // Splash potion of Instant Health II + mappings[24461350] = ItemType.Potion; // Splash potion of Night Vision + mappings[24461352] = ItemType.Potion; // Splash potion of Weakness + mappings[24461353] = ItemType.Potion; // Splash potion of Strength + mappings[24461354] = ItemType.Potion; // Splash potion of Slowness + mappings[24461355] = ItemType.Potion; // Splash potion of Jump Boost + mappings[24461356] = ItemType.Potion; // Splash potion of Harming/Instant Damage II + mappings[24461357] = ItemType.Potion; // Splash potion of Water Breathing 3 min + mappings[24461358] = ItemType.Potion; // Splash potion of Invisibility 3 min + mappings[24461377] = ItemType.Potion; // Splash potion of Regeneration + mappings[24461378] = ItemType.Potion; // Splash potion of Speed 8 min + mappings[24461379] = ItemType.Potion; // Splash potion of Fire Resistance 8 min + mappings[24461380] = ItemType.Potion; // Splash potion of Poison + mappings[24461381] = ItemType.Potion; // Splash potion of Instant Health + mappings[24461382] = ItemType.Potion; // Splash potion of Night Vision 8 min + mappings[24461384] = ItemType.Potion; // Splash potion of Weakness 4 min + mappings[24461385] = ItemType.Potion; // Splash potion of Strength 8 min + mappings[24461386] = ItemType.Potion; // Splash potion of Slowness 4 min + mappings[24461387] = ItemType.Potion; // Splash potion of Jump Boost 8 min + mappings[24461388] = ItemType.Potion; // Splash potion of Harming/Instant Damage + mappings[24461389] = ItemType.Potion; // Splash potion of Water breathing 8 min + mappings[24461390] = ItemType.Potion; // Splash potion of Invisibility 7 min + mappings[24510464] = ItemType.GlassBottle; + mappings[24576000] = ItemType.SpiderEye; + mappings[24641536] = ItemType.FermentedSpiderEye; + mappings[24707072] = ItemType.BlazePowder; + mappings[24772608] = ItemType.MagmaCream; + mappings[24838144] = ItemType.BrewingStand; + mappings[24903680] = ItemType.Cauldron; + mappings[24969216] = ItemType.EnderEye; + mappings[25034752] = ItemType.GlisteringMelonSlice; + mappings[25100338] = ItemType.CreeperSpawnEgg; + mappings[25100339] = ItemType.SkeletonSpawnEgg; + mappings[25100340] = ItemType.SpiderSpawnEgg; + mappings[25100342] = ItemType.ZombieSpawnEgg; + mappings[25100343] = ItemType.SlimeSpawnEgg; + mappings[25100344] = ItemType.GhastSpawnEgg; + mappings[25100345] = ItemType.ZombifiedPiglinSpawnEgg; + mappings[25100346] = ItemType.EndermanSpawnEgg; + mappings[25100347] = ItemType.CaveSpiderSpawnEgg; + mappings[25100348] = ItemType.SilverfishSpawnEgg; + mappings[25100349] = ItemType.BlazeSpawnEgg; + mappings[25100350] = ItemType.MagmaCubeSpawnEgg; + mappings[25100353] = ItemType.BatSpawnEgg; + mappings[25100354] = ItemType.WitchSpawnEgg; + mappings[25100355] = ItemType.EndermiteSpawnEgg; + mappings[25100356] = ItemType.GuardianSpawnEgg; + mappings[25100378] = ItemType.PigSpawnEgg; + mappings[25100379] = ItemType.SheepSpawnEgg; + mappings[25100380] = ItemType.CowSpawnEgg; + mappings[25100381] = ItemType.ChickenSpawnEgg; + mappings[25100382] = ItemType.SquidSpawnEgg; + mappings[25100383] = ItemType.WolfSpawnEgg; + mappings[25100384] = ItemType.MooshroomSpawnEgg; + mappings[25100386] = ItemType.OcelotSpawnEgg; + mappings[25100388] = ItemType.HorseSpawnEgg; + mappings[25100389] = ItemType.RabbitSpawnEgg; + mappings[25100408] = ItemType.VillagerSpawnEgg; + mappings[25165824] = ItemType.ExperienceBottle; + mappings[25231360] = ItemType.FireCharge; + mappings[25427968] = ItemType.Emerald; + mappings[25493504] = ItemType.ItemFrame; + mappings[25559040] = ItemType.FlowerPot; + mappings[25624576] = ItemType.Carrot; + mappings[25690112] = ItemType.Potato; + mappings[25755648] = ItemType.BakedPotato; + mappings[25821184] = ItemType.PoisonousPotato; + mappings[25886720] = ItemType.Map; + mappings[25952256] = ItemType.GoldenCarrot; + mappings[26017792] = ItemType.SkeletonSkull; + mappings[26017793] = ItemType.WitherSkeletonSkull; + mappings[26017794] = ItemType.ZombieHead; + mappings[26017795] = ItemType.PlayerHead; + mappings[26017796] = ItemType.CreeperHead; + mappings[26083328] = ItemType.CarrotOnAStick; + mappings[26148864] = ItemType.NetherStar; + mappings[26214400] = ItemType.PumpkinPie; + mappings[26279936] = ItemType.FireworkRocket; + mappings[26345472] = ItemType.FireworkStar; + mappings[26411008] = ItemType.EnchantedBook; + mappings[26476544] = ItemType.Comparator; + mappings[26542080] = ItemType.NetherBrick; + mappings[26607616] = ItemType.Quartz; + mappings[26673152] = ItemType.TntMinecart; + mappings[26738688] = ItemType.HopperMinecart; + mappings[26804224] = ItemType.PrismarineShard; + mappings[26869760] = ItemType.PrismarineCrystals; + mappings[26935296] = ItemType.Rabbit; + mappings[27000832] = ItemType.CookedRabbit; + mappings[27066368] = ItemType.RabbitStew; + mappings[27131904] = ItemType.RabbitFoot; + mappings[27197440] = ItemType.RabbitHide; + mappings[27262976] = ItemType.ArmorStand; + mappings[27328512] = ItemType.IronHorseArmor; + mappings[27394048] = ItemType.GoldenHorseArmor; + mappings[27459584] = ItemType.DiamondHorseArmor; + mappings[27590656] = ItemType.NameTag; + mappings[27656192] = ItemType.CommandBlockMinecart; + mappings[27721728] = ItemType.Mutton; + mappings[27787264] = ItemType.CookedMutton; + mappings[27852800] = ItemType.BlackBanner; + mappings[1966080] = ItemType.Cobweb; + mappings[2293760] = ItemType.WhiteWool; + mappings[2293761] = ItemType.OrangeWool; + mappings[2293762] = ItemType.MagentaWool; + mappings[2293763] = ItemType.LightBlueWool; + mappings[2293764] = ItemType.YellowWool; + mappings[2293765] = ItemType.LimeWool; + mappings[2293766] = ItemType.PinkWool; + mappings[2293767] = ItemType.GrayWool; + mappings[2293768] = ItemType.LightGrayWool; + mappings[2293769] = ItemType.CyanWool; + mappings[2293770] = ItemType.PurpleWool; + mappings[2293771] = ItemType.BlueWool; + mappings[2293772] = ItemType.BrownWool; + mappings[2293773] = ItemType.GreenWool; + mappings[2293774] = ItemType.RedWool; + mappings[2293775] = ItemType.BlackWool; + mappings[2424832] = ItemType.Dandelion; + mappings[4718592] = ItemType.OakPressurePlate; + mappings[7274496] = ItemType.LilyPad; + mappings[8257536] = ItemType.OakSlab; + mappings[8257537] = ItemType.SpruceSlab; + mappings[8257538] = ItemType.BirchSlab; + mappings[8257539] = ItemType.JungleSlab; + mappings[8257540] = ItemType.AcaciaSlab; + mappings[8257541] = ItemType.DarkOakSlab; + mappings[9371648] = ItemType.OakButton; + mappings[17563648] = ItemType.WoodenSword; + mappings[17629184] = ItemType.WoodenShovel; + mappings[17694720] = ItemType.WoodenPickaxe; + mappings[17760256] = ItemType.WoodenAxe; + mappings[19005440] = ItemType.WoodenHoe; + mappings[19333120] = ItemType.WheatSeeds; + mappings[19398656] = ItemType.Wheat; + mappings[21233664] = ItemType.OakDoor; + mappings[21364736] = ItemType.WaterBucket; + mappings[25296896] = ItemType.WritableBook; + mappings[25362432] = ItemType.WrittenBook; + mappings[27852801] = ItemType.RedBanner; + mappings[27852802] = ItemType.GreenBanner; + mappings[27852803] = ItemType.BrownBanner; + mappings[27852804] = ItemType.BlueBanner; + mappings[27852805] = ItemType.PurpleBanner; + mappings[27852806] = ItemType.CyanBanner; + mappings[27852807] = ItemType.LightGrayBanner; + mappings[27852808] = ItemType.GrayBanner; + mappings[27852809] = ItemType.PinkBanner; + mappings[27852810] = ItemType.LimeBanner; + mappings[27852811] = ItemType.YellowBanner; + mappings[27852812] = ItemType.LightBlueBanner; + mappings[27852813] = ItemType.MagentaBanner; + mappings[27852814] = ItemType.OrangeBanner; + mappings[27852815] = ItemType.WhiteBanner; + mappings[27983872] = ItemType.SpruceDoor; + mappings[28049408] = ItemType.BirchDoor; + mappings[28114944] = ItemType.JungleDoor; + mappings[28180480] = ItemType.AcaciaDoor; + mappings[28246016] = ItemType.DarkOakDoor; + mappings[10551296] = ItemType.AcaciaLeaves; + mappings[10551297] = ItemType.DarkOakLeaves; + mappings[19529728] = ItemType.LeatherHelmet; + mappings[19595264] = ItemType.LeatherChestplate; + mappings[19660800] = ItemType.LeatherLeggings; + mappings[19726336] = ItemType.LeatherBoots; + mappings[21430272] = ItemType.LavaBucket; + mappings[21889024] = ItemType.Leather; + mappings[27525120] = ItemType.Lead; + mappings[147849216] = ItemType.MusicDisc13; + mappings[147914752] = ItemType.MusicDiscCat; + mappings[147980288] = ItemType.MusicDiscBlocks; + mappings[148045824] = ItemType.MusicDiscChirp; + mappings[148111360] = ItemType.MusicDiscFar; + mappings[148176896] = ItemType.MusicDiscMall; + mappings[148242432] = ItemType.MusicDiscMellohi; + mappings[148307968] = ItemType.MusicDiscStal; + mappings[148373504] = ItemType.MusicDiscStrad; + mappings[148439040] = ItemType.MusicDiscWard; + mappings[148504576] = ItemType.MusicDisc11; + mappings[148570112] = ItemType.MusicDiscWait; + + } + + protected override Dictionary GetDict() + { + return mappings; + } + } +} diff --git a/MinecraftClient/Protocol/Handlers/DataTypes.cs b/MinecraftClient/Protocol/Handlers/DataTypes.cs index 59a63ed9e2..dd109709cb 100644 --- a/MinecraftClient/Protocol/Handlers/DataTypes.cs +++ b/MinecraftClient/Protocol/Handlers/DataTypes.cs @@ -420,38 +420,36 @@ public Dictionary ReadNextNbt(Queue cache) public Item? ReadNextItemSlot(Queue cache, ItemPalette itemPalette) { // MC 1.13.2 and greater - if (protocolversion > Protocol18Handler.MC_1_13_Version) + if (protocolversion >= Protocol18Handler.MC_1_13_Version) { - bool itemPresent = ReadNextBool(cache); - if (itemPresent) - { - int itemID = ReadNextVarInt(cache); + var itemPresent = ReadNextBool(cache); - if (itemID == -1) - return null; + if (!itemPresent) + return null; - ItemType type = itemPalette.FromId(itemID); - byte itemCount = ReadNextByte(cache); - Dictionary nbt = ReadNextNbt(cache); - return new Item(type, itemCount, nbt); - } - else return null; + var itemId = ReadNextVarInt(cache); + + if (itemId == -1) + return null; + + var type = itemPalette.FromId(itemId); + var itemCount = ReadNextByte(cache); + var nbt = ReadNextNbt(cache); + return new Item(type, itemCount, nbt); } else { - // MC 1.13 and lower - short itemID = ReadNextShort(cache); + var itemId = ReadNextShort(cache); - if (itemID == -1) + if (itemId == -1) return null; - byte itemCount = ReadNextByte(cache); + var itemCount = ReadNextByte(cache); + var data = ReadNextShort(cache); + var nbt = ReadNextNbt(cache); - if (protocolversion < Protocol18Handler.MC_1_13_Version) - ReadNextShort(cache); - - Dictionary nbt = ReadNextNbt(cache); - return new Item(itemPalette.FromId(itemID), itemCount, nbt); + // For 1.8 - 1.12.2 we combine Item Id and Item Data/Damage to a single value using: (id << 16) | data + return new Item(itemPalette.FromId((itemId << 16) | (ushort)data), itemCount, data, nbt); } } @@ -561,13 +559,14 @@ private Dictionary ReadNextNbt(Queue cache, bool root) cache.Dequeue(); return nbtData; } - + var nextId = cache.Dequeue(); if (protocolversion < Protocol18Handler.MC_1_20_2_Version) { if (nextId is not 10) // TAG_Compound - throw new System.IO.InvalidDataException("Failed to decode NBT: Does not start with TAG_Compound"); - + throw new System.IO.InvalidDataException( + "Failed to decode NBT: Does not start with TAG_Compound"); + // NBT root name var rootName = Encoding.ASCII.GetString(ReadData(ReadNextUShort(cache), cache)); @@ -579,14 +578,15 @@ private Dictionary ReadNextNbt(Queue cache, bool root) else { if (nextId is not (10 or 8)) // TAG_Compound or TAG_String - throw new System.IO.InvalidDataException("Failed to decode NBT: Does not start with TAG_Compound or TAG_String"); - + throw new System.IO.InvalidDataException( + "Failed to decode NBT: Does not start with TAG_Compound or TAG_String"); + // Read TAG_String - if(nextId is 8) + if (nextId is 8) { var byteArrayLength = ReadNextUShort(cache); var result = Encoding.UTF8.GetString(ReadData(byteArrayLength, cache)); - + return new Dictionary() { { "", result } @@ -900,7 +900,8 @@ public void ReadParticleData(Queue cache, ItemPalette itemPalette) break; case 14: // 1.15 - 1.16.5 and 1.18 - 1.19.4 - if (protocolversion is >= Protocol18Handler.MC_1_15_Version and < Protocol18Handler.MC_1_17_Version or > Protocol18Handler.MC_1_17_1_Version) + if (protocolversion is >= Protocol18Handler.MC_1_15_Version and < Protocol18Handler.MC_1_17_Version + or > Protocol18Handler.MC_1_17_1_Version) ReadDustParticle(cache); break; case 15: @@ -926,12 +927,14 @@ public void ReadParticleData(Queue cache, ItemPalette itemPalette) break; case 24: // 1.18 - 1.19.2 onwards - if (protocolversion is > Protocol18Handler.MC_1_17_1_Version and < Protocol18Handler.MC_1_19_3_Version) + if (protocolversion is > Protocol18Handler.MC_1_17_1_Version + and < 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 is Protocol18Handler.MC_1_17_Version or Protocol18Handler.MC_1_17_1_Version or >= Protocol18Handler.MC_1_19_3_Version) + if (protocolversion is Protocol18Handler.MC_1_17_Version or Protocol18Handler.MC_1_17_1_Version + or >= Protocol18Handler.MC_1_19_3_Version) ReadNextVarInt(cache); // Block State (minecraft:falling_dust) break; case 27: @@ -1442,8 +1445,11 @@ public byte[] GetItemSlot(Item? item, ItemPalette itemPalette) slotData.AddRange(GetShort(-1)); else { - slotData.AddRange(GetShort((short)itemPalette.ToId(item.Type))); + // For 1.8 - 1.12.2 we combine Item Id and Item Data to a single value using: (id << 16) | data + // Thus to get an ID we do a right shift by 16 bits + slotData.AddRange(GetShort((short)(itemPalette.ToId(item.Type) >> 16))); slotData.Add((byte)item.Count); + slotData.Add((byte)item.Data); slotData.AddRange(GetNbt(item.NBT)); } } diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs index b4b3d98f30..6627f8dbab 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs @@ -128,7 +128,7 @@ public Protocol18Handler(TcpClient Client, int protocolVersion, IMinecraftComHan } if (handler.GetInventoryEnabled() && - protocolVersion is < MC_1_9_Version or > MC_1_20_4_Version) + protocolVersion is < MC_1_8_Version or > MC_1_20_4_Version) { log.Error($"§c{Translations.extra_inventory_disabled}"); handler.SetInventoryEnabled(false); @@ -195,7 +195,8 @@ public Protocol18Handler(TcpClient Client, int protocolVersion, IMinecraftComHan >= MC_1_17_Version => new ItemPalette117(), >= MC_1_16_2_Version => new ItemPalette1162(), >= MC_1_16_1_Version => new ItemPalette1161(), - _ => new ItemPalette115() + >= MC_1_15_Version => new ItemPalette115(), + _ => new ItemPalette18() }; ChatParser.ChatId2Type = this.protocolVersion switch From a19a91e37fe490b5c6384c2723857c8fb0c91555 Mon Sep 17 00:00:00 2001 From: Anon Date: Tue, 12 Mar 2024 12:58:29 +0100 Subject: [PATCH 2/7] Added Item palette for 1.9 --- .../Inventory/ItemPalettes/ItemPalette19.cs | 607 ++++++++++++++++++ .../Protocol/Handlers/Protocol18.cs | 5 +- 2 files changed, 609 insertions(+), 3 deletions(-) create mode 100644 MinecraftClient/Inventory/ItemPalettes/ItemPalette19.cs diff --git a/MinecraftClient/Inventory/ItemPalettes/ItemPalette19.cs b/MinecraftClient/Inventory/ItemPalettes/ItemPalette19.cs new file mode 100644 index 0000000000..332ff5b730 --- /dev/null +++ b/MinecraftClient/Inventory/ItemPalettes/ItemPalette19.cs @@ -0,0 +1,607 @@ +using System.Collections.Generic; + +namespace MinecraftClient.Inventory.ItemPalettes +{ + /// + /// For MC 1.8 + /// Done manually by Milutinke :( + /// + public class ItemPalette19 : ItemPalette + { + private static readonly Dictionary mappings = new(); + + static ItemPalette19() + { + // Mapping IDs are a derived from: (Item ID << 16) | Data + mappings[0] = ItemType.Air; + mappings[65536] = ItemType.Stone; + mappings[65537] = ItemType.Granite; + mappings[65538] = ItemType.PolishedGranite; + mappings[65539] = ItemType.Diorite; + mappings[65540] = ItemType.PolishedDiorite; + mappings[65541] = ItemType.Andesite; + mappings[65542] = ItemType.PolishedAndesite; + mappings[131072] = ItemType.GrassBlock; + mappings[196608] = ItemType.Dirt; + mappings[196609] = ItemType.CoarseDirt; + mappings[196610] = ItemType.Podzol; + mappings[262144] = ItemType.Cobblestone; + mappings[327680] = ItemType.OakPlanks; + mappings[327681] = ItemType.SprucePlanks; + mappings[327682] = ItemType.BirchPlanks; + mappings[327683] = ItemType.JunglePlanks; + mappings[327684] = ItemType.AcaciaPlanks; + mappings[327685] = ItemType.DarkOakPlanks; + mappings[393216] = ItemType.OakSapling; + mappings[393217] = ItemType.SpruceSapling; + mappings[393218] = ItemType.BirchSapling; + mappings[393219] = ItemType.JungleSapling; + mappings[393220] = ItemType.AcaciaSapling; + mappings[393221] = ItemType.DarkOakSapling; + mappings[458752] = ItemType.Bedrock; + mappings[524288] = ItemType.WaterBucket; // Still Water Block Item + mappings[589824] = ItemType.WaterBucket; // Flowing Water Block Item + mappings[655360] = ItemType.LavaBucket; // Still Lava Block Item + mappings[720896] = ItemType.LavaBucket; // Flowing Lava Block Item + mappings[786432] = ItemType.Sand; + mappings[786433] = ItemType.RedSand; + mappings[851968] = ItemType.Gravel; + mappings[917504] = ItemType.GoldOre; + mappings[983040] = ItemType.IronOre; + mappings[1048576] = ItemType.CoalOre; + mappings[1114112] = ItemType.OakLog; + mappings[1114113] = ItemType.SpruceLog; + mappings[1114114] = ItemType.BirchLog; + mappings[1114115] = ItemType.JungleLog; + mappings[1179648] = ItemType.OakLeaves; + mappings[1179649] = ItemType.SpruceLeaves; + mappings[1179650] = ItemType.BirchLeaves; + mappings[1179651] = ItemType.JungleLeaves; + mappings[1245184] = ItemType.Sponge; + mappings[1245185] = ItemType.WetSponge; + mappings[1310720] = ItemType.Glass; + mappings[1376256] = ItemType.LapisOre; + mappings[1441792] = ItemType.LapisBlock; + mappings[1507328] = ItemType.Dispenser; + mappings[1769472] = ItemType.PoweredRail; + mappings[1835008] = ItemType.DetectorRail; + mappings[1900544] = ItemType.StickyPiston; + mappings[2031617] = ItemType.Grass; + mappings[2031618] = ItemType.Fern; + mappings[2097152] = ItemType.DeadBush; + mappings[2293760] = ItemType.WhiteWool; + mappings[2293761] = ItemType.OrangeWool; + mappings[2293762] = ItemType.MagentaWool; + mappings[2293763] = ItemType.LightBlueWool; + mappings[2293764] = ItemType.YellowWool; + mappings[2293765] = ItemType.LimeWool; + mappings[2293766] = ItemType.PinkWool; + mappings[2293767] = ItemType.GrayWool; + mappings[2293768] = ItemType.LightGrayWool; + mappings[2293769] = ItemType.CyanWool; + mappings[2293770] = ItemType.PurpleWool; + mappings[2293771] = ItemType.BlueWool; + mappings[2293772] = ItemType.BrownWool; + mappings[2293773] = ItemType.GreenWool; + mappings[2293774] = ItemType.RedWool; + mappings[2293775] = ItemType.BlackWool; + mappings[2424832] = ItemType.Dandelion; + mappings[2555904] = ItemType.BrownMushroom; + mappings[2686976] = ItemType.GoldBlock; + mappings[2752512] = ItemType.IronBlock; + mappings[2883584] = ItemType.StoneSlab; + mappings[2883585] = ItemType.SandstoneSlab; + mappings[2883587] = ItemType.CobblestoneSlab; + mappings[2883588] = ItemType.BrickSlab; + mappings[2883589] = ItemType.StoneBrickSlab; + mappings[2883590] = ItemType.NetherBrickSlab; + mappings[2883591] = ItemType.QuartzSlab; + mappings[2949120] = ItemType.Bricks; + mappings[3014656] = ItemType.Tnt; + mappings[3080192] = ItemType.Bookshelf; + mappings[3276800] = ItemType.Torch; + mappings[3538944] = ItemType.Chest; + mappings[3670016] = ItemType.DiamondOre; + mappings[3735552] = ItemType.DiamondBlock; + mappings[3801088] = ItemType.CraftingTable; + mappings[3932160] = ItemType.Farmland; + mappings[3997696] = ItemType.Furnace; + mappings[4259840] = ItemType.Ladder; + mappings[4390912] = ItemType.CobblestoneStairs; + mappings[4587520] = ItemType.StonePressurePlate; + mappings[4718592] = ItemType.OakPressurePlate; + mappings[5046272] = ItemType.StoneButton; + mappings[5177344] = ItemType.Ice; + mappings[5308416] = ItemType.Cactus; + mappings[5373952] = ItemType.Clay; + mappings[5505024] = ItemType.Jukebox; + mappings[5570560] = ItemType.OakFence; + mappings[5832704] = ItemType.Glowstone; + mappings[6225920] = ItemType.WhiteStainedGlass; + mappings[6225921] = ItemType.OrangeStainedGlass; + mappings[6225922] = ItemType.MagentaStainedGlass; + mappings[6225923] = ItemType.LightBlueStainedGlass; + mappings[6225924] = ItemType.YellowStainedGlass; + mappings[6225925] = ItemType.LimeStainedGlass; + mappings[6225926] = ItemType.PinkStainedGlass; + mappings[6225927] = ItemType.GrayStainedGlass; + mappings[6225928] = ItemType.LightGrayStainedGlass; + mappings[6225929] = ItemType.CyanStainedGlass; + mappings[6225930] = ItemType.PurpleStainedGlass; + mappings[6225931] = ItemType.BlueStainedGlass; + mappings[6225932] = ItemType.BrownStainedGlass; + mappings[6225933] = ItemType.GreenStainedGlass; + mappings[6225934] = ItemType.RedStainedGlass; + mappings[6225935] = ItemType.BlackStainedGlass; + mappings[6291456] = ItemType.OakTrapdoor; + mappings[6422528] = ItemType.StoneBricks; + mappings[6422529] = ItemType.MossyStoneBricks; + mappings[6422530] = ItemType.CrackedStoneBricks; + mappings[6422531] = ItemType.ChiseledStoneBricks; + mappings[6488064] = ItemType.BrownMushroomBlock; + mappings[6619136] = ItemType.IronBars; + mappings[6684672] = ItemType.GlassPane; + mappings[6946816] = ItemType.Vine; + mappings[7012352] = ItemType.OakFenceGate; + mappings[7077888] = ItemType.BrickStairs; + mappings[7143424] = ItemType.StoneBrickStairs; + mappings[7602176] = ItemType.EnchantingTable; + mappings[7864320] = ItemType.EndPortalFrame; + mappings[7929856] = ItemType.EndStone; + mappings[7995392] = ItemType.DragonEgg; + mappings[8257536] = ItemType.OakSlab; + mappings[8257537] = ItemType.SpruceSlab; + mappings[8257538] = ItemType.BirchSlab; + mappings[8257539] = ItemType.JungleSlab; + mappings[8257540] = ItemType.AcaciaSlab; + mappings[8257541] = ItemType.DarkOakSlab; + mappings[8454144] = ItemType.EmeraldOre; + mappings[8519680] = ItemType.EnderChest; + mappings[8585216] = ItemType.TripwireHook; + mappings[8716288] = ItemType.EmeraldBlock; + mappings[8781824] = ItemType.SpruceStairs; + mappings[8847360] = ItemType.BirchStairs; + mappings[8912896] = ItemType.JungleStairs; + mappings[8978432] = ItemType.CommandBlock; + mappings[9043968] = ItemType.Beacon; + mappings[9109504] = ItemType.CobblestoneWall; + mappings[1572864] = ItemType.Sandstone; + mappings[1572865] = ItemType.ChiseledSandstone; + mappings[1572866] = ItemType.SmoothSandstone; + mappings[1638400] = ItemType.NoteBlock; + mappings[2162688] = ItemType.Piston; + mappings[2490368] = ItemType.Poppy; + mappings[2490369] = ItemType.BlueOrchid; + mappings[2490370] = ItemType.Allium; + mappings[2490371] = ItemType.AzureBluet; + mappings[2490372] = ItemType.RedTulip; + mappings[2490373] = ItemType.OrangeTulip; + mappings[2490374] = ItemType.WhiteTulip; + mappings[2490375] = ItemType.PinkTulip; + mappings[2490376] = ItemType.OxeyeDaisy; + mappings[2621440] = ItemType.RedMushroom; + mappings[3145728] = ItemType.MossyCobblestone; + mappings[3211264] = ItemType.Obsidian; + mappings[3407872] = ItemType.Spawner; + mappings[3473408] = ItemType.OakStairs; + mappings[4325376] = ItemType.Rail; + mappings[4521984] = ItemType.Lever; + mappings[4784128] = ItemType.RedstoneOre; + mappings[4980736] = ItemType.RedstoneTorch; + mappings[5111808] = ItemType.Snow; + mappings[5242880] = ItemType.SnowBlock; + mappings[5636096] = ItemType.Pumpkin; + mappings[5701632] = ItemType.Netherrack; + mappings[5767168] = ItemType.SoulSand; + mappings[5963776] = ItemType.JackOLantern; + mappings[6356992] = ItemType.InfestedStone; + mappings[6356993] = ItemType.InfestedCobblestone; + mappings[6356994] = ItemType.InfestedStoneBricks; + mappings[6356995] = ItemType.InfestedMossyStoneBricks; + mappings[6356996] = ItemType.InfestedCrackedStoneBricks; + mappings[6356997] = ItemType.InfestedChiseledStoneBricks; + mappings[6553600] = ItemType.RedMushroomBlock; + mappings[6750208] = ItemType.Melon; + mappings[7208960] = ItemType.Mycelium; + mappings[7340032] = ItemType.NetherBricks; + mappings[7405568] = ItemType.NetherBrickFence; + mappings[7471104] = ItemType.NetherBrickStairs; + mappings[8060928] = ItemType.RedstoneLamp; + mappings[8388608] = ItemType.SandstoneStairs; + mappings[9109505] = ItemType.MossyCobblestoneWall; + mappings[9371648] = ItemType.OakButton; + mappings[9502720] = ItemType.Anvil; + mappings[9502721] = ItemType.ChippedAnvil; + mappings[9502722] = ItemType.DamagedAnvil; + mappings[9568256] = ItemType.TrappedChest; + mappings[9633792] = ItemType.LightWeightedPressurePlate; + mappings[9699328] = ItemType.HeavyWeightedPressurePlate; + mappings[9895936] = ItemType.DaylightDetector; + mappings[9961472] = ItemType.RedstoneBlock; + mappings[10027008] = ItemType.NetherQuartzOre; + mappings[10092544] = ItemType.Hopper; + mappings[10158080] = ItemType.QuartzBlock; + mappings[10158081] = ItemType.ChiseledQuartzBlock; + mappings[10158082] = ItemType.QuartzPillar; + mappings[10223616] = ItemType.QuartzStairs; + mappings[10289152] = ItemType.ActivatorRail; + mappings[10354688] = ItemType.Dropper; + mappings[10420224] = ItemType.WhiteTerracotta; + mappings[10420225] = ItemType.OrangeTerracotta; + mappings[10420226] = ItemType.MagentaTerracotta; + mappings[10420227] = ItemType.LightBlueTerracotta; + mappings[10420228] = ItemType.YellowTerracotta; + mappings[10420229] = ItemType.LimeTerracotta; + mappings[10420230] = ItemType.PinkTerracotta; + mappings[10420231] = ItemType.GrayTerracotta; + mappings[10420232] = ItemType.LightGrayTerracotta; + mappings[10420233] = ItemType.CyanTerracotta; + mappings[10420234] = ItemType.PurpleTerracotta; + mappings[10420235] = ItemType.BlueTerracotta; + mappings[10420236] = ItemType.BrownTerracotta; + mappings[10420237] = ItemType.GreenTerracotta; + mappings[10420238] = ItemType.RedTerracotta; + mappings[10420239] = ItemType.BlackTerracotta; + mappings[10485760] = ItemType.WhiteStainedGlassPane; + mappings[10485761] = ItemType.OrangeStainedGlassPane; + mappings[10485762] = ItemType.MagentaStainedGlassPane; + mappings[10485763] = ItemType.LightBlueStainedGlassPane; + mappings[10485764] = ItemType.YellowStainedGlassPane; + mappings[10485765] = ItemType.LimeStainedGlassPane; + mappings[10485766] = ItemType.PinkStainedGlassPane; + mappings[10485767] = ItemType.GrayStainedGlassPane; + mappings[10485768] = ItemType.LightGrayStainedGlassPane; + mappings[10485769] = ItemType.CyanStainedGlassPane; + mappings[10485770] = ItemType.PurpleStainedGlassPane; + mappings[10485771] = ItemType.BlueStainedGlassPane; + mappings[10485772] = ItemType.BrownStainedGlassPane; + mappings[10485773] = ItemType.GreenStainedGlassPane; + mappings[10485774] = ItemType.RedStainedGlassPane; + mappings[10485775] = ItemType.BlackStainedGlassPane; + mappings[10551296] = ItemType.AcaciaLeaves; + mappings[10551297] = ItemType.DarkOakLeaves; + mappings[10616832] = ItemType.AcaciaLog; + mappings[10616833] = ItemType.DarkOakLog; + mappings[10682368] = ItemType.AcaciaStairs; + mappings[10747904] = ItemType.DarkOakStairs; + mappings[10813440] = ItemType.SlimeBlock; + mappings[10878976] = ItemType.Barrier; + mappings[10944512] = ItemType.IronTrapdoor; + mappings[11010048] = ItemType.Prismarine; + mappings[11010049] = ItemType.PrismarineBricks; + mappings[11010050] = ItemType.DarkPrismarine; + mappings[11075584] = ItemType.SeaLantern; + mappings[11141120] = ItemType.HayBlock; + mappings[11206656] = ItemType.WhiteCarpet; + mappings[11206657] = ItemType.OrangeCarpet; + mappings[11206658] = ItemType.MagentaCarpet; + mappings[11206659] = ItemType.LightBlueCarpet; + mappings[11206660] = ItemType.YellowCarpet; + mappings[11206661] = ItemType.LimeCarpet; + mappings[11206662] = ItemType.PinkCarpet; + mappings[11206663] = ItemType.GrayCarpet; + mappings[11206664] = ItemType.LightGrayCarpet; + mappings[11206665] = ItemType.CyanCarpet; + mappings[11206666] = ItemType.PurpleCarpet; + mappings[11206667] = ItemType.BlueCarpet; + mappings[11206668] = ItemType.BrownCarpet; + mappings[11206669] = ItemType.GreenCarpet; + mappings[11206670] = ItemType.RedCarpet; + mappings[11206671] = ItemType.BlackCarpet; + mappings[11272192] = ItemType.Terracotta; + mappings[11337728] = ItemType.CoalBlock; + mappings[11403264] = ItemType.PackedIce; + mappings[11468800] = ItemType.Sunflower; + mappings[11468801] = ItemType.Lilac; + mappings[11468802] = ItemType.TallGrass; + mappings[11468803] = ItemType.LargeFern; + mappings[11468804] = ItemType.RoseBush; + mappings[11468805] = ItemType.Peony; + mappings[11730944] = ItemType.RedSandstone; + mappings[11730945] = ItemType.ChiseledRedSandstone; + mappings[11730946] = ItemType.SmoothRedSandstone; + mappings[11796480] = ItemType.RedSandstoneStairs; + mappings[11927552] = ItemType.RedSandstoneSlab; + mappings[11993088] = ItemType.SpruceFenceGate; + mappings[12058624] = ItemType.BirchFenceGate; + mappings[12124160] = ItemType.JungleFenceGate; + mappings[12189696] = ItemType.DarkOakFenceGate; + mappings[12255232] = ItemType.AcaciaFenceGate; + mappings[12320768] = ItemType.SpruceFence; + mappings[12386304] = ItemType.BirchFence; + mappings[12451840] = ItemType.JungleFence; + mappings[12517376] = ItemType.DarkOakFence; + mappings[12582912] = ItemType.AcaciaFence; + mappings[12976128] = ItemType.EndRod; + mappings[13041664] = ItemType.ChorusPlant; + mappings[13107200] = ItemType.ChorusFlower; + mappings[13172736] = ItemType.PurpurBlock; + mappings[13238272] = ItemType.PurpurPillar; + mappings[13303808] = ItemType.PurpurStairs; + mappings[13434880] = ItemType.PurpurSlab; + mappings[13500416] = ItemType.EndStoneBricks; + mappings[13631488] = ItemType.DirtPath; + mappings[13762560] = ItemType.RepeatingCommandBlock; + mappings[13828096] = ItemType.ChainCommandBlock; + mappings[16777216] = ItemType.IronShovel; + mappings[16842752] = ItemType.IronPickaxe; + mappings[16908288] = ItemType.IronAxe; + mappings[16973824] = ItemType.FlintAndSteel; + mappings[17039360] = ItemType.Apple; + mappings[17104896] = ItemType.Bow; + mappings[17170432] = ItemType.Arrow; + mappings[17235968] = ItemType.Coal; + mappings[17235969] = ItemType.Charcoal; + mappings[17301504] = ItemType.Diamond; + mappings[17367040] = ItemType.IronIngot; + mappings[17432576] = ItemType.GoldIngot; + mappings[17498112] = ItemType.IronSword; + mappings[17563648] = ItemType.WoodenSword; + mappings[17629184] = ItemType.WoodenShovel; + mappings[17694720] = ItemType.WoodenPickaxe; + mappings[17760256] = ItemType.WoodenAxe; + mappings[17825792] = ItemType.StoneSword; + mappings[17891328] = ItemType.StoneShovel; + mappings[17956864] = ItemType.StonePickaxe; + mappings[18022400] = ItemType.StoneAxe; + mappings[18087936] = ItemType.DiamondSword; + mappings[18153472] = ItemType.DiamondShovel; + mappings[18219008] = ItemType.DiamondPickaxe; + mappings[18284544] = ItemType.DiamondAxe; + mappings[18350080] = ItemType.Stick; + mappings[18415616] = ItemType.Bowl; + mappings[18481152] = ItemType.MushroomStew; + mappings[18546688] = ItemType.GoldenSword; + mappings[18612224] = ItemType.GoldenShovel; + mappings[18677760] = ItemType.GoldenPickaxe; + mappings[18743296] = ItemType.GoldenAxe; + mappings[18808832] = ItemType.String; + mappings[18874368] = ItemType.Feather; + mappings[18939904] = ItemType.Gunpowder; + mappings[19005440] = ItemType.WoodenHoe; + mappings[19070976] = ItemType.StoneHoe; + mappings[19136512] = ItemType.IronHoe; + mappings[19202048] = ItemType.DiamondHoe; + mappings[19267584] = ItemType.GoldenHoe; + mappings[19333120] = ItemType.WheatSeeds; + mappings[19464192] = ItemType.Bread; + mappings[19529728] = ItemType.LeatherHelmet; + mappings[19595264] = ItemType.LeatherChestplate; + mappings[19660800] = ItemType.LeatherLeggings; + mappings[19726336] = ItemType.LeatherBoots; + mappings[19791872] = ItemType.ChainmailHelmet; + mappings[19857408] = ItemType.ChainmailChestplate; + mappings[19922944] = ItemType.ChainmailLeggings; + mappings[19988480] = ItemType.ChainmailBoots; + mappings[20054016] = ItemType.IronHelmet; + mappings[20119552] = ItemType.IronChestplate; + mappings[20185088] = ItemType.IronLeggings; + mappings[20250624] = ItemType.IronBoots; + mappings[20316160] = ItemType.DiamondHelmet; + mappings[20381696] = ItemType.DiamondChestplate; + mappings[20447232] = ItemType.DiamondLeggings; + mappings[20512768] = ItemType.DiamondBoots; + mappings[20578304] = ItemType.GoldenHelmet; + mappings[20643840] = ItemType.GoldenChestplate; + mappings[20709376] = ItemType.GoldenLeggings; + mappings[20774912] = ItemType.GoldenBoots; + mappings[20840448] = ItemType.Flint; + mappings[20905984] = ItemType.Porkchop; + mappings[20971520] = ItemType.CookedPorkchop; + mappings[21037056] = ItemType.Painting; + mappings[21102592] = ItemType.GoldenApple; + mappings[21102593] = ItemType.EnchantedGoldenApple; + mappings[21168128] = ItemType.OakSign; + mappings[21233664] = ItemType.OakDoor; + mappings[21299200] = ItemType.Bucket; + mappings[21430272] = ItemType.LavaBucket; + mappings[21495808] = ItemType.Minecart; + mappings[21561344] = ItemType.Saddle; + mappings[21626880] = ItemType.IronDoor; + mappings[21692416] = ItemType.Redstone; + mappings[21757952] = ItemType.Snowball; + mappings[21823488] = ItemType.OakBoat; + mappings[21889024] = ItemType.Leather; + mappings[21954560] = ItemType.MilkBucket; + mappings[22020096] = ItemType.Brick; + mappings[22085632] = ItemType.ClayBall; + mappings[22151168] = ItemType.SugarCane; + mappings[22216704] = ItemType.Paper; + mappings[22282240] = ItemType.Book; + mappings[22347776] = ItemType.SlimeBall; + mappings[22413312] = ItemType.ChestMinecart; + mappings[22478848] = ItemType.FurnaceMinecart; + mappings[22544384] = ItemType.Egg; + mappings[22609920] = ItemType.Compass; + mappings[22675456] = ItemType.FishingRod; + mappings[22740992] = ItemType.Clock; + mappings[22806528] = ItemType.GlowstoneDust; + mappings[22872064] = ItemType.Salmon; + mappings[22872065] = ItemType.Salmon; + mappings[22872066] = ItemType.TropicalFish; + mappings[22872067] = ItemType.Pufferfish; + mappings[22937600] = ItemType.CookedSalmon; + mappings[22937601] = ItemType.CookedSalmon; + mappings[23003136] = ItemType.InkSac; + mappings[23003137] = ItemType.RedDye; + mappings[23003138] = ItemType.GreenDye; + mappings[23003139] = ItemType.CocoaBeans; + mappings[23003140] = ItemType.LapisLazuli; + mappings[23003141] = ItemType.PurpleDye; + mappings[23003142] = ItemType.CyanDye; + mappings[23003143] = ItemType.LightGrayDye; + mappings[23003144] = ItemType.GrayDye; + mappings[23003145] = ItemType.PinkDye; + mappings[23003146] = ItemType.LimeDye; + mappings[23003147] = ItemType.YellowDye; + mappings[23003148] = ItemType.LightBlueDye; + mappings[23003149] = ItemType.MagentaDye; + mappings[23003150] = ItemType.OrangeDye; + mappings[23003151] = ItemType.BoneMeal; + mappings[23068672] = ItemType.Bone; + mappings[23134208] = ItemType.Sugar; + mappings[23199744] = ItemType.Cake; + mappings[23265280] = ItemType.RedBed; + mappings[23330816] = ItemType.Repeater; + mappings[23396352] = ItemType.Cookie; + mappings[23527424] = ItemType.Shears; + mappings[23592960] = ItemType.MelonSlice; + mappings[23658496] = ItemType.PumpkinSeeds; + mappings[23724032] = ItemType.MelonSeeds; + mappings[23789568] = ItemType.Beef; + mappings[23855104] = ItemType.CookedBeef; + mappings[23920640] = ItemType.Chicken; + mappings[23986176] = ItemType.CookedChicken; + mappings[24051712] = ItemType.RottenFlesh; + mappings[24117248] = ItemType.EnderPearl; + mappings[24182784] = ItemType.BlazeRod; + mappings[24248320] = ItemType.GhastTear; + mappings[24313856] = ItemType.GoldNugget; + mappings[24379392] = ItemType.NetherWart; + mappings[24444928] = ItemType.Potion; + mappings[24510464] = ItemType.GlassBottle; + mappings[24576000] = ItemType.SpiderEye; + mappings[24641536] = ItemType.FermentedSpiderEye; + mappings[24707072] = ItemType.BlazePowder; + mappings[24772608] = ItemType.MagmaCream; + mappings[24838144] = ItemType.BrewingStand; + mappings[24903680] = ItemType.Cauldron; + mappings[24969216] = ItemType.EnderEye; + mappings[25034752] = ItemType.GlisteringMelonSlice; + mappings[25100288] = ItemType.BatSpawnEgg; + mappings[25100288] = ItemType.BlazeSpawnEgg; + mappings[25100288] = ItemType.CaveSpiderSpawnEgg; + mappings[25100288] = ItemType.ChickenSpawnEgg; + mappings[25100288] = ItemType.CowSpawnEgg; + mappings[25100288] = ItemType.CreeperSpawnEgg; + mappings[25100288] = ItemType.EndermanSpawnEgg; + mappings[25100288] = ItemType.EndermiteSpawnEgg; + mappings[25100288] = ItemType.GhastSpawnEgg; + mappings[25100288] = ItemType.GuardianSpawnEgg; + mappings[25100288] = ItemType.HorseSpawnEgg; + mappings[25100288] = ItemType.MagmaCubeSpawnEgg; + mappings[25100288] = ItemType.MooshroomSpawnEgg; + mappings[25100288] = ItemType.OcelotSpawnEgg; + mappings[25100288] = ItemType.PigSpawnEgg; + mappings[25100288] = ItemType.RabbitSpawnEgg; + mappings[25100288] = ItemType.SheepSpawnEgg; + mappings[25100288] = ItemType.ShulkerSpawnEgg; + mappings[25100288] = ItemType.SilverfishSpawnEgg; + mappings[25100288] = ItemType.SkeletonSpawnEgg; + mappings[25100288] = ItemType.SlimeSpawnEgg; + mappings[25100288] = ItemType.SpiderSpawnEgg; + mappings[25100288] = ItemType.SquidSpawnEgg; + mappings[25100288] = ItemType.VillagerSpawnEgg; + mappings[25100288] = ItemType.WitchSpawnEgg; + mappings[25100288] = ItemType.WolfSpawnEgg; + mappings[25100288] = ItemType.ZombieSpawnEgg; + mappings[25100288] = ItemType.ZombifiedPiglinSpawnEgg; + mappings[25165824] = ItemType.ExperienceBottle; + mappings[25231360] = ItemType.FireCharge; + mappings[25296896] = ItemType.WritableBook; + mappings[25362432] = ItemType.WrittenBook; + mappings[25427968] = ItemType.Emerald; + mappings[25493504] = ItemType.ItemFrame; + mappings[25559040] = ItemType.FlowerPot; + mappings[25624576] = ItemType.Carrot; + mappings[25690112] = ItemType.Potato; + mappings[25755648] = ItemType.BakedPotato; + mappings[25821184] = ItemType.PoisonousPotato; + mappings[25886720] = ItemType.Map; + mappings[25952256] = ItemType.GoldenCarrot; + mappings[26017792] = ItemType.SkeletonSkull; + mappings[26017793] = ItemType.WitherSkeletonSkull; + mappings[26017794] = ItemType.ZombieHead; + mappings[26017795] = ItemType.PlayerHead; + mappings[26017796] = ItemType.CreeperHead; + mappings[26017797] = ItemType.DragonHead; + mappings[26083328] = ItemType.CarrotOnAStick; + mappings[26148864] = ItemType.NetherStar; + mappings[26214400] = ItemType.PumpkinPie; + mappings[26279936] = ItemType.FireworkRocket; + mappings[26411008] = ItemType.EnchantedBook; + mappings[26476544] = ItemType.Comparator; + mappings[26542080] = ItemType.NetherBrick; + mappings[26607616] = ItemType.Quartz; + mappings[26673152] = ItemType.TntMinecart; + mappings[26738688] = ItemType.HopperMinecart; + mappings[26804224] = ItemType.PrismarineShard; + mappings[26869760] = ItemType.PrismarineCrystals; + mappings[26935296] = ItemType.Rabbit; + mappings[27000832] = ItemType.CookedRabbit; + mappings[27066368] = ItemType.RabbitStew; + mappings[27131904] = ItemType.RabbitFoot; + mappings[27197440] = ItemType.RabbitHide; + mappings[27262976] = ItemType.ArmorStand; + mappings[27328512] = ItemType.IronHorseArmor; + mappings[27394048] = ItemType.GoldenHorseArmor; + mappings[27459584] = ItemType.DiamondHorseArmor; + mappings[27525120] = ItemType.Lead; + mappings[27590656] = ItemType.NameTag; + mappings[27656192] = ItemType.CommandBlockMinecart; + mappings[27721728] = ItemType.Mutton; + mappings[27787264] = ItemType.CookedMutton; + mappings[27852800] = ItemType.BlackBanner; + mappings[27852801] = ItemType.RedBanner; + mappings[27852802] = ItemType.GreenBanner; + mappings[27852803] = ItemType.BrownBanner; + mappings[27852804] = ItemType.BlueBanner; + mappings[27852805] = ItemType.PurpleBanner; + mappings[27852806] = ItemType.CyanBanner; + mappings[27852807] = ItemType.LightGrayBanner; + mappings[27852808] = ItemType.GrayBanner; + mappings[27852809] = ItemType.PinkBanner; + mappings[27852810] = ItemType.LimeBanner; + mappings[27852811] = ItemType.YellowBanner; + mappings[27852812] = ItemType.LightBlueBanner; + mappings[27852813] = ItemType.MagentaBanner; + mappings[27852814] = ItemType.OrangeBanner; + mappings[27852815] = ItemType.WhiteBanner; + mappings[27918336] = ItemType.EndCrystal; + mappings[27983872] = ItemType.SpruceDoor; + mappings[28049408] = ItemType.BirchDoor; + mappings[28114944] = ItemType.JungleDoor; + mappings[28180480] = ItemType.AcaciaDoor; + mappings[28246016] = ItemType.DarkOakDoor; + mappings[28311552] = ItemType.ChorusFruit; + mappings[28377088] = ItemType.PoppedChorusFruit; + mappings[28442624] = ItemType.Beetroot; + mappings[28508160] = ItemType.BeetrootSeeds; + mappings[28573696] = ItemType.BeetrootSoup; + mappings[28639232] = ItemType.DragonBreath; + mappings[28704768] = ItemType.Potion; + mappings[28770304] = ItemType.SpectralArrow; + mappings[28835840] = ItemType.Arrow; + mappings[28901376] = ItemType.LingeringPotion; + mappings[28966912] = ItemType.Shield; + mappings[29032448] = ItemType.Elytra; + mappings[29097984] = ItemType.SpruceBoat; + mappings[29163520] = ItemType.BirchBoat; + mappings[29229056] = ItemType.JungleBoat; + mappings[29294592] = ItemType.AcaciaBoat; + mappings[29360128] = ItemType.DarkOakBoat; + mappings[147849216] = ItemType.MusicDisc13; + mappings[147914752] = ItemType.MusicDiscCat; + mappings[147980288] = ItemType.MusicDiscBlocks; + mappings[148045824] = ItemType.MusicDiscChirp; + mappings[148111360] = ItemType.MusicDiscFar; + mappings[148176896] = ItemType.MusicDiscMall; + mappings[148242432] = ItemType.MusicDiscMellohi; + mappings[148307968] = ItemType.MusicDiscStal; + mappings[148373504] = ItemType.MusicDiscStrad; + mappings[148439040] = ItemType.MusicDiscWard; + mappings[148504576] = ItemType.MusicDisc11; + mappings[148570112] = ItemType.MusicDiscWait; + mappings[1966080] = ItemType.Cobweb; + mappings[7274496] = ItemType.LilyPad; + mappings[19398656] = ItemType.Wheat; + mappings[21364736] = ItemType.WaterBucket; + + } + + protected override Dictionary GetDict() + { + return mappings; + } + } +} diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs index 6627f8dbab..2c68342591 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs @@ -196,6 +196,7 @@ public Protocol18Handler(TcpClient Client, int protocolVersion, IMinecraftComHan >= MC_1_16_2_Version => new ItemPalette1162(), >= MC_1_16_1_Version => new ItemPalette1161(), >= MC_1_15_Version => new ItemPalette115(), + >= MC_1_9_Version => new ItemPalette19(), _ => new ItemPalette18() }; @@ -532,7 +533,6 @@ private bool HandlePlayPackets(int packetId, Queue packetData) break; case PacketTypesIn.JoinGame: - { // Temporary fix log.Debug("Receive JoinGame"); @@ -543,7 +543,7 @@ private bool HandlePlayPackets(int packetId, Queue packetData) lastReceivedMessage = null; lastSeenMessagesCollector = protocolVersion >= MC_1_19_3_Version ? new(20) : new(5); - } + handler.OnGameJoined(isOnlineMode); var playerEntityId = dataTypes.ReadNextInt(packetData); @@ -711,7 +711,6 @@ private bool HandlePlayPackets(int packetId, Queue packetData) dataTypes.ReadNextVarInt(packetData); // Portal Cooldown } - break; case PacketTypesIn.SpawnPainting: // Just skip, no need for this return true; From 221d5948e2482f292edd60970ce995c1f3511414 Mon Sep 17 00:00:00 2001 From: Anon Date: Tue, 12 Mar 2024 13:28:17 +0100 Subject: [PATCH 3/7] Added Item mappings for 1.12 --- .../Inventory/ItemPalettes/ItemPalette112.cs | 669 ++++++++++++++++++ .../Protocol/Handlers/Protocol18.cs | 9 +- 2 files changed, 674 insertions(+), 4 deletions(-) create mode 100644 MinecraftClient/Inventory/ItemPalettes/ItemPalette112.cs diff --git a/MinecraftClient/Inventory/ItemPalettes/ItemPalette112.cs b/MinecraftClient/Inventory/ItemPalettes/ItemPalette112.cs new file mode 100644 index 0000000000..2826641dea --- /dev/null +++ b/MinecraftClient/Inventory/ItemPalettes/ItemPalette112.cs @@ -0,0 +1,669 @@ +using System.Collections.Generic; + +namespace MinecraftClient.Inventory.ItemPalettes +{ + /// + /// For MC 1.8 + /// Done manually by Milutinke :( + /// + public class ItemPalette112 : ItemPalette + { + private static readonly Dictionary mappings = new(); + + static ItemPalette112() + { + // Mapping IDs are a derived from: (Item ID << 16) | Data + mappings[0] = ItemType.Air; + mappings[65536] = ItemType.Stone; + mappings[65537] = ItemType.Granite; + mappings[65538] = ItemType.PolishedGranite; + mappings[65539] = ItemType.Diorite; + mappings[65540] = ItemType.PolishedDiorite; + mappings[65541] = ItemType.Andesite; + mappings[65542] = ItemType.PolishedAndesite; + mappings[131072] = ItemType.GrassBlock; + mappings[196608] = ItemType.Dirt; + mappings[196609] = ItemType.CoarseDirt; + mappings[196610] = ItemType.Podzol; + mappings[262144] = ItemType.Cobblestone; + mappings[327680] = ItemType.OakPlanks; + mappings[327681] = ItemType.SprucePlanks; + mappings[327682] = ItemType.BirchPlanks; + mappings[327683] = ItemType.JunglePlanks; + mappings[327684] = ItemType.AcaciaPlanks; + mappings[327685] = ItemType.DarkOakPlanks; + mappings[393216] = ItemType.OakSapling; + mappings[393217] = ItemType.SpruceSapling; + mappings[393218] = ItemType.BirchSapling; + mappings[393219] = ItemType.JungleSapling; + mappings[393220] = ItemType.AcaciaSapling; + mappings[393221] = ItemType.DarkOakSapling; + mappings[458752] = ItemType.Bedrock; + mappings[524288] = ItemType.WaterBucket; // Still Water Block Item + mappings[589824] = ItemType.WaterBucket; // Flowing Water Block Item + mappings[655360] = ItemType.LavaBucket; // Still Lava Block Item + mappings[720896] = ItemType.LavaBucket; // Flowing Lava Block Item + mappings[786432] = ItemType.Sand; + mappings[786433] = ItemType.RedSand; + mappings[851968] = ItemType.Gravel; + mappings[917504] = ItemType.GoldOre; + mappings[983040] = ItemType.IronOre; + mappings[1048576] = ItemType.CoalOre; + mappings[1245184] = ItemType.Sponge; + mappings[1245185] = ItemType.WetSponge; + mappings[1310720] = ItemType.Glass; + mappings[1376256] = ItemType.LapisOre; + mappings[1441792] = ItemType.LapisBlock; + mappings[1507328] = ItemType.Dispenser; + mappings[1572864] = ItemType.Sandstone; + mappings[1572865] = ItemType.ChiseledSandstone; + mappings[1572866] = ItemType.SmoothSandstone; + mappings[1638400] = ItemType.NoteBlock; + mappings[1769472] = ItemType.PoweredRail; + mappings[1835008] = ItemType.DetectorRail; + mappings[1900544] = ItemType.StickyPiston; + mappings[2031617] = ItemType.Grass; + mappings[2031618] = ItemType.Fern; + mappings[2097152] = ItemType.DeadBush; + mappings[2162688] = ItemType.Piston; + mappings[2490368] = ItemType.Poppy; + mappings[2490369] = ItemType.BlueOrchid; + mappings[2490370] = ItemType.Allium; + mappings[2490371] = ItemType.AzureBluet; + mappings[2490372] = ItemType.RedTulip; + mappings[2490373] = ItemType.OrangeTulip; + mappings[2490374] = ItemType.WhiteTulip; + mappings[2490375] = ItemType.PinkTulip; + mappings[2490376] = ItemType.OxeyeDaisy; + mappings[2555904] = ItemType.BrownMushroom; + mappings[2621440] = ItemType.RedMushroom; + mappings[2686976] = ItemType.GoldBlock; + mappings[2752512] = ItemType.IronBlock; + mappings[2883584] = ItemType.StoneSlab; + mappings[2883585] = ItemType.SandstoneSlab; + mappings[2883587] = ItemType.CobblestoneSlab; + mappings[2883588] = ItemType.BrickSlab; + mappings[2883589] = ItemType.StoneBrickSlab; + mappings[2883590] = ItemType.NetherBrickSlab; + mappings[2883591] = ItemType.QuartzSlab; + mappings[2949120] = ItemType.Bricks; + mappings[3014656] = ItemType.Tnt; + mappings[3080192] = ItemType.Bookshelf; + mappings[3145728] = ItemType.MossyCobblestone; + mappings[3211264] = ItemType.Obsidian; + mappings[3276800] = ItemType.Torch; + mappings[3407872] = ItemType.Spawner; + mappings[3473408] = ItemType.OakStairs; + mappings[3538944] = ItemType.Chest; + mappings[3670016] = ItemType.DiamondOre; + mappings[3735552] = ItemType.DiamondBlock; + mappings[3801088] = ItemType.CraftingTable; + mappings[3932160] = ItemType.Farmland; + mappings[3997696] = ItemType.Furnace; + mappings[4259840] = ItemType.Ladder; + mappings[4325376] = ItemType.Rail; + mappings[4390912] = ItemType.CobblestoneStairs; + mappings[4587520] = ItemType.StonePressurePlate; + mappings[4784128] = ItemType.RedstoneOre; + mappings[4980736] = ItemType.RedstoneTorch; + mappings[5046272] = ItemType.StoneButton; + mappings[5111808] = ItemType.Snow; + mappings[5177344] = ItemType.Ice; + mappings[5242880] = ItemType.SnowBlock; + mappings[5308416] = ItemType.Cactus; + mappings[5373952] = ItemType.Clay; + mappings[5505024] = ItemType.Jukebox; + mappings[5570560] = ItemType.OakFence; + mappings[5636096] = ItemType.Pumpkin; + mappings[5701632] = ItemType.Netherrack; + mappings[5767168] = ItemType.SoulSand; + mappings[5832704] = ItemType.Glowstone; + mappings[6225920] = ItemType.WhiteStainedGlass; + mappings[6225921] = ItemType.OrangeStainedGlass; + mappings[6225922] = ItemType.MagentaStainedGlass; + mappings[6225923] = ItemType.LightBlueStainedGlass; + mappings[6225924] = ItemType.YellowStainedGlass; + mappings[6225925] = ItemType.LimeStainedGlass; + mappings[6225926] = ItemType.PinkStainedGlass; + mappings[6225927] = ItemType.GrayStainedGlass; + mappings[6225928] = ItemType.LightGrayStainedGlass; + mappings[6225929] = ItemType.CyanStainedGlass; + mappings[6225930] = ItemType.PurpleStainedGlass; + mappings[6225931] = ItemType.BlueStainedGlass; + mappings[6225932] = ItemType.BrownStainedGlass; + mappings[6225933] = ItemType.GreenStainedGlass; + mappings[6225934] = ItemType.RedStainedGlass; + mappings[6225935] = ItemType.BlackStainedGlass; + mappings[6291456] = ItemType.OakTrapdoor; + mappings[6356992] = ItemType.InfestedStone; + mappings[6356993] = ItemType.InfestedCobblestone; + mappings[6356994] = ItemType.InfestedStoneBricks; + mappings[6356995] = ItemType.InfestedMossyStoneBricks; + mappings[6356996] = ItemType.InfestedCrackedStoneBricks; + mappings[6356997] = ItemType.InfestedChiseledStoneBricks; + mappings[6422528] = ItemType.StoneBricks; + mappings[6422529] = ItemType.MossyStoneBricks; + mappings[6422530] = ItemType.CrackedStoneBricks; + mappings[6422531] = ItemType.ChiseledStoneBricks; + mappings[6488064] = ItemType.BrownMushroomBlock; + mappings[6553600] = ItemType.RedMushroomBlock; + mappings[6619136] = ItemType.IronBars; + mappings[6684672] = ItemType.GlassPane; + mappings[6750208] = ItemType.Melon; + mappings[6946816] = ItemType.Vine; + mappings[7012352] = ItemType.OakFenceGate; + mappings[7077888] = ItemType.BrickStairs; + mappings[7143424] = ItemType.StoneBrickStairs; + mappings[7208960] = ItemType.Mycelium; + mappings[7340032] = ItemType.NetherBricks; + mappings[7405568] = ItemType.NetherBrickFence; + mappings[7471104] = ItemType.NetherBrickStairs; + mappings[7602176] = ItemType.EnchantingTable; + mappings[7864320] = ItemType.EndPortalFrame; + mappings[7929856] = ItemType.EndStone; + mappings[7995392] = ItemType.DragonEgg; + mappings[8060928] = ItemType.RedstoneLamp; + mappings[8388608] = ItemType.SandstoneStairs; + mappings[8454144] = ItemType.EmeraldOre; + mappings[8519680] = ItemType.EnderChest; + mappings[8585216] = ItemType.TripwireHook; + mappings[8716288] = ItemType.EmeraldBlock; + mappings[8781824] = ItemType.SpruceStairs; + mappings[8847360] = ItemType.BirchStairs; + mappings[8912896] = ItemType.JungleStairs; + mappings[8978432] = ItemType.CommandBlock; + mappings[9043968] = ItemType.Beacon; + mappings[9109504] = ItemType.CobblestoneWall; + mappings[9109505] = ItemType.MossyCobblestoneWall; + mappings[9502720] = ItemType.Anvil; + mappings[9502721] = ItemType.ChippedAnvil; + mappings[9502722] = ItemType.DamagedAnvil; + mappings[9568256] = ItemType.TrappedChest; + mappings[9699328] = ItemType.HeavyWeightedPressurePlate; + mappings[9895936] = ItemType.DaylightDetector; + mappings[9961472] = ItemType.RedstoneBlock; + mappings[10027008] = ItemType.NetherQuartzOre; + mappings[10092544] = ItemType.Hopper; + mappings[10158080] = ItemType.QuartzBlock; + mappings[10158081] = ItemType.ChiseledQuartzBlock; + mappings[10158082] = ItemType.QuartzPillar; + mappings[10223616] = ItemType.QuartzStairs; + mappings[10289152] = ItemType.ActivatorRail; + mappings[10354688] = ItemType.Dropper; + mappings[10420224] = ItemType.WhiteTerracotta; + mappings[10420225] = ItemType.OrangeTerracotta; + mappings[10420226] = ItemType.MagentaTerracotta; + mappings[10420227] = ItemType.LightBlueTerracotta; + mappings[10420228] = ItemType.YellowTerracotta; + mappings[10420229] = ItemType.LimeTerracotta; + mappings[10420230] = ItemType.PinkTerracotta; + mappings[10420231] = ItemType.GrayTerracotta; + mappings[10420232] = ItemType.LightGrayTerracotta; + mappings[10420233] = ItemType.CyanTerracotta; + mappings[10420234] = ItemType.PurpleTerracotta; + mappings[10420235] = ItemType.BlueTerracotta; + mappings[10420236] = ItemType.BrownTerracotta; + mappings[10420237] = ItemType.GreenTerracotta; + mappings[10420238] = ItemType.RedTerracotta; + mappings[10420239] = ItemType.BlackTerracotta; + mappings[10485760] = ItemType.WhiteStainedGlassPane; + mappings[10485761] = ItemType.OrangeStainedGlassPane; + mappings[10485762] = ItemType.MagentaStainedGlassPane; + mappings[10485763] = ItemType.LightBlueStainedGlassPane; + mappings[10485764] = ItemType.YellowStainedGlassPane; + mappings[10485765] = ItemType.LimeStainedGlassPane; + mappings[10485766] = ItemType.PinkStainedGlassPane; + mappings[10485767] = ItemType.GrayStainedGlassPane; + mappings[10485768] = ItemType.LightGrayStainedGlassPane; + mappings[10485769] = ItemType.CyanStainedGlassPane; + mappings[10485770] = ItemType.PurpleStainedGlassPane; + mappings[10485771] = ItemType.BlueStainedGlassPane; + mappings[10485772] = ItemType.BrownStainedGlassPane; + mappings[10485773] = ItemType.GreenStainedGlassPane; + mappings[10485774] = ItemType.RedStainedGlassPane; + mappings[10485775] = ItemType.BlackStainedGlassPane; + mappings[10682368] = ItemType.AcaciaStairs; + mappings[10747904] = ItemType.DarkOakStairs; + mappings[10813440] = ItemType.SlimeBlock; + mappings[10878976] = ItemType.Barrier; + mappings[10944512] = ItemType.IronTrapdoor; + mappings[11010048] = ItemType.Prismarine; + mappings[11010049] = ItemType.PrismarineBricks; + mappings[11010050] = ItemType.DarkPrismarine; + mappings[11075584] = ItemType.SeaLantern; + mappings[11141120] = ItemType.HayBlock; + mappings[11206656] = ItemType.WhiteCarpet; + mappings[11206657] = ItemType.OrangeCarpet; + mappings[11206658] = ItemType.MagentaCarpet; + mappings[11206659] = ItemType.LightBlueCarpet; + mappings[11206660] = ItemType.YellowCarpet; + mappings[11206661] = ItemType.LimeCarpet; + mappings[11206662] = ItemType.PinkCarpet; + mappings[11206663] = ItemType.GrayCarpet; + mappings[11206664] = ItemType.LightGrayCarpet; + mappings[11206665] = ItemType.CyanCarpet; + mappings[11206666] = ItemType.PurpleCarpet; + mappings[11206667] = ItemType.BlueCarpet; + mappings[11206668] = ItemType.BrownCarpet; + mappings[11206669] = ItemType.GreenCarpet; + mappings[11206670] = ItemType.RedCarpet; + mappings[11206671] = ItemType.BlackCarpet; + mappings[11272192] = ItemType.Terracotta; + mappings[11337728] = ItemType.CoalBlock; + mappings[11403264] = ItemType.PackedIce; + mappings[11468800] = ItemType.Sunflower; + mappings[11468801] = ItemType.Lilac; + mappings[11468802] = ItemType.TallGrass; + mappings[11468803] = ItemType.LargeFern; + mappings[11468804] = ItemType.RoseBush; + mappings[11468805] = ItemType.Peony; + mappings[11730944] = ItemType.RedSandstone; + mappings[11730945] = ItemType.ChiseledRedSandstone; + mappings[11730946] = ItemType.SmoothRedSandstone; + mappings[11796480] = ItemType.RedSandstoneStairs; + mappings[11927552] = ItemType.RedSandstoneSlab; + mappings[11993088] = ItemType.SpruceFenceGate; + mappings[12058624] = ItemType.BirchFenceGate; + mappings[12124160] = ItemType.JungleFenceGate; + mappings[12189696] = ItemType.DarkOakFenceGate; + mappings[12255232] = ItemType.AcaciaFenceGate; + mappings[12320768] = ItemType.SpruceFence; + mappings[12386304] = ItemType.BirchFence; + mappings[12451840] = ItemType.JungleFence; + mappings[12517376] = ItemType.DarkOakFence; + mappings[12582912] = ItemType.AcaciaFence; + mappings[12976128] = ItemType.EndRod; + mappings[13041664] = ItemType.ChorusPlant; + mappings[13107200] = ItemType.ChorusFlower; + mappings[13172736] = ItemType.PurpurBlock; + mappings[13238272] = ItemType.PurpurPillar; + mappings[13303808] = ItemType.PurpurStairs; + mappings[13434880] = ItemType.PurpurSlab; + mappings[13500416] = ItemType.EndStoneBricks; + mappings[13631488] = ItemType.DirtPath; + mappings[13762560] = ItemType.RepeatingCommandBlock; + mappings[13828096] = ItemType.ChainCommandBlock; + mappings[14024704] = ItemType.NetherWartBlock; + mappings[14090240] = ItemType.RedNetherBricks; + mappings[14155776] = ItemType.BoneBlock; + mappings[14221312] = ItemType.StructureVoid; + mappings[14286848] = ItemType.Observer; + mappings[14417920] = ItemType.OrangeShulkerBox; + mappings[14745600] = ItemType.PinkShulkerBox; + mappings[14811136] = ItemType.GrayShulkerBox; + mappings[14876672] = ItemType.LightGrayShulkerBox; + mappings[14942208] = ItemType.CyanShulkerBox; + mappings[15007744] = ItemType.PurpleShulkerBox; + mappings[15073280] = ItemType.BlueShulkerBox; + mappings[15138816] = ItemType.BrownShulkerBox; + mappings[15204352] = ItemType.GreenShulkerBox; + mappings[15269888] = ItemType.RedShulkerBox; + mappings[15335424] = ItemType.BlackShulkerBox; + mappings[15466496] = ItemType.OrangeGlazedTerracotta; + mappings[15794176] = ItemType.PinkGlazedTerracotta; + mappings[15859712] = ItemType.GrayGlazedTerracotta; + mappings[15925248] = ItemType.LightGrayGlazedTerracotta; + mappings[15990784] = ItemType.CyanGlazedTerracotta; + mappings[16056320] = ItemType.PurpleGlazedTerracotta; + mappings[16121856] = ItemType.BlueGlazedTerracotta; + mappings[16187392] = ItemType.BrownGlazedTerracotta; + mappings[16252928] = ItemType.GreenGlazedTerracotta; + mappings[16318464] = ItemType.RedGlazedTerracotta; + mappings[16384000] = ItemType.BlackGlazedTerracotta; + mappings[16449536] = ItemType.WhiteConcrete; + mappings[16449537] = ItemType.OrangeConcrete; + mappings[16449538] = ItemType.MagentaConcrete; + mappings[16449539] = ItemType.LightBlueConcrete; + mappings[16449540] = ItemType.YellowConcrete; + mappings[16449541] = ItemType.LimeConcrete; + mappings[16449542] = ItemType.PinkConcrete; + mappings[16449543] = ItemType.GrayConcrete; + mappings[16449544] = ItemType.LightGrayConcrete; + mappings[16449545] = ItemType.CyanConcrete; + mappings[16449546] = ItemType.PurpleConcrete; + mappings[16449547] = ItemType.BlueConcrete; + mappings[16449548] = ItemType.BrownConcrete; + mappings[16449549] = ItemType.GreenConcrete; + mappings[16449550] = ItemType.RedConcrete; + mappings[16449551] = ItemType.BlackConcrete; + mappings[16515072] = ItemType.WhiteConcretePowder; + mappings[16515073] = ItemType.OrangeConcretePowder; + mappings[16515074] = ItemType.MagentaConcretePowder; + mappings[16515075] = ItemType.LightBlueConcretePowder; + mappings[16515076] = ItemType.YellowConcretePowder; + mappings[16515077] = ItemType.LimeConcretePowder; + mappings[16515078] = ItemType.PinkConcretePowder; + mappings[16515079] = ItemType.GrayConcretePowder; + mappings[16515080] = ItemType.LightGrayConcretePowder; + mappings[16515081] = ItemType.CyanConcretePowder; + mappings[16515082] = ItemType.PurpleConcretePowder; + mappings[16515083] = ItemType.BlueConcretePowder; + mappings[16515084] = ItemType.BrownConcretePowder; + mappings[16515085] = ItemType.GreenConcretePowder; + mappings[16515086] = ItemType.RedConcretePowder; + mappings[16515087] = ItemType.BlackConcretePowder; + mappings[16711680] = ItemType.StructureBlock; + mappings[16777216] = ItemType.IronShovel; + mappings[16842752] = ItemType.IronPickaxe; + mappings[16908288] = ItemType.IronAxe; + mappings[16973824] = ItemType.FlintAndSteel; + mappings[17039360] = ItemType.Apple; + mappings[17104896] = ItemType.Bow; + mappings[17170432] = ItemType.Arrow; + mappings[17235968] = ItemType.Coal; + mappings[17235969] = ItemType.Charcoal; + mappings[17301504] = ItemType.Diamond; + mappings[17367040] = ItemType.IronIngot; + mappings[17432576] = ItemType.GoldIngot; + mappings[17498112] = ItemType.IronSword; + mappings[17825792] = ItemType.StoneSword; + mappings[17891328] = ItemType.StoneShovel; + mappings[17956864] = ItemType.StonePickaxe; + mappings[18022400] = ItemType.StoneAxe; + mappings[18087936] = ItemType.DiamondSword; + mappings[18153472] = ItemType.DiamondShovel; + mappings[18219008] = ItemType.DiamondPickaxe; + mappings[18284544] = ItemType.DiamondAxe; + mappings[18350080] = ItemType.Stick; + mappings[18415616] = ItemType.Bowl; + mappings[18481152] = ItemType.MushroomStew; + mappings[18546688] = ItemType.GoldenSword; + mappings[18612224] = ItemType.GoldenShovel; + mappings[18677760] = ItemType.GoldenPickaxe; + mappings[18743296] = ItemType.GoldenAxe; + mappings[18808832] = ItemType.String; + mappings[18874368] = ItemType.Feather; + mappings[18939904] = ItemType.Gunpowder; + mappings[19070976] = ItemType.StoneHoe; + mappings[19136512] = ItemType.IronHoe; + mappings[19202048] = ItemType.DiamondHoe; + mappings[19267584] = ItemType.GoldenHoe; + mappings[19464192] = ItemType.Bread; + mappings[19791872] = ItemType.ChainmailHelmet; + mappings[19857408] = ItemType.ChainmailChestplate; + mappings[19922944] = ItemType.ChainmailLeggings; + mappings[19988480] = ItemType.ChainmailBoots; + mappings[20054016] = ItemType.IronHelmet; + mappings[20119552] = ItemType.IronChestplate; + mappings[20185088] = ItemType.IronLeggings; + mappings[20250624] = ItemType.IronBoots; + mappings[20316160] = ItemType.DiamondHelmet; + mappings[20381696] = ItemType.DiamondChestplate; + mappings[20447232] = ItemType.DiamondLeggings; + mappings[20512768] = ItemType.DiamondBoots; + mappings[20578304] = ItemType.GoldenHelmet; + mappings[20643840] = ItemType.GoldenChestplate; + mappings[20709376] = ItemType.GoldenLeggings; + mappings[20774912] = ItemType.GoldenBoots; + mappings[20840448] = ItemType.Flint; + mappings[20905984] = ItemType.Porkchop; + mappings[20971520] = ItemType.CookedPorkchop; + mappings[21037056] = ItemType.Painting; + mappings[21102592] = ItemType.GoldenApple; + mappings[21102593] = ItemType.EnchantedGoldenApple; + mappings[21168128] = ItemType.OakSign; + mappings[21299200] = ItemType.Bucket; + mappings[21495808] = ItemType.Minecart; + mappings[21561344] = ItemType.Saddle; + mappings[21626880] = ItemType.IronDoor; + mappings[21692416] = ItemType.Redstone; + mappings[21757952] = ItemType.Snowball; + mappings[21823488] = ItemType.OakBoat; + mappings[21954560] = ItemType.MilkBucket; + mappings[22020096] = ItemType.Brick; + mappings[22085632] = ItemType.ClayBall; + mappings[22151168] = ItemType.SugarCane; + mappings[22216704] = ItemType.Paper; + mappings[22282240] = ItemType.Book; + mappings[22347776] = ItemType.SlimeBall; + mappings[22413312] = ItemType.ChestMinecart; + mappings[22478848] = ItemType.FurnaceMinecart; + mappings[22544384] = ItemType.Egg; + mappings[22609920] = ItemType.Compass; + mappings[22675456] = ItemType.FishingRod; + mappings[22740992] = ItemType.Clock; + mappings[22806528] = ItemType.GlowstoneDust; + mappings[22872064] = ItemType.Salmon; + mappings[22872065] = ItemType.Salmon; + mappings[22872066] = ItemType.TropicalFish; + mappings[22872067] = ItemType.Pufferfish; + mappings[22937600] = ItemType.CookedSalmon; + mappings[22937601] = ItemType.CookedSalmon; + mappings[23003136] = ItemType.InkSac; + mappings[23003137] = ItemType.RedDye; + mappings[23003138] = ItemType.GreenDye; + mappings[23003139] = ItemType.CocoaBeans; + mappings[23003140] = ItemType.LapisLazuli; + mappings[23003141] = ItemType.PurpleDye; + mappings[23003142] = ItemType.CyanDye; + mappings[23003143] = ItemType.LightGrayDye; + mappings[23003144] = ItemType.GrayDye; + mappings[23003145] = ItemType.PinkDye; + mappings[23003146] = ItemType.LimeDye; + mappings[23003147] = ItemType.YellowDye; + mappings[23003148] = ItemType.LightBlueDye; + mappings[23003149] = ItemType.MagentaDye; + mappings[23003150] = ItemType.OrangeDye; + mappings[23003151] = ItemType.BoneMeal; + mappings[23068672] = ItemType.Bone; + mappings[23134208] = ItemType.Sugar; + mappings[23199744] = ItemType.Cake; + mappings[23265280] = ItemType.WhiteBed; + mappings[23265281] = ItemType.OrangeBed; + mappings[23265282] = ItemType.MagentaBed; + mappings[23265283] = ItemType.LightBlueBed; + mappings[23265284] = ItemType.YellowBed; + mappings[23265285] = ItemType.LimeBed; + mappings[23265286] = ItemType.PinkBed; + mappings[23265287] = ItemType.GrayBed; + mappings[23265288] = ItemType.LightGrayBed; + mappings[23265289] = ItemType.CyanBed; + mappings[23265290] = ItemType.PurpleBed; + mappings[23265291] = ItemType.BlueBed; + mappings[23265292] = ItemType.BrownBed; + mappings[23265293] = ItemType.GreenBed; + mappings[23265294] = ItemType.RedBed; + mappings[23265295] = ItemType.BlackBed; + mappings[23330816] = ItemType.Repeater; + mappings[23396352] = ItemType.Cookie; + mappings[23527424] = ItemType.Shears; + mappings[23592960] = ItemType.MelonSlice; + mappings[23658496] = ItemType.PumpkinSeeds; + mappings[23724032] = ItemType.MelonSeeds; + mappings[23789568] = ItemType.Beef; + mappings[23855104] = ItemType.CookedBeef; + mappings[23920640] = ItemType.Chicken; + mappings[23986176] = ItemType.CookedChicken; + mappings[24051712] = ItemType.RottenFlesh; + mappings[24117248] = ItemType.EnderPearl; + mappings[24182784] = ItemType.BlazeRod; + mappings[24248320] = ItemType.GhastTear; + mappings[24313856] = ItemType.GoldNugget; + mappings[24379392] = ItemType.NetherWart; + mappings[24444928] = ItemType.Potion; + mappings[24510464] = ItemType.GlassBottle; + mappings[24576000] = ItemType.SpiderEye; + mappings[24641536] = ItemType.FermentedSpiderEye; + mappings[24707072] = ItemType.BlazePowder; + mappings[24838144] = ItemType.BrewingStand; + mappings[24903680] = ItemType.Cauldron; + mappings[24969216] = ItemType.EnderEye; + mappings[25034752] = ItemType.GlisteringMelonSlice; + mappings[25100288] = ItemType.BatSpawnEgg; + mappings[25165824] = ItemType.ExperienceBottle; + mappings[25231360] = ItemType.FireCharge; + mappings[25427968] = ItemType.Emerald; + mappings[25493504] = ItemType.ItemFrame; + mappings[25559040] = ItemType.FlowerPot; + mappings[25624576] = ItemType.Carrot; + mappings[25690112] = ItemType.Potato; + mappings[25755648] = ItemType.BakedPotato; + mappings[25821184] = ItemType.PoisonousPotato; + mappings[25952256] = ItemType.GoldenCarrot; + mappings[26017792] = ItemType.SkeletonSkull; + mappings[26017793] = ItemType.WitherSkeletonSkull; + mappings[26017794] = ItemType.ZombieHead; + mappings[26017795] = ItemType.PlayerHead; + mappings[26017796] = ItemType.CreeperHead; + mappings[26017797] = ItemType.DragonHead; + mappings[26083328] = ItemType.CarrotOnAStick; + mappings[26148864] = ItemType.NetherStar; + mappings[26214400] = ItemType.PumpkinPie; + mappings[26279936] = ItemType.FireworkRocket; + mappings[26411008] = ItemType.EnchantedBook; + mappings[26476544] = ItemType.Comparator; + mappings[26542080] = ItemType.NetherBrick; + mappings[26607616] = ItemType.Quartz; + mappings[26673152] = ItemType.TntMinecart; + mappings[26738688] = ItemType.HopperMinecart; + mappings[26804224] = ItemType.PrismarineShard; + mappings[26869760] = ItemType.PrismarineCrystals; + mappings[26935296] = ItemType.Rabbit; + mappings[27000832] = ItemType.CookedRabbit; + mappings[27066368] = ItemType.RabbitStew; + mappings[27131904] = ItemType.RabbitFoot; + mappings[27197440] = ItemType.RabbitHide; + mappings[27262976] = ItemType.ArmorStand; + mappings[27328512] = ItemType.IronHorseArmor; + mappings[27394048] = ItemType.GoldenHorseArmor; + mappings[27459584] = ItemType.DiamondHorseArmor; + mappings[27590656] = ItemType.NameTag; + mappings[27656192] = ItemType.CommandBlockMinecart; + mappings[27721728] = ItemType.Mutton; + mappings[27787264] = ItemType.CookedMutton; + mappings[27852800] = ItemType.BlackBanner; + mappings[27852801] = ItemType.RedBanner; + mappings[27852802] = ItemType.GreenBanner; + mappings[27852803] = ItemType.BrownBanner; + mappings[27852804] = ItemType.BlueBanner; + mappings[27852805] = ItemType.PurpleBanner; + mappings[27852806] = ItemType.CyanBanner; + mappings[27852807] = ItemType.LightGrayBanner; + mappings[27852808] = ItemType.GrayBanner; + mappings[27852809] = ItemType.PinkBanner; + mappings[27852810] = ItemType.LimeBanner; + mappings[27852811] = ItemType.YellowBanner; + mappings[27852812] = ItemType.LightBlueBanner; + mappings[27852813] = ItemType.MagentaBanner; + mappings[27852814] = ItemType.OrangeBanner; + mappings[27852815] = ItemType.WhiteBanner; + mappings[27918336] = ItemType.EndCrystal; + mappings[27983872] = ItemType.SpruceDoor; + mappings[28049408] = ItemType.BirchDoor; + mappings[28114944] = ItemType.JungleDoor; + mappings[28180480] = ItemType.AcaciaDoor; + mappings[28246016] = ItemType.DarkOakDoor; + mappings[28311552] = ItemType.ChorusFruit; + mappings[28377088] = ItemType.PoppedChorusFruit; + mappings[28442624] = ItemType.Beetroot; + mappings[28508160] = ItemType.BeetrootSeeds; + mappings[28573696] = ItemType.BeetrootSoup; + mappings[28639232] = ItemType.DragonBreath; + mappings[28704768] = ItemType.Potion; + mappings[28770304] = ItemType.SpectralArrow; + mappings[28835840] = ItemType.Arrow; + mappings[28966912] = ItemType.Shield; + mappings[29032448] = ItemType.Elytra; + mappings[29097984] = ItemType.SpruceBoat; + mappings[29163520] = ItemType.BirchBoat; + mappings[29229056] = ItemType.JungleBoat; + mappings[29294592] = ItemType.AcaciaBoat; + mappings[29360128] = ItemType.DarkOakBoat; + mappings[29425664] = ItemType.TotemOfUndying; + mappings[29491200] = ItemType.ShulkerShell; + mappings[29622272] = ItemType.IronNugget; + mappings[29687808] = ItemType.KnowledgeBook; + mappings[1114112] = ItemType.OakLog; + mappings[1114113] = ItemType.SpruceLog; + mappings[1114114] = ItemType.BirchLog; + mappings[1114115] = ItemType.JungleLog; + mappings[1179648] = ItemType.OakLeaves; + mappings[1179649] = ItemType.SpruceLeaves; + mappings[1179650] = ItemType.BirchLeaves; + mappings[1179651] = ItemType.JungleLeaves; + mappings[1966080] = ItemType.Cobweb; + mappings[2293760] = ItemType.WhiteWool; + mappings[2293761] = ItemType.OrangeWool; + mappings[2293762] = ItemType.MagentaWool; + mappings[2293763] = ItemType.LightBlueWool; + mappings[2293764] = ItemType.YellowWool; + mappings[2293765] = ItemType.LimeWool; + mappings[2293766] = ItemType.PinkWool; + mappings[2293767] = ItemType.GrayWool; + mappings[2293768] = ItemType.LightGrayWool; + mappings[2293769] = ItemType.CyanWool; + mappings[2293770] = ItemType.PurpleWool; + mappings[2293771] = ItemType.BlueWool; + mappings[2293772] = ItemType.BrownWool; + mappings[2293773] = ItemType.GreenWool; + mappings[2293774] = ItemType.RedWool; + mappings[2293775] = ItemType.BlackWool; + mappings[2424832] = ItemType.Dandelion; + mappings[4521984] = ItemType.Lever; + mappings[4718592] = ItemType.OakPressurePlate; + mappings[5963776] = ItemType.JackOLantern; + mappings[7274496] = ItemType.LilyPad; + mappings[8257536] = ItemType.OakSlab; + mappings[8257537] = ItemType.SpruceSlab; + mappings[8257538] = ItemType.BirchSlab; + mappings[8257539] = ItemType.JungleSlab; + mappings[8257540] = ItemType.AcaciaSlab; + mappings[8257541] = ItemType.DarkOakSlab; + mappings[9371648] = ItemType.OakButton; + mappings[9633792] = ItemType.LightWeightedPressurePlate; + mappings[10551296] = ItemType.AcaciaLeaves; + mappings[10551297] = ItemType.DarkOakLeaves; + mappings[10616832] = ItemType.AcaciaLog; + mappings[10616833] = ItemType.DarkOakLog; + mappings[13959168] = ItemType.MagmaBlock; + mappings[14352384] = ItemType.WhiteShulkerBox; + mappings[14483456] = ItemType.MagentaShulkerBox; + mappings[14548992] = ItemType.LightBlueShulkerBox; + mappings[14614528] = ItemType.YellowShulkerBox; + mappings[14680064] = ItemType.LimeShulkerBox; + mappings[15400960] = ItemType.WhiteGlazedTerracotta; + mappings[15532032] = ItemType.MagentaGlazedTerracotta; + mappings[15597568] = ItemType.LightBlueGlazedTerracotta; + mappings[15663104] = ItemType.YellowGlazedTerracotta; + mappings[15728640] = ItemType.LimeGlazedTerracotta; + mappings[17563648] = ItemType.WoodenSword; + mappings[17629184] = ItemType.WoodenShovel; + mappings[17694720] = ItemType.WoodenPickaxe; + mappings[17760256] = ItemType.WoodenAxe; + mappings[19005440] = ItemType.WoodenHoe; + mappings[19333120] = ItemType.WheatSeeds; + mappings[19398656] = ItemType.Wheat; + mappings[19529728] = ItemType.LeatherHelmet; + mappings[19595264] = ItemType.LeatherChestplate; + mappings[19660800] = ItemType.LeatherLeggings; + mappings[19726336] = ItemType.LeatherBoots; + mappings[21233664] = ItemType.OakDoor; + mappings[21364736] = ItemType.WaterBucket; + mappings[21430272] = ItemType.LavaBucket; + mappings[21889024] = ItemType.Leather; + mappings[24772608] = ItemType.MagmaCream; + mappings[25296896] = ItemType.WritableBook; + mappings[25362432] = ItemType.WrittenBook; + mappings[25886720] = ItemType.Map; + mappings[27525120] = ItemType.Lead; + mappings[28901376] = ItemType.LingeringPotion; + mappings[147849216] = ItemType.MusicDisc13; + mappings[147914752] = ItemType.MusicDiscCat; + mappings[147980288] = ItemType.MusicDiscBlocks; + mappings[148045824] = ItemType.MusicDiscChirp; + mappings[148111360] = ItemType.MusicDiscFar; + mappings[148176896] = ItemType.MusicDiscMall; + mappings[148242432] = ItemType.MusicDiscMellohi; + mappings[148307968] = ItemType.MusicDiscStal; + mappings[148373504] = ItemType.MusicDiscStrad; + mappings[148439040] = ItemType.MusicDiscWard; + mappings[148504576] = ItemType.MusicDisc11; + mappings[148570112] = ItemType.MusicDiscWait; + } + + protected override Dictionary GetDict() + { + return mappings; + } + } +} \ No newline at end of file diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs index 2c68342591..1961cba751 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs @@ -196,6 +196,7 @@ public Protocol18Handler(TcpClient Client, int protocolVersion, IMinecraftComHan >= MC_1_16_2_Version => new ItemPalette1162(), >= MC_1_16_1_Version => new ItemPalette1161(), >= MC_1_15_Version => new ItemPalette115(), + >= MC_1_12_Version => new ItemPalette112(), >= MC_1_9_Version => new ItemPalette19(), _ => new ItemPalette18() }; @@ -367,8 +368,8 @@ internal Tuple> ReadNextPacket() /// TRUE if the packet was processed, FALSE if ignored or unknown internal bool HandlePacket(int packetId, Queue packetData) { - try - { + //try + //{ switch (currentState) { // https://wiki.vg/Protocol#Login @@ -451,7 +452,7 @@ internal bool HandlePacket(int packetId, Queue packetData) default: return true; } - } + /*} catch (Exception innerException) { if (innerException is ThreadAbortException || innerException is SocketException || @@ -466,7 +467,7 @@ internal bool HandlePacket(int packetId, Queue packetData) currentState == CurrentState.Login, innerException.GetType()), innerException); - } + }*/ return true; } From c9c16818a44d8d5c2100cdc2cafa5fc8d68e6798 Mon Sep 17 00:00:00 2001 From: Anon Date: Tue, 12 Mar 2024 13:49:47 +0100 Subject: [PATCH 4/7] Added item Mappings for 1.10 --- .../Inventory/ItemPalettes/ItemPalette110.cs | 613 ++++++++++++++++++ .../Protocol/Handlers/Protocol18.cs | 1 + 2 files changed, 614 insertions(+) create mode 100644 MinecraftClient/Inventory/ItemPalettes/ItemPalette110.cs diff --git a/MinecraftClient/Inventory/ItemPalettes/ItemPalette110.cs b/MinecraftClient/Inventory/ItemPalettes/ItemPalette110.cs new file mode 100644 index 0000000000..f284d94968 --- /dev/null +++ b/MinecraftClient/Inventory/ItemPalettes/ItemPalette110.cs @@ -0,0 +1,613 @@ +using System.Collections.Generic; + +namespace MinecraftClient.Inventory.ItemPalettes +{ + /// + /// For MC 1.8 + /// Done manually by Milutinke :( + /// + public class ItemPalette110 : ItemPalette + { + private static readonly Dictionary mappings = new(); + + static ItemPalette110() + { + // Mapping IDs are a derived from: (Item ID << 16) | Data + mappings[0] = ItemType.Air; + mappings[65536] = ItemType.Stone; + mappings[65537] = ItemType.Granite; + mappings[65538] = ItemType.PolishedGranite; + mappings[65539] = ItemType.Diorite; + mappings[65540] = ItemType.PolishedDiorite; + mappings[65541] = ItemType.Andesite; + mappings[65542] = ItemType.PolishedAndesite; + mappings[131072] = ItemType.GrassBlock; + mappings[196608] = ItemType.Dirt; + mappings[196609] = ItemType.CoarseDirt; + mappings[196610] = ItemType.Podzol; + mappings[262144] = ItemType.Cobblestone; + mappings[327680] = ItemType.OakPlanks; + mappings[327681] = ItemType.SprucePlanks; + mappings[327682] = ItemType.BirchPlanks; + mappings[327683] = ItemType.JunglePlanks; + mappings[327684] = ItemType.AcaciaPlanks; + mappings[327685] = ItemType.DarkOakPlanks; + mappings[393216] = ItemType.OakSapling; + mappings[393217] = ItemType.SpruceSapling; + mappings[393218] = ItemType.BirchSapling; + mappings[393219] = ItemType.JungleSapling; + mappings[393220] = ItemType.AcaciaSapling; + mappings[393221] = ItemType.DarkOakSapling; + mappings[458752] = ItemType.Bedrock; + mappings[524288] = ItemType.WaterBucket; // Still Water Block Item + mappings[589824] = ItemType.WaterBucket; // Flowing Water Block Item + mappings[655360] = ItemType.LavaBucket; // Still Lava Block Item + mappings[720896] = ItemType.LavaBucket; // Flowing Lava Block Item + mappings[786432] = ItemType.Sand; + mappings[786433] = ItemType.RedSand; + mappings[851968] = ItemType.Gravel; + mappings[917504] = ItemType.GoldOre; + mappings[983040] = ItemType.IronOre; + mappings[1048576] = ItemType.CoalOre; + mappings[1114112] = ItemType.OakLog; + mappings[1114113] = ItemType.SpruceLog; + mappings[1114114] = ItemType.BirchLog; + mappings[1114115] = ItemType.JungleLog; + mappings[1179648] = ItemType.OakLeaves; + mappings[1179649] = ItemType.SpruceLeaves; + mappings[1179650] = ItemType.BirchLeaves; + mappings[1179651] = ItemType.JungleLeaves; + mappings[1245184] = ItemType.Sponge; + mappings[1245185] = ItemType.WetSponge; + mappings[1310720] = ItemType.Glass; + mappings[1376256] = ItemType.LapisOre; + mappings[1441792] = ItemType.LapisBlock; + mappings[1507328] = ItemType.Dispenser; + mappings[1572864] = ItemType.Sandstone; + mappings[1572865] = ItemType.ChiseledSandstone; + mappings[1572866] = ItemType.SmoothSandstone; + mappings[1638400] = ItemType.NoteBlock; + mappings[1769472] = ItemType.PoweredRail; + mappings[1835008] = ItemType.DetectorRail; + mappings[1900544] = ItemType.StickyPiston; + mappings[1966080] = ItemType.Cobweb; + mappings[2031617] = ItemType.Grass; + mappings[2031618] = ItemType.Fern; + mappings[2097152] = ItemType.DeadBush; + mappings[2162688] = ItemType.Piston; + mappings[2293760] = ItemType.WhiteWool; + mappings[2293761] = ItemType.OrangeWool; + mappings[2293762] = ItemType.MagentaWool; + mappings[2293763] = ItemType.LightBlueWool; + mappings[2293764] = ItemType.YellowWool; + mappings[2293765] = ItemType.LimeWool; + mappings[2293766] = ItemType.PinkWool; + mappings[2293767] = ItemType.GrayWool; + mappings[2293768] = ItemType.LightGrayWool; + mappings[2293769] = ItemType.CyanWool; + mappings[2293770] = ItemType.PurpleWool; + mappings[2293771] = ItemType.BlueWool; + mappings[2293772] = ItemType.BrownWool; + mappings[2293773] = ItemType.GreenWool; + mappings[2293774] = ItemType.RedWool; + mappings[2293775] = ItemType.BlackWool; + mappings[2424832] = ItemType.Dandelion; + mappings[2490368] = ItemType.Poppy; + mappings[2490369] = ItemType.BlueOrchid; + mappings[2490370] = ItemType.Allium; + mappings[2490371] = ItemType.AzureBluet; + mappings[2490372] = ItemType.RedTulip; + mappings[2490373] = ItemType.OrangeTulip; + mappings[2490374] = ItemType.WhiteTulip; + mappings[2490375] = ItemType.PinkTulip; + mappings[2490376] = ItemType.OxeyeDaisy; + mappings[2555904] = ItemType.BrownMushroom; + mappings[2621440] = ItemType.RedMushroom; + mappings[2686976] = ItemType.GoldBlock; + mappings[2752512] = ItemType.IronBlock; + mappings[2883584] = ItemType.StoneSlab; + mappings[2883585] = ItemType.SandstoneSlab; + mappings[2883587] = ItemType.CobblestoneSlab; + mappings[2883588] = ItemType.BrickSlab; + mappings[2883589] = ItemType.StoneBrickSlab; + mappings[2883590] = ItemType.NetherBrickSlab; + mappings[2883591] = ItemType.QuartzSlab; + mappings[2949120] = ItemType.Bricks; + mappings[3014656] = ItemType.Tnt; + mappings[3080192] = ItemType.Bookshelf; + mappings[3145728] = ItemType.MossyCobblestone; + mappings[3211264] = ItemType.Obsidian; + mappings[3276800] = ItemType.Torch; + mappings[3407872] = ItemType.Spawner; + mappings[3473408] = ItemType.OakStairs; + mappings[3538944] = ItemType.Chest; + mappings[3670016] = ItemType.DiamondOre; + mappings[3735552] = ItemType.DiamondBlock; + mappings[3801088] = ItemType.CraftingTable; + mappings[3932160] = ItemType.Farmland; + mappings[3997696] = ItemType.Furnace; + mappings[4259840] = ItemType.Ladder; + mappings[4390912] = ItemType.CobblestoneStairs; + mappings[4587520] = ItemType.StonePressurePlate; + mappings[4718592] = ItemType.OakPressurePlate; + mappings[5046272] = ItemType.StoneButton; + mappings[5177344] = ItemType.Ice; + mappings[5308416] = ItemType.Cactus; + mappings[5373952] = ItemType.Clay; + mappings[5505024] = ItemType.Jukebox; + mappings[5570560] = ItemType.OakFence; + mappings[5832704] = ItemType.Glowstone; + mappings[6225920] = ItemType.WhiteStainedGlass; + mappings[6225921] = ItemType.OrangeStainedGlass; + mappings[6225922] = ItemType.MagentaStainedGlass; + mappings[6225923] = ItemType.LightBlueStainedGlass; + mappings[6225924] = ItemType.YellowStainedGlass; + mappings[6225925] = ItemType.LimeStainedGlass; + mappings[6225926] = ItemType.PinkStainedGlass; + mappings[6225927] = ItemType.GrayStainedGlass; + mappings[6225928] = ItemType.LightGrayStainedGlass; + mappings[6225929] = ItemType.CyanStainedGlass; + mappings[6225930] = ItemType.PurpleStainedGlass; + mappings[6225931] = ItemType.BlueStainedGlass; + mappings[6225932] = ItemType.BrownStainedGlass; + mappings[6225933] = ItemType.GreenStainedGlass; + mappings[6225934] = ItemType.RedStainedGlass; + mappings[6225935] = ItemType.BlackStainedGlass; + mappings[6291456] = ItemType.OakTrapdoor; + mappings[6422528] = ItemType.StoneBricks; + mappings[6422529] = ItemType.MossyStoneBricks; + mappings[6422530] = ItemType.CrackedStoneBricks; + mappings[6422531] = ItemType.ChiseledStoneBricks; + mappings[6488064] = ItemType.BrownMushroomBlock; + mappings[6619136] = ItemType.IronBars; + mappings[6684672] = ItemType.GlassPane; + mappings[6946816] = ItemType.Vine; + mappings[7012352] = ItemType.OakFenceGate; + mappings[7077888] = ItemType.BrickStairs; + mappings[7143424] = ItemType.StoneBrickStairs; + mappings[7274496] = ItemType.LilyPad; + mappings[7602176] = ItemType.EnchantingTable; + mappings[7864320] = ItemType.EndPortalFrame; + mappings[7929856] = ItemType.EndStone; + mappings[7995392] = ItemType.DragonEgg; + mappings[8257536] = ItemType.OakSlab; + mappings[8257537] = ItemType.SpruceSlab; + mappings[8257538] = ItemType.BirchSlab; + mappings[8257539] = ItemType.JungleSlab; + mappings[8257540] = ItemType.AcaciaSlab; + mappings[8257541] = ItemType.DarkOakSlab; + mappings[8454144] = ItemType.EmeraldOre; + mappings[8519680] = ItemType.EnderChest; + mappings[8585216] = ItemType.TripwireHook; + mappings[8716288] = ItemType.EmeraldBlock; + mappings[8781824] = ItemType.SpruceStairs; + mappings[8847360] = ItemType.BirchStairs; + mappings[8912896] = ItemType.JungleStairs; + mappings[8978432] = ItemType.CommandBlock; + mappings[9043968] = ItemType.Beacon; + mappings[9109504] = ItemType.CobblestoneWall; + mappings[4325376] = ItemType.Rail; + mappings[4521984] = ItemType.Lever; + mappings[4784128] = ItemType.RedstoneOre; + mappings[4980736] = ItemType.RedstoneTorch; + mappings[5111808] = ItemType.Snow; + mappings[5242880] = ItemType.SnowBlock; + mappings[5636096] = ItemType.Pumpkin; + mappings[5701632] = ItemType.Netherrack; + mappings[5767168] = ItemType.SoulSand; + mappings[5963776] = ItemType.JackOLantern; + mappings[6356992] = ItemType.InfestedStone; + mappings[6356993] = ItemType.InfestedCobblestone; + mappings[6356994] = ItemType.InfestedStoneBricks; + mappings[6356995] = ItemType.InfestedMossyStoneBricks; + mappings[6356996] = ItemType.InfestedCrackedStoneBricks; + mappings[6356997] = ItemType.InfestedChiseledStoneBricks; + mappings[6553600] = ItemType.RedMushroomBlock; + mappings[6750208] = ItemType.Melon; + mappings[7208960] = ItemType.Mycelium; + mappings[7340032] = ItemType.NetherBricks; + mappings[7405568] = ItemType.NetherBrickFence; + mappings[7471104] = ItemType.NetherBrickStairs; + mappings[8060928] = ItemType.RedstoneLamp; + mappings[8388608] = ItemType.SandstoneStairs; + mappings[9109505] = ItemType.MossyCobblestoneWall; + mappings[9502720] = ItemType.Anvil; + mappings[9502721] = ItemType.ChippedAnvil; + mappings[9502722] = ItemType.DamagedAnvil; + mappings[9568256] = ItemType.TrappedChest; + mappings[9633792] = ItemType.LightWeightedPressurePlate; + mappings[9699328] = ItemType.HeavyWeightedPressurePlate; + mappings[9895936] = ItemType.DaylightDetector; + mappings[9961472] = ItemType.RedstoneBlock; + mappings[10027008] = ItemType.NetherQuartzOre; + mappings[10092544] = ItemType.Hopper; + mappings[10158080] = ItemType.QuartzBlock; + mappings[10158081] = ItemType.ChiseledQuartzBlock; + mappings[10158082] = ItemType.QuartzPillar; + mappings[10223616] = ItemType.QuartzStairs; + mappings[10289152] = ItemType.ActivatorRail; + mappings[10354688] = ItemType.Dropper; + mappings[10420224] = ItemType.WhiteTerracotta; + mappings[10420225] = ItemType.OrangeTerracotta; + mappings[10420226] = ItemType.MagentaTerracotta; + mappings[10420227] = ItemType.LightBlueTerracotta; + mappings[10420228] = ItemType.YellowTerracotta; + mappings[10420229] = ItemType.LimeTerracotta; + mappings[10420230] = ItemType.PinkTerracotta; + mappings[10420231] = ItemType.GrayTerracotta; + mappings[10420232] = ItemType.LightGrayTerracotta; + mappings[10420233] = ItemType.CyanTerracotta; + mappings[10420234] = ItemType.PurpleTerracotta; + mappings[10420235] = ItemType.BlueTerracotta; + mappings[10420236] = ItemType.BrownTerracotta; + mappings[10420237] = ItemType.GreenTerracotta; + mappings[10420238] = ItemType.RedTerracotta; + mappings[10420239] = ItemType.BlackTerracotta; + mappings[10485760] = ItemType.WhiteStainedGlassPane; + mappings[10485761] = ItemType.OrangeStainedGlassPane; + mappings[10485762] = ItemType.MagentaStainedGlassPane; + mappings[10485763] = ItemType.LightBlueStainedGlassPane; + mappings[10485764] = ItemType.YellowStainedGlassPane; + mappings[10485765] = ItemType.LimeStainedGlassPane; + mappings[10485766] = ItemType.PinkStainedGlassPane; + mappings[10485767] = ItemType.GrayStainedGlassPane; + mappings[10485768] = ItemType.LightGrayStainedGlassPane; + mappings[10485769] = ItemType.CyanStainedGlassPane; + mappings[10485770] = ItemType.PurpleStainedGlassPane; + mappings[10485771] = ItemType.BlueStainedGlassPane; + mappings[10485772] = ItemType.BrownStainedGlassPane; + mappings[10485773] = ItemType.GreenStainedGlassPane; + mappings[10485774] = ItemType.RedStainedGlassPane; + mappings[10485775] = ItemType.BlackStainedGlassPane; + mappings[10551296] = ItemType.AcaciaLeaves; + mappings[10551297] = ItemType.DarkOakLeaves; + mappings[10616832] = ItemType.AcaciaLog; + mappings[10616833] = ItemType.DarkOakLog; + mappings[10682368] = ItemType.AcaciaStairs; + mappings[10747904] = ItemType.DarkOakStairs; + mappings[10813440] = ItemType.SlimeBlock; + mappings[10878976] = ItemType.Barrier; + mappings[10944512] = ItemType.IronTrapdoor; + mappings[11010048] = ItemType.Prismarine; + mappings[11010049] = ItemType.PrismarineBricks; + mappings[11010050] = ItemType.DarkPrismarine; + mappings[11075584] = ItemType.SeaLantern; + mappings[11141120] = ItemType.HayBlock; + mappings[11206656] = ItemType.WhiteCarpet; + mappings[11206657] = ItemType.OrangeCarpet; + mappings[11206658] = ItemType.MagentaCarpet; + mappings[11206659] = ItemType.LightBlueCarpet; + mappings[11206660] = ItemType.YellowCarpet; + mappings[11206661] = ItemType.LimeCarpet; + mappings[11206662] = ItemType.PinkCarpet; + mappings[11206663] = ItemType.GrayCarpet; + mappings[11206664] = ItemType.LightGrayCarpet; + mappings[11206665] = ItemType.CyanCarpet; + mappings[11206666] = ItemType.PurpleCarpet; + mappings[11206667] = ItemType.BlueCarpet; + mappings[11206668] = ItemType.BrownCarpet; + mappings[11206669] = ItemType.GreenCarpet; + mappings[11206670] = ItemType.RedCarpet; + mappings[11206671] = ItemType.BlackCarpet; + mappings[11272192] = ItemType.Terracotta; + mappings[11337728] = ItemType.CoalBlock; + mappings[11403264] = ItemType.PackedIce; + mappings[11468800] = ItemType.Sunflower; + mappings[11468801] = ItemType.Lilac; + mappings[11468802] = ItemType.TallGrass; + mappings[11468803] = ItemType.LargeFern; + mappings[11468804] = ItemType.RoseBush; + mappings[11468805] = ItemType.Peony; + mappings[11730944] = ItemType.RedSandstone; + mappings[11730945] = ItemType.ChiseledRedSandstone; + mappings[11730946] = ItemType.SmoothRedSandstone; + mappings[11796480] = ItemType.RedSandstoneStairs; + mappings[11927552] = ItemType.RedSandstoneSlab; + mappings[11993088] = ItemType.SpruceFenceGate; + mappings[12058624] = ItemType.BirchFenceGate; + mappings[12124160] = ItemType.JungleFenceGate; + mappings[12189696] = ItemType.DarkOakFenceGate; + mappings[12255232] = ItemType.AcaciaFenceGate; + mappings[12320768] = ItemType.SpruceFence; + mappings[12386304] = ItemType.BirchFence; + mappings[12451840] = ItemType.JungleFence; + mappings[12517376] = ItemType.DarkOakFence; + mappings[12582912] = ItemType.AcaciaFence; + mappings[12976128] = ItemType.EndRod; + mappings[13041664] = ItemType.ChorusPlant; + mappings[13107200] = ItemType.ChorusFlower; + mappings[13172736] = ItemType.PurpurBlock; + mappings[13238272] = ItemType.PurpurPillar; + mappings[13303808] = ItemType.PurpurStairs; + mappings[13434880] = ItemType.PurpurSlab; + mappings[13500416] = ItemType.EndStoneBricks; + mappings[13631488] = ItemType.DirtPath; + mappings[13762560] = ItemType.RepeatingCommandBlock; + mappings[13828096] = ItemType.ChainCommandBlock; + mappings[13959168] = ItemType.MagmaBlock; + mappings[14024704] = ItemType.NetherWartBlock; + mappings[14090240] = ItemType.RedNetherBricks; + mappings[14155776] = ItemType.BoneBlock; + mappings[14221312] = ItemType.StructureVoid; + mappings[16711680] = ItemType.StructureBlock; + mappings[16777216] = ItemType.IronShovel; + mappings[16842752] = ItemType.IronPickaxe; + mappings[16908288] = ItemType.IronAxe; + mappings[16973824] = ItemType.FlintAndSteel; + mappings[17039360] = ItemType.Apple; + mappings[17104896] = ItemType.Bow; + mappings[17170432] = ItemType.Arrow; + mappings[17235968] = ItemType.Coal; + mappings[17235969] = ItemType.Charcoal; + mappings[17301504] = ItemType.Diamond; + mappings[17367040] = ItemType.IronIngot; + mappings[17432576] = ItemType.GoldIngot; + mappings[17498112] = ItemType.IronSword; + mappings[17825792] = ItemType.StoneSword; + mappings[17891328] = ItemType.StoneShovel; + mappings[17956864] = ItemType.StonePickaxe; + mappings[18022400] = ItemType.StoneAxe; + mappings[18087936] = ItemType.DiamondSword; + mappings[18153472] = ItemType.DiamondShovel; + mappings[18219008] = ItemType.DiamondPickaxe; + mappings[18284544] = ItemType.DiamondAxe; + mappings[18350080] = ItemType.Stick; + mappings[18415616] = ItemType.Bowl; + mappings[18481152] = ItemType.MushroomStew; + mappings[18546688] = ItemType.GoldenSword; + mappings[18612224] = ItemType.GoldenShovel; + mappings[18677760] = ItemType.GoldenPickaxe; + mappings[18743296] = ItemType.GoldenAxe; + mappings[18808832] = ItemType.String; + mappings[18874368] = ItemType.Feather; + mappings[18939904] = ItemType.Gunpowder; + mappings[19070976] = ItemType.StoneHoe; + mappings[19136512] = ItemType.IronHoe; + mappings[19202048] = ItemType.DiamondHoe; + mappings[19267584] = ItemType.GoldenHoe; + mappings[19464192] = ItemType.Bread; + mappings[19529728] = ItemType.LeatherHelmet; + mappings[19595264] = ItemType.LeatherChestplate; + mappings[19660800] = ItemType.LeatherLeggings; + mappings[19726336] = ItemType.LeatherBoots; + mappings[19791872] = ItemType.ChainmailHelmet; + mappings[19857408] = ItemType.ChainmailChestplate; + mappings[19922944] = ItemType.ChainmailLeggings; + mappings[19988480] = ItemType.ChainmailBoots; + mappings[20054016] = ItemType.IronHelmet; + mappings[20119552] = ItemType.IronChestplate; + mappings[20185088] = ItemType.IronLeggings; + mappings[20250624] = ItemType.IronBoots; + mappings[20316160] = ItemType.DiamondHelmet; + mappings[20381696] = ItemType.DiamondChestplate; + mappings[20447232] = ItemType.DiamondLeggings; + mappings[20512768] = ItemType.DiamondBoots; + mappings[20578304] = ItemType.GoldenHelmet; + mappings[20643840] = ItemType.GoldenChestplate; + mappings[20709376] = ItemType.GoldenLeggings; + mappings[20774912] = ItemType.GoldenBoots; + mappings[20840448] = ItemType.Flint; + mappings[20905984] = ItemType.Porkchop; + mappings[20971520] = ItemType.CookedPorkchop; + mappings[21037056] = ItemType.Painting; + mappings[21102592] = ItemType.GoldenApple; + mappings[21102593] = ItemType.EnchantedGoldenApple; + mappings[21168128] = ItemType.OakSign; + mappings[21299200] = ItemType.Bucket; + mappings[21430272] = ItemType.LavaBucket; + mappings[21495808] = ItemType.Minecart; + mappings[21561344] = ItemType.Saddle; + mappings[21626880] = ItemType.IronDoor; + mappings[21692416] = ItemType.Redstone; + mappings[21757952] = ItemType.Snowball; + mappings[21823488] = ItemType.OakBoat; + mappings[21889024] = ItemType.Leather; + mappings[21954560] = ItemType.MilkBucket; + mappings[22020096] = ItemType.Brick; + mappings[22085632] = ItemType.ClayBall; + mappings[22151168] = ItemType.SugarCane; + mappings[22216704] = ItemType.Paper; + mappings[22282240] = ItemType.Book; + mappings[22347776] = ItemType.SlimeBall; + mappings[22413312] = ItemType.ChestMinecart; + mappings[22478848] = ItemType.FurnaceMinecart; + mappings[22544384] = ItemType.Egg; + mappings[22609920] = ItemType.Compass; + mappings[22675456] = ItemType.FishingRod; + mappings[22740992] = ItemType.Clock; + mappings[22806528] = ItemType.GlowstoneDust; + mappings[22872064] = ItemType.Salmon; + mappings[22872065] = ItemType.Salmon; + mappings[22872066] = ItemType.TropicalFish; + mappings[22872067] = ItemType.Pufferfish; + mappings[22937600] = ItemType.CookedSalmon; + mappings[22937601] = ItemType.CookedSalmon; + mappings[23003136] = ItemType.InkSac; + mappings[23003137] = ItemType.RedDye; + mappings[23003138] = ItemType.GreenDye; + mappings[23003139] = ItemType.CocoaBeans; + mappings[23003140] = ItemType.LapisLazuli; + mappings[23003141] = ItemType.PurpleDye; + mappings[23003142] = ItemType.CyanDye; + mappings[23003143] = ItemType.LightGrayDye; + mappings[23003144] = ItemType.GrayDye; + mappings[23003145] = ItemType.PinkDye; + mappings[23003146] = ItemType.LimeDye; + mappings[23003147] = ItemType.YellowDye; + mappings[23003148] = ItemType.LightBlueDye; + mappings[23003149] = ItemType.MagentaDye; + mappings[23003150] = ItemType.OrangeDye; + mappings[23003151] = ItemType.BoneMeal; + mappings[23068672] = ItemType.Bone; + mappings[23134208] = ItemType.Sugar; + mappings[23199744] = ItemType.Cake; + mappings[23265280] = ItemType.RedBed; + mappings[23330816] = ItemType.Repeater; + mappings[23396352] = ItemType.Cookie; + mappings[23527424] = ItemType.Shears; + mappings[23592960] = ItemType.MelonSlice; + mappings[23658496] = ItemType.PumpkinSeeds; + mappings[23724032] = ItemType.MelonSeeds; + mappings[23789568] = ItemType.Beef; + mappings[23855104] = ItemType.CookedBeef; + mappings[23920640] = ItemType.Chicken; + mappings[23986176] = ItemType.CookedChicken; + mappings[24051712] = ItemType.RottenFlesh; + mappings[24117248] = ItemType.EnderPearl; + mappings[24182784] = ItemType.BlazeRod; + mappings[24248320] = ItemType.GhastTear; + mappings[24313856] = ItemType.GoldNugget; + mappings[24379392] = ItemType.NetherWart; + mappings[24444928] = ItemType.Potion; + mappings[24510464] = ItemType.GlassBottle; + mappings[24576000] = ItemType.SpiderEye; + mappings[24641536] = ItemType.FermentedSpiderEye; + mappings[24707072] = ItemType.BlazePowder; + mappings[24772608] = ItemType.MagmaCream; + mappings[24838144] = ItemType.BrewingStand; + mappings[24903680] = ItemType.Cauldron; + mappings[24969216] = ItemType.EnderEye; + mappings[25034752] = ItemType.GlisteringMelonSlice; + mappings[25100288] = ItemType.BatSpawnEgg; + mappings[25100288] = ItemType.BlazeSpawnEgg; + mappings[25100288] = ItemType.CaveSpiderSpawnEgg; + mappings[25100288] = ItemType.ChickenSpawnEgg; + mappings[25100288] = ItemType.CowSpawnEgg; + mappings[25100288] = ItemType.CreeperSpawnEgg; + mappings[25100288] = ItemType.EndermanSpawnEgg; + mappings[25100288] = ItemType.EndermiteSpawnEgg; + mappings[25100288] = ItemType.GhastSpawnEgg; + mappings[25100288] = ItemType.GuardianSpawnEgg; + mappings[25100288] = ItemType.HorseSpawnEgg; + mappings[25100288] = ItemType.MagmaCubeSpawnEgg; + mappings[25100288] = ItemType.MooshroomSpawnEgg; + mappings[25100288] = ItemType.OcelotSpawnEgg; + mappings[25100288] = ItemType.PigSpawnEgg; + mappings[25100288] = ItemType.PolarBearSpawnEgg; + mappings[25100288] = ItemType.RabbitSpawnEgg; + mappings[25100288] = ItemType.SheepSpawnEgg; + mappings[25100288] = ItemType.ShulkerSpawnEgg; + mappings[25100288] = ItemType.SilverfishSpawnEgg; + mappings[25100288] = ItemType.SkeletonSpawnEgg; + mappings[25100288] = ItemType.SlimeSpawnEgg; + mappings[25100288] = ItemType.SpiderSpawnEgg; + mappings[25100288] = ItemType.SquidSpawnEgg; + mappings[25100288] = ItemType.VillagerSpawnEgg; + mappings[25100288] = ItemType.WitchSpawnEgg; + mappings[25100288] = ItemType.WolfSpawnEgg; + mappings[25100288] = ItemType.ZombieSpawnEgg; + mappings[25100288] = ItemType.ZombifiedPiglinSpawnEgg; + mappings[25165824] = ItemType.ExperienceBottle; + mappings[25231360] = ItemType.FireCharge; + mappings[25296896] = ItemType.WritableBook; + mappings[25362432] = ItemType.WrittenBook; + mappings[25427968] = ItemType.Emerald; + mappings[25493504] = ItemType.ItemFrame; + mappings[25559040] = ItemType.FlowerPot; + mappings[25624576] = ItemType.Carrot; + mappings[25690112] = ItemType.Potato; + mappings[25755648] = ItemType.BakedPotato; + mappings[25821184] = ItemType.PoisonousPotato; + mappings[25886720] = ItemType.Map; + mappings[25952256] = ItemType.GoldenCarrot; + mappings[26017792] = ItemType.SkeletonSkull; + mappings[26017793] = ItemType.WitherSkeletonSkull; + mappings[26017794] = ItemType.ZombieHead; + mappings[26017795] = ItemType.PlayerHead; + mappings[26017796] = ItemType.CreeperHead; + mappings[26017797] = ItemType.DragonHead; + mappings[26083328] = ItemType.CarrotOnAStick; + mappings[26148864] = ItemType.NetherStar; + mappings[26214400] = ItemType.PumpkinPie; + mappings[26279936] = ItemType.FireworkRocket; + mappings[26411008] = ItemType.EnchantedBook; + mappings[26476544] = ItemType.Comparator; + mappings[26542080] = ItemType.NetherBrick; + mappings[26607616] = ItemType.Quartz; + mappings[26673152] = ItemType.TntMinecart; + mappings[26738688] = ItemType.HopperMinecart; + mappings[26804224] = ItemType.PrismarineShard; + mappings[26869760] = ItemType.PrismarineCrystals; + mappings[26935296] = ItemType.Rabbit; + mappings[27000832] = ItemType.CookedRabbit; + mappings[27066368] = ItemType.RabbitStew; + mappings[27131904] = ItemType.RabbitFoot; + mappings[27197440] = ItemType.RabbitHide; + mappings[27262976] = ItemType.ArmorStand; + mappings[27328512] = ItemType.IronHorseArmor; + mappings[27394048] = ItemType.GoldenHorseArmor; + mappings[27459584] = ItemType.DiamondHorseArmor; + mappings[27525120] = ItemType.Lead; + mappings[27590656] = ItemType.NameTag; + mappings[27656192] = ItemType.CommandBlockMinecart; + mappings[27721728] = ItemType.Mutton; + mappings[27787264] = ItemType.CookedMutton; + mappings[27852800] = ItemType.BlackBanner; + mappings[27852801] = ItemType.RedBanner; + mappings[27852802] = ItemType.GreenBanner; + mappings[27852803] = ItemType.BrownBanner; + mappings[27852804] = ItemType.BlueBanner; + mappings[27852805] = ItemType.PurpleBanner; + mappings[27852806] = ItemType.CyanBanner; + mappings[27852807] = ItemType.LightGrayBanner; + mappings[27852808] = ItemType.GrayBanner; + mappings[27852809] = ItemType.PinkBanner; + mappings[27852810] = ItemType.LimeBanner; + mappings[27852811] = ItemType.YellowBanner; + mappings[27852812] = ItemType.LightBlueBanner; + mappings[27852813] = ItemType.MagentaBanner; + mappings[27852814] = ItemType.OrangeBanner; + mappings[27852815] = ItemType.WhiteBanner; + mappings[27918336] = ItemType.EndCrystal; + mappings[27983872] = ItemType.SpruceDoor; + mappings[28049408] = ItemType.BirchDoor; + mappings[28114944] = ItemType.JungleDoor; + mappings[28180480] = ItemType.AcaciaDoor; + mappings[28246016] = ItemType.DarkOakDoor; + mappings[28311552] = ItemType.ChorusFruit; + mappings[28377088] = ItemType.PoppedChorusFruit; + mappings[28442624] = ItemType.Beetroot; + mappings[28508160] = ItemType.BeetrootSeeds; + mappings[28573696] = ItemType.BeetrootSoup; + mappings[28639232] = ItemType.DragonBreath; + mappings[28704768] = ItemType.SplashPotion; + mappings[28770304] = ItemType.SpectralArrow; + mappings[28835840] = ItemType.Arrow; + mappings[28901376] = ItemType.LingeringPotion; + mappings[28966912] = ItemType.Shield; + mappings[29032448] = ItemType.Elytra; + mappings[29097984] = ItemType.SpruceBoat; + mappings[29163520] = ItemType.BirchBoat; + mappings[29229056] = ItemType.JungleBoat; + mappings[29294592] = ItemType.AcaciaBoat; + mappings[29360128] = ItemType.DarkOakBoat; + mappings[147849216] = ItemType.MusicDisc13; + mappings[147914752] = ItemType.MusicDiscCat; + mappings[147980288] = ItemType.MusicDiscBlocks; + mappings[148045824] = ItemType.MusicDiscChirp; + mappings[148111360] = ItemType.MusicDiscFar; + mappings[148176896] = ItemType.MusicDiscMall; + mappings[148242432] = ItemType.MusicDiscMellohi; + mappings[148307968] = ItemType.MusicDiscStal; + mappings[148373504] = ItemType.MusicDiscStrad; + mappings[148439040] = ItemType.MusicDiscWard; + mappings[148504576] = ItemType.MusicDisc11; + mappings[148570112] = ItemType.MusicDiscWait; + mappings[9371648] = ItemType.OakButton; + mappings[17563648] = ItemType.WoodenSword; + mappings[17629184] = ItemType.WoodenShovel; + mappings[17694720] = ItemType.WoodenPickaxe; + mappings[17760256] = ItemType.WoodenAxe; + mappings[19005440] = ItemType.WoodenHoe; + mappings[19333120] = ItemType.WheatSeeds; + mappings[19398656] = ItemType.Wheat; + mappings[21233664] = ItemType.OakDoor; + mappings[21364736] = ItemType.WaterBucket; + } + + protected override Dictionary GetDict() + { + return mappings; + } + } +} \ No newline at end of file diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs index 1961cba751..988434871a 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs @@ -197,6 +197,7 @@ public Protocol18Handler(TcpClient Client, int protocolVersion, IMinecraftComHan >= MC_1_16_1_Version => new ItemPalette1161(), >= MC_1_15_Version => new ItemPalette115(), >= MC_1_12_Version => new ItemPalette112(), + >= MC_1_10_Version => new ItemPalette110(), >= MC_1_9_Version => new ItemPalette19(), _ => new ItemPalette18() }; From 691f1a136eae2617b049d9cbb58153d05776e6e4 Mon Sep 17 00:00:00 2001 From: Anon Date: Tue, 12 Mar 2024 14:04:36 +0100 Subject: [PATCH 5/7] Added Item Palette for 1.11 --- .../Inventory/ItemPalettes/ItemPalette111.cs | 646 ++++++++++++++++++ .../Protocol/Handlers/Protocol18.cs | 1 + 2 files changed, 647 insertions(+) create mode 100644 MinecraftClient/Inventory/ItemPalettes/ItemPalette111.cs diff --git a/MinecraftClient/Inventory/ItemPalettes/ItemPalette111.cs b/MinecraftClient/Inventory/ItemPalettes/ItemPalette111.cs new file mode 100644 index 0000000000..9d9f20bbb0 --- /dev/null +++ b/MinecraftClient/Inventory/ItemPalettes/ItemPalette111.cs @@ -0,0 +1,646 @@ +using System.Collections.Generic; + +namespace MinecraftClient.Inventory.ItemPalettes +{ + /// + /// For MC 1.8 + /// Done manually by Milutinke :( + /// + public class ItemPalette111 : ItemPalette + { + private static readonly Dictionary mappings = new(); + + static ItemPalette111() + { + // Mapping IDs are a derived from: (Item ID << 16) | Data + mappings[0] = ItemType.Air; + mappings[65536] = ItemType.Stone; + mappings[65537] = ItemType.Granite; + mappings[65538] = ItemType.PolishedGranite; + mappings[65539] = ItemType.Diorite; + mappings[65540] = ItemType.PolishedDiorite; + mappings[65541] = ItemType.Andesite; + mappings[65542] = ItemType.PolishedAndesite; + mappings[131072] = ItemType.GrassBlock; + mappings[196608] = ItemType.Dirt; + mappings[196609] = ItemType.CoarseDirt; + mappings[196610] = ItemType.Podzol; + mappings[262144] = ItemType.Cobblestone; + mappings[327680] = ItemType.OakPlanks; + mappings[327681] = ItemType.SprucePlanks; + mappings[327682] = ItemType.BirchPlanks; + mappings[327683] = ItemType.JunglePlanks; + mappings[327684] = ItemType.AcaciaPlanks; + mappings[327685] = ItemType.DarkOakPlanks; + mappings[393216] = ItemType.OakSapling; + mappings[393217] = ItemType.SpruceSapling; + mappings[393218] = ItemType.BirchSapling; + mappings[393219] = ItemType.JungleSapling; + mappings[393220] = ItemType.AcaciaSapling; + mappings[393221] = ItemType.DarkOakSapling; + mappings[458752] = ItemType.Bedrock; + mappings[524288] = ItemType.WaterBucket; // Still Water Block Item + mappings[589824] = ItemType.WaterBucket; // Flowing Water Block Item + mappings[655360] = ItemType.LavaBucket; // Still Lava Block Item + mappings[720896] = ItemType.LavaBucket; // Flowing Lava Block Item + mappings[786432] = ItemType.Sand; + mappings[786433] = ItemType.RedSand; + mappings[851968] = ItemType.Gravel; + mappings[917504] = ItemType.GoldOre; + mappings[983040] = ItemType.IronOre; + mappings[1048576] = ItemType.CoalOre; + mappings[1114112] = ItemType.OakLog; + mappings[1114113] = ItemType.SpruceLog; + mappings[1114114] = ItemType.BirchLog; + mappings[1114115] = ItemType.JungleLog; + mappings[1179648] = ItemType.OakLeaves; + mappings[1179649] = ItemType.SpruceLeaves; + mappings[1179650] = ItemType.BirchLeaves; + mappings[1179651] = ItemType.JungleLeaves; + mappings[1245184] = ItemType.Sponge; + mappings[1245185] = ItemType.WetSponge; + mappings[1310720] = ItemType.Glass; + mappings[1376256] = ItemType.LapisOre; + mappings[1441792] = ItemType.LapisBlock; + mappings[1507328] = ItemType.Dispenser; + mappings[1572864] = ItemType.Sandstone; + mappings[1572865] = ItemType.ChiseledSandstone; + mappings[1572866] = ItemType.SmoothSandstone; + mappings[1638400] = ItemType.NoteBlock; + mappings[1769472] = ItemType.PoweredRail; + mappings[1835008] = ItemType.DetectorRail; + mappings[1900544] = ItemType.StickyPiston; + mappings[1966080] = ItemType.Cobweb; + mappings[2031617] = ItemType.Grass; + mappings[2031618] = ItemType.Fern; + mappings[2097152] = ItemType.DeadBush; + mappings[2162688] = ItemType.Piston; + mappings[2293760] = ItemType.WhiteWool; + mappings[2293761] = ItemType.OrangeWool; + mappings[2293762] = ItemType.MagentaWool; + mappings[2293763] = ItemType.LightBlueWool; + mappings[2293764] = ItemType.YellowWool; + mappings[2293765] = ItemType.LimeWool; + mappings[2293766] = ItemType.PinkWool; + mappings[2293767] = ItemType.GrayWool; + mappings[2293768] = ItemType.LightGrayWool; + mappings[2293769] = ItemType.CyanWool; + mappings[2293770] = ItemType.PurpleWool; + mappings[2293771] = ItemType.BlueWool; + mappings[2293772] = ItemType.BrownWool; + mappings[2293773] = ItemType.GreenWool; + mappings[2293774] = ItemType.RedWool; + mappings[2293775] = ItemType.BlackWool; + mappings[2424832] = ItemType.Dandelion; + mappings[2490368] = ItemType.Poppy; + mappings[2490369] = ItemType.BlueOrchid; + mappings[2490370] = ItemType.Allium; + mappings[2490371] = ItemType.AzureBluet; + mappings[2490372] = ItemType.RedTulip; + mappings[2490373] = ItemType.OrangeTulip; + mappings[2490374] = ItemType.WhiteTulip; + mappings[2490375] = ItemType.PinkTulip; + mappings[2490376] = ItemType.OxeyeDaisy; + mappings[2555904] = ItemType.BrownMushroom; + mappings[2621440] = ItemType.RedMushroom; + mappings[2686976] = ItemType.GoldBlock; + mappings[2752512] = ItemType.IronBlock; + mappings[2883584] = ItemType.StoneSlab; + mappings[2883585] = ItemType.SandstoneSlab; + mappings[2883587] = ItemType.CobblestoneSlab; + mappings[2883588] = ItemType.BrickSlab; + mappings[2883589] = ItemType.StoneBrickSlab; + mappings[2883590] = ItemType.NetherBrickSlab; + mappings[2883591] = ItemType.QuartzSlab; + mappings[2949120] = ItemType.Bricks; + mappings[3014656] = ItemType.Tnt; + mappings[3080192] = ItemType.Bookshelf; + mappings[3145728] = ItemType.MossyCobblestone; + mappings[3211264] = ItemType.Obsidian; + mappings[3276800] = ItemType.Torch; + mappings[3407872] = ItemType.Spawner; + mappings[3473408] = ItemType.OakStairs; + mappings[3538944] = ItemType.Chest; + mappings[3670016] = ItemType.DiamondOre; + mappings[3735552] = ItemType.DiamondBlock; + mappings[3801088] = ItemType.CraftingTable; + mappings[3932160] = ItemType.Farmland; + mappings[3997696] = ItemType.Furnace; + mappings[4259840] = ItemType.Ladder; + mappings[4325376] = ItemType.Rail; + mappings[4390912] = ItemType.CobblestoneStairs; + mappings[4521984] = ItemType.Lever; + mappings[4587520] = ItemType.StonePressurePlate; + mappings[4718592] = ItemType.OakPressurePlate; + mappings[4784128] = ItemType.RedstoneOre; + mappings[4980736] = ItemType.RedstoneTorch; + mappings[5046272] = ItemType.StoneButton; + mappings[5111808] = ItemType.Snow; + mappings[5177344] = ItemType.Ice; + mappings[5242880] = ItemType.SnowBlock; + mappings[5308416] = ItemType.Cactus; + mappings[5373952] = ItemType.Clay; + mappings[5505024] = ItemType.Jukebox; + mappings[5570560] = ItemType.OakFence; + mappings[5636096] = ItemType.Pumpkin; + mappings[5701632] = ItemType.Netherrack; + mappings[5767168] = ItemType.SoulSand; + mappings[5832704] = ItemType.Glowstone; + mappings[5963776] = ItemType.JackOLantern; + mappings[6225920] = ItemType.WhiteStainedGlass; + mappings[6225921] = ItemType.OrangeStainedGlass; + mappings[6225922] = ItemType.MagentaStainedGlass; + mappings[6225923] = ItemType.LightBlueStainedGlass; + mappings[6225924] = ItemType.YellowStainedGlass; + mappings[6225925] = ItemType.LimeStainedGlass; + mappings[6225926] = ItemType.PinkStainedGlass; + mappings[6225927] = ItemType.GrayStainedGlass; + mappings[6225928] = ItemType.LightGrayStainedGlass; + mappings[6225929] = ItemType.CyanStainedGlass; + mappings[6225930] = ItemType.PurpleStainedGlass; + mappings[6225931] = ItemType.BlueStainedGlass; + mappings[6225932] = ItemType.BrownStainedGlass; + mappings[6225933] = ItemType.GreenStainedGlass; + mappings[6225934] = ItemType.RedStainedGlass; + mappings[6225935] = ItemType.BlackStainedGlass; + mappings[6291456] = ItemType.OakTrapdoor; + mappings[6356992] = ItemType.InfestedStone; + mappings[6356993] = ItemType.InfestedCobblestone; + mappings[6356994] = ItemType.InfestedStoneBricks; + mappings[6356995] = ItemType.InfestedMossyStoneBricks; + mappings[6356996] = ItemType.InfestedCrackedStoneBricks; + mappings[6356997] = ItemType.InfestedChiseledStoneBricks; + mappings[6422528] = ItemType.StoneBricks; + mappings[6422529] = ItemType.MossyStoneBricks; + mappings[6422530] = ItemType.CrackedStoneBricks; + mappings[6422531] = ItemType.ChiseledStoneBricks; + mappings[6488064] = ItemType.BrownMushroomBlock; + mappings[6553600] = ItemType.RedMushroomBlock; + mappings[6619136] = ItemType.IronBars; + mappings[6684672] = ItemType.GlassPane; + mappings[6750208] = ItemType.Melon; + mappings[6946816] = ItemType.Vine; + mappings[7012352] = ItemType.OakFenceGate; + mappings[7077888] = ItemType.BrickStairs; + mappings[7143424] = ItemType.StoneBrickStairs; + mappings[7208960] = ItemType.Mycelium; + mappings[7340032] = ItemType.NetherBricks; + mappings[7405568] = ItemType.NetherBrickFence; + mappings[7471104] = ItemType.NetherBrickStairs; + mappings[7602176] = ItemType.EnchantingTable; + mappings[7864320] = ItemType.EndPortalFrame; + mappings[7929856] = ItemType.EndStone; + mappings[7995392] = ItemType.DragonEgg; + mappings[8060928] = ItemType.RedstoneLamp; + mappings[8388608] = ItemType.SandstoneStairs; + mappings[8454144] = ItemType.EmeraldOre; + mappings[8519680] = ItemType.EnderChest; + mappings[8585216] = ItemType.TripwireHook; + mappings[8716288] = ItemType.EmeraldBlock; + mappings[8781824] = ItemType.SpruceStairs; + mappings[8847360] = ItemType.BirchStairs; + mappings[8912896] = ItemType.JungleStairs; + mappings[8978432] = ItemType.CommandBlock; + mappings[9043968] = ItemType.Beacon; + mappings[9109504] = ItemType.CobblestoneWall; + mappings[9109505] = ItemType.MossyCobblestoneWall; + mappings[9502720] = ItemType.Anvil; + mappings[9502721] = ItemType.ChippedAnvil; + mappings[9502722] = ItemType.DamagedAnvil; + mappings[9568256] = ItemType.TrappedChest; + mappings[9633792] = ItemType.LightWeightedPressurePlate; + mappings[9699328] = ItemType.HeavyWeightedPressurePlate; + mappings[9895936] = ItemType.DaylightDetector; + mappings[9961472] = ItemType.RedstoneBlock; + mappings[10027008] = ItemType.NetherQuartzOre; + mappings[10092544] = ItemType.Hopper; + mappings[10158080] = ItemType.QuartzBlock; + mappings[10158081] = ItemType.ChiseledQuartzBlock; + mappings[10158082] = ItemType.QuartzPillar; + mappings[10223616] = ItemType.QuartzStairs; + mappings[10289152] = ItemType.ActivatorRail; + mappings[10354688] = ItemType.Dropper; + mappings[10420224] = ItemType.WhiteTerracotta; + mappings[10420225] = ItemType.OrangeTerracotta; + mappings[10420226] = ItemType.MagentaTerracotta; + mappings[10420227] = ItemType.LightBlueTerracotta; + mappings[10420228] = ItemType.YellowTerracotta; + mappings[10420229] = ItemType.LimeTerracotta; + mappings[10420230] = ItemType.PinkTerracotta; + mappings[10420231] = ItemType.GrayTerracotta; + mappings[10420232] = ItemType.LightGrayTerracotta; + mappings[10420233] = ItemType.CyanTerracotta; + mappings[10420234] = ItemType.PurpleTerracotta; + mappings[10420235] = ItemType.BlueTerracotta; + mappings[10420236] = ItemType.BrownTerracotta; + mappings[10420237] = ItemType.GreenTerracotta; + mappings[10420238] = ItemType.RedTerracotta; + mappings[10420239] = ItemType.BlackTerracotta; + mappings[10485760] = ItemType.WhiteStainedGlassPane; + mappings[10485761] = ItemType.OrangeStainedGlassPane; + mappings[10485762] = ItemType.MagentaStainedGlassPane; + mappings[10485763] = ItemType.LightBlueStainedGlassPane; + mappings[10485764] = ItemType.YellowStainedGlassPane; + mappings[10485765] = ItemType.LimeStainedGlassPane; + mappings[10485766] = ItemType.PinkStainedGlassPane; + mappings[10485767] = ItemType.GrayStainedGlassPane; + mappings[10485768] = ItemType.LightGrayStainedGlassPane; + mappings[10485769] = ItemType.CyanStainedGlassPane; + mappings[10485770] = ItemType.PurpleStainedGlassPane; + mappings[10485771] = ItemType.BlueStainedGlassPane; + mappings[10485772] = ItemType.BrownStainedGlassPane; + mappings[10485773] = ItemType.GreenStainedGlassPane; + mappings[10485774] = ItemType.RedStainedGlassPane; + mappings[10485775] = ItemType.BlackStainedGlassPane; + mappings[10551296] = ItemType.AcaciaLeaves; + mappings[10551297] = ItemType.DarkOakLeaves; + mappings[10616832] = ItemType.AcaciaLog; + mappings[10616833] = ItemType.DarkOakLog; + mappings[10682368] = ItemType.AcaciaStairs; + mappings[10747904] = ItemType.DarkOakStairs; + mappings[10813440] = ItemType.SlimeBlock; + mappings[10878976] = ItemType.Barrier; + mappings[10944512] = ItemType.IronTrapdoor; + mappings[11010048] = ItemType.Prismarine; + mappings[11010049] = ItemType.PrismarineBricks; + mappings[11010050] = ItemType.DarkPrismarine; + mappings[11075584] = ItemType.SeaLantern; + mappings[11141120] = ItemType.HayBlock; + mappings[11206656] = ItemType.WhiteCarpet; + mappings[11206657] = ItemType.OrangeCarpet; + mappings[11206658] = ItemType.MagentaCarpet; + mappings[11206659] = ItemType.LightBlueCarpet; + mappings[11206660] = ItemType.YellowCarpet; + mappings[11206661] = ItemType.LimeCarpet; + mappings[11206662] = ItemType.PinkCarpet; + mappings[11206663] = ItemType.GrayCarpet; + mappings[11206664] = ItemType.LightGrayCarpet; + mappings[11206665] = ItemType.CyanCarpet; + mappings[11206666] = ItemType.PurpleCarpet; + mappings[11206667] = ItemType.BlueCarpet; + mappings[11206668] = ItemType.BrownCarpet; + mappings[11206669] = ItemType.GreenCarpet; + mappings[11206670] = ItemType.RedCarpet; + mappings[11206671] = ItemType.BlackCarpet; + mappings[11272192] = ItemType.Terracotta; + mappings[11337728] = ItemType.CoalBlock; + mappings[11403264] = ItemType.PackedIce; + mappings[11468800] = ItemType.Sunflower; + mappings[11468801] = ItemType.Lilac; + mappings[11468802] = ItemType.TallGrass; + mappings[11468803] = ItemType.LargeFern; + mappings[11468804] = ItemType.RoseBush; + mappings[11468805] = ItemType.Peony; + mappings[11730944] = ItemType.RedSandstone; + mappings[11730945] = ItemType.ChiseledRedSandstone; + mappings[11730946] = ItemType.SmoothRedSandstone; + mappings[11796480] = ItemType.RedSandstoneStairs; + mappings[11927552] = ItemType.RedSandstoneSlab; + mappings[11993088] = ItemType.SpruceFenceGate; + mappings[12058624] = ItemType.BirchFenceGate; + mappings[12124160] = ItemType.JungleFenceGate; + mappings[12189696] = ItemType.DarkOakFenceGate; + mappings[12255232] = ItemType.AcaciaFenceGate; + mappings[12320768] = ItemType.SpruceFence; + mappings[12386304] = ItemType.BirchFence; + mappings[12451840] = ItemType.JungleFence; + mappings[12517376] = ItemType.DarkOakFence; + mappings[12582912] = ItemType.AcaciaFence; + mappings[12976128] = ItemType.EndRod; + mappings[13041664] = ItemType.ChorusPlant; + mappings[13107200] = ItemType.ChorusFlower; + mappings[13172736] = ItemType.PurpurBlock; + mappings[13238272] = ItemType.PurpurPillar; + mappings[13303808] = ItemType.PurpurStairs; + mappings[13434880] = ItemType.PurpurSlab; + mappings[13500416] = ItemType.EndStoneBricks; + mappings[13631488] = ItemType.DirtPath; + mappings[13762560] = ItemType.RepeatingCommandBlock; + mappings[13828096] = ItemType.ChainCommandBlock; + mappings[13959168] = ItemType.MagmaBlock; + mappings[14024704] = ItemType.NetherWartBlock; + mappings[14090240] = ItemType.RedNetherBricks; + mappings[14155776] = ItemType.BoneBlock; + mappings[14221312] = ItemType.StructureVoid; + mappings[14286848] = ItemType.Observer; + mappings[14417920] = ItemType.OrangeShulkerBox; + mappings[14483456] = ItemType.MagentaShulkerBox; + mappings[14548992] = ItemType.LightBlueShulkerBox; + mappings[14680064] = ItemType.LimeShulkerBox; + mappings[14745600] = ItemType.PinkShulkerBox; + mappings[14811136] = ItemType.GrayShulkerBox; + mappings[14876672] = ItemType.LightGrayShulkerBox; + mappings[14942208] = ItemType.CyanShulkerBox; + mappings[15007744] = ItemType.PurpleShulkerBox; + mappings[15073280] = ItemType.BlueShulkerBox; + mappings[15138816] = ItemType.BrownShulkerBox; + mappings[15204352] = ItemType.GreenShulkerBox; + mappings[15269888] = ItemType.RedShulkerBox; + mappings[15335424] = ItemType.BlackShulkerBox; + mappings[16711680] = ItemType.StructureBlock; + mappings[16777216] = ItemType.IronShovel; + mappings[16842752] = ItemType.IronPickaxe; + mappings[16908288] = ItemType.IronAxe; + mappings[16973824] = ItemType.FlintAndSteel; + mappings[17039360] = ItemType.Apple; + mappings[17104896] = ItemType.Bow; + mappings[17170432] = ItemType.Arrow; + mappings[17235968] = ItemType.Coal; + mappings[17235969] = ItemType.Charcoal; + mappings[17301504] = ItemType.Diamond; + mappings[17367040] = ItemType.IronIngot; + mappings[17432576] = ItemType.GoldIngot; + mappings[17498112] = ItemType.IronSword; + mappings[17825792] = ItemType.StoneSword; + mappings[17891328] = ItemType.StoneShovel; + mappings[17956864] = ItemType.StonePickaxe; + mappings[18022400] = ItemType.StoneAxe; + mappings[18087936] = ItemType.DiamondSword; + mappings[18153472] = ItemType.DiamondShovel; + mappings[18219008] = ItemType.DiamondPickaxe; + mappings[18284544] = ItemType.DiamondAxe; + mappings[18350080] = ItemType.Stick; + mappings[18415616] = ItemType.Bowl; + mappings[18481152] = ItemType.MushroomStew; + mappings[18546688] = ItemType.GoldenSword; + mappings[18612224] = ItemType.GoldenShovel; + mappings[18677760] = ItemType.GoldenPickaxe; + mappings[18743296] = ItemType.GoldenAxe; + mappings[18808832] = ItemType.String; + mappings[18874368] = ItemType.Feather; + mappings[18939904] = ItemType.Gunpowder; + mappings[19070976] = ItemType.StoneHoe; + mappings[19136512] = ItemType.IronHoe; + mappings[19202048] = ItemType.DiamondHoe; + mappings[19267584] = ItemType.GoldenHoe; + mappings[19464192] = ItemType.Bread; + mappings[19529728] = ItemType.LeatherHelmet; + mappings[19660800] = ItemType.LeatherLeggings; + mappings[19791872] = ItemType.ChainmailHelmet; + mappings[19857408] = ItemType.ChainmailChestplate; + mappings[19922944] = ItemType.ChainmailLeggings; + mappings[19988480] = ItemType.ChainmailBoots; + mappings[20054016] = ItemType.IronHelmet; + mappings[20119552] = ItemType.IronChestplate; + mappings[20185088] = ItemType.IronLeggings; + mappings[20250624] = ItemType.IronBoots; + mappings[20316160] = ItemType.DiamondHelmet; + mappings[20381696] = ItemType.DiamondChestplate; + mappings[20447232] = ItemType.DiamondLeggings; + mappings[20512768] = ItemType.DiamondBoots; + mappings[20578304] = ItemType.GoldenHelmet; + mappings[20643840] = ItemType.GoldenChestplate; + mappings[20709376] = ItemType.GoldenLeggings; + mappings[20774912] = ItemType.GoldenBoots; + mappings[20840448] = ItemType.Flint; + mappings[20905984] = ItemType.Porkchop; + mappings[20971520] = ItemType.CookedPorkchop; + mappings[21037056] = ItemType.Painting; + mappings[21102592] = ItemType.GoldenApple; + mappings[21102593] = ItemType.EnchantedGoldenApple; + mappings[21168128] = ItemType.OakSign; + mappings[21299200] = ItemType.Bucket; + mappings[21495808] = ItemType.Minecart; + mappings[21561344] = ItemType.Saddle; + mappings[21626880] = ItemType.IronDoor; + mappings[21692416] = ItemType.Redstone; + mappings[21757952] = ItemType.Snowball; + mappings[21823488] = ItemType.OakBoat; + mappings[21954560] = ItemType.MilkBucket; + mappings[22020096] = ItemType.Brick; + mappings[22085632] = ItemType.ClayBall; + mappings[22151168] = ItemType.Sugar; + mappings[22216704] = ItemType.Paper; + mappings[22282240] = ItemType.Book; + mappings[22347776] = ItemType.SlimeBall; + mappings[22413312] = ItemType.ChestMinecart; + mappings[22478848] = ItemType.FurnaceMinecart; + mappings[22544384] = ItemType.Egg; + mappings[22609920] = ItemType.Compass; + mappings[22675456] = ItemType.FishingRod; + mappings[22740992] = ItemType.Clock; + mappings[22806528] = ItemType.GlowstoneDust; + mappings[22872064] = ItemType.Salmon; + mappings[22872065] = ItemType.Salmon; + mappings[22872066] = ItemType.TropicalFish; + mappings[22872067] = ItemType.Pufferfish; + mappings[22937600] = ItemType.CookedSalmon; + mappings[22937601] = ItemType.CookedSalmon; + mappings[23003136] = ItemType.InkSac; + mappings[23003137] = ItemType.RedDye; + mappings[23003138] = ItemType.GreenDye; + mappings[23003139] = ItemType.CocoaBeans; + mappings[23003140] = ItemType.LapisLazuli; + mappings[23003141] = ItemType.PurpleDye; + mappings[23003142] = ItemType.CyanDye; + mappings[23003143] = ItemType.LightGrayDye; + mappings[23003144] = ItemType.GrayDye; + mappings[23003145] = ItemType.PinkDye; + mappings[23003146] = ItemType.LimeDye; + mappings[23003147] = ItemType.YellowDye; + mappings[23003148] = ItemType.LightBlueDye; + mappings[23003149] = ItemType.MagentaDye; + mappings[23003150] = ItemType.OrangeDye; + mappings[23003151] = ItemType.BoneMeal; + mappings[23068672] = ItemType.Bone; + mappings[23134208] = ItemType.Sugar; + mappings[23199744] = ItemType.Cake; + mappings[23265280] = ItemType.RedBed; + mappings[23330816] = ItemType.Repeater; + mappings[23396352] = ItemType.Cookie; + mappings[23527424] = ItemType.Shears; + mappings[23592960] = ItemType.MelonSlice; + mappings[23658496] = ItemType.PumpkinSeeds; + mappings[23724032] = ItemType.MelonSeeds; + mappings[23789568] = ItemType.Beef; + mappings[23855104] = ItemType.CookedBeef; + mappings[23920640] = ItemType.Chicken; + mappings[23986176] = ItemType.CookedChicken; + mappings[24051712] = ItemType.RottenFlesh; + mappings[24117248] = ItemType.EnderPearl; + mappings[24182784] = ItemType.BlazeRod; + mappings[24248320] = ItemType.GhastTear; + mappings[24313856] = ItemType.GoldNugget; + mappings[24379392] = ItemType.NetherWart; + mappings[24444928] = ItemType.Potion; + mappings[24510464] = ItemType.GlassBottle; + mappings[24576000] = ItemType.SpiderEye; + mappings[24641536] = ItemType.FermentedSpiderEye; + mappings[24707072] = ItemType.BlazePowder; + mappings[24772608] = ItemType.MagmaCream; + mappings[24838144] = ItemType.BrewingStand; + mappings[24903680] = ItemType.Cauldron; + mappings[24969216] = ItemType.EnderEye; + mappings[25034752] = ItemType.GlisteringMelonSlice; + mappings[25100288] = ItemType.BatSpawnEgg; + mappings[25100288] = ItemType.BlazeSpawnEgg; + mappings[25100288] = ItemType.CaveSpiderSpawnEgg; + mappings[25100288] = ItemType.ChickenSpawnEgg; + mappings[25100288] = ItemType.CowSpawnEgg; + mappings[25100288] = ItemType.CreeperSpawnEgg; + mappings[25100288] = ItemType.DonkeySpawnEgg; + mappings[25100288] = ItemType.ElderGuardianSpawnEgg; + mappings[25100288] = ItemType.EndermanSpawnEgg; + mappings[25100288] = ItemType.EndermiteSpawnEgg; + mappings[25100288] = ItemType.EvokerSpawnEgg; + mappings[25100288] = ItemType.GhastSpawnEgg; + mappings[25100288] = ItemType.GuardianSpawnEgg; + mappings[25100288] = ItemType.HorseSpawnEgg; + mappings[25100288] = ItemType.HuskSpawnEgg; + mappings[25100288] = ItemType.LlamaSpawnEgg; + mappings[25100288] = ItemType.MagmaCubeSpawnEgg; + mappings[25100288] = ItemType.MooshroomSpawnEgg; + mappings[25100288] = ItemType.MuleSpawnEgg; + mappings[25100288] = ItemType.OcelotSpawnEgg; + mappings[25100288] = ItemType.PigSpawnEgg; + mappings[25100288] = ItemType.PolarBearSpawnEgg; + mappings[25100288] = ItemType.RabbitSpawnEgg; + mappings[25100288] = ItemType.SheepSpawnEgg; + mappings[25100288] = ItemType.ShulkerSpawnEgg; + mappings[25100288] = ItemType.SilverfishSpawnEgg; + mappings[25100288] = ItemType.SkeletonHorseSpawnEgg; + mappings[25100288] = ItemType.SkeletonSpawnEgg; + mappings[25100288] = ItemType.SlimeSpawnEgg; + mappings[25100288] = ItemType.SpiderSpawnEgg; + mappings[25100288] = ItemType.SquidSpawnEgg; + mappings[25100288] = ItemType.StraySpawnEgg; + mappings[25100288] = ItemType.VexSpawnEgg; + mappings[25100288] = ItemType.VillagerSpawnEgg; + mappings[25100288] = ItemType.VindicatorSpawnEgg; + mappings[25100288] = ItemType.WitchSpawnEgg; + mappings[25100288] = ItemType.WitherSkeletonSpawnEgg; + mappings[25100288] = ItemType.WolfSpawnEgg; + mappings[25100288] = ItemType.ZombieHorseSpawnEgg; + mappings[25100288] = ItemType.ZombieSpawnEgg; + mappings[25100288] = ItemType.ZombieVillagerSpawnEgg; + mappings[25100288] = ItemType.ZombifiedPiglinSpawnEgg; + mappings[25165824] = ItemType.ExperienceBottle; + mappings[25231360] = ItemType.FireCharge; + mappings[25427968] = ItemType.Emerald; + mappings[25493504] = ItemType.ItemFrame; + mappings[25559040] = ItemType.FlowerPot; + mappings[25624576] = ItemType.Carrot; + mappings[25690112] = ItemType.Potato; + mappings[25755648] = ItemType.BakedPotato; + mappings[25821184] = ItemType.PoisonousPotato; + mappings[25886720] = ItemType.Map; + mappings[25952256] = ItemType.GoldenCarrot; + mappings[26017792] = ItemType.SkeletonSkull; + mappings[26017793] = ItemType.WitherSkeletonSkull; + mappings[26017794] = ItemType.ZombieHead; + mappings[26017795] = ItemType.PlayerHead; + mappings[26017796] = ItemType.CreeperHead; + mappings[26017797] = ItemType.DragonHead; + mappings[26083328] = ItemType.CarrotOnAStick; + mappings[26148864] = ItemType.NetherStar; + mappings[26214400] = ItemType.PumpkinPie; + mappings[26279936] = ItemType.FireworkRocket; + mappings[26411008] = ItemType.EnchantedBook; + mappings[26476544] = ItemType.Comparator; + mappings[26542080] = ItemType.NetherBrick; + mappings[26607616] = ItemType.Quartz; + mappings[26673152] = ItemType.TntMinecart; + mappings[26738688] = ItemType.HopperMinecart; + mappings[26804224] = ItemType.PrismarineShard; + mappings[26869760] = ItemType.PrismarineCrystals; + mappings[26935296] = ItemType.Rabbit; + mappings[27000832] = ItemType.CookedRabbit; + mappings[27066368] = ItemType.RabbitStew; + mappings[27131904] = ItemType.RabbitFoot; + mappings[27197440] = ItemType.RabbitHide; + mappings[27262976] = ItemType.ArmorStand; + mappings[27328512] = ItemType.IronHorseArmor; + mappings[27394048] = ItemType.GoldenHorseArmor; + mappings[27459584] = ItemType.DiamondHorseArmor; + mappings[27590656] = ItemType.NameTag; + mappings[27656192] = ItemType.CommandBlockMinecart; + mappings[27721728] = ItemType.Mutton; + mappings[27787264] = ItemType.CookedMutton; + mappings[27852800] = ItemType.BlackBanner; + mappings[27852801] = ItemType.RedBanner; + mappings[27852802] = ItemType.GreenBanner; + mappings[27852803] = ItemType.BrownBanner; + mappings[27852804] = ItemType.BlueBanner; + mappings[27852805] = ItemType.PurpleBanner; + mappings[27852806] = ItemType.CyanBanner; + mappings[27852807] = ItemType.LightGrayBanner; + mappings[27852808] = ItemType.GrayBanner; + mappings[27852809] = ItemType.PinkBanner; + mappings[27852810] = ItemType.LimeBanner; + mappings[27852811] = ItemType.YellowBanner; + mappings[27852812] = ItemType.LightBlueBanner; + mappings[27852813] = ItemType.MagentaBanner; + mappings[27852814] = ItemType.OrangeBanner; + mappings[27852815] = ItemType.WhiteBanner; + mappings[27918336] = ItemType.EndCrystal; + mappings[27983872] = ItemType.SpruceDoor; + mappings[28049408] = ItemType.BirchDoor; + mappings[28114944] = ItemType.JungleDoor; + mappings[28180480] = ItemType.AcaciaDoor; + mappings[28246016] = ItemType.DarkOakDoor; + mappings[28311552] = ItemType.ChorusFruit; + mappings[28377088] = ItemType.PoppedChorusFruit; + mappings[28442624] = ItemType.Beetroot; + mappings[28508160] = ItemType.BeetrootSeeds; + mappings[28573696] = ItemType.BeetrootSoup; + mappings[28639232] = ItemType.DragonBreath; + mappings[28704768] = ItemType.SplashPotion; + mappings[28770304] = ItemType.SpectralArrow; + mappings[28835840] = ItemType.Arrow; + mappings[28901376] = ItemType.LingeringPotion; + mappings[28966912] = ItemType.Shield; + mappings[29032448] = ItemType.Elytra; + mappings[29097984] = ItemType.SpruceBoat; + mappings[29163520] = ItemType.BirchBoat; + mappings[29229056] = ItemType.JungleBoat; + mappings[29294592] = ItemType.AcaciaBoat; + mappings[29360128] = ItemType.DarkOakBoat; + mappings[29425664] = ItemType.TotemOfUndying; + mappings[29622272] = ItemType.IronNugget; + mappings[19595264] = ItemType.LeatherChestplate; + mappings[19726336] = ItemType.LeatherBoots; + mappings[21430272] = ItemType.LavaBucket; + mappings[21889024] = ItemType.Leather; + mappings[27525120] = ItemType.Lead; + mappings[29491200] = ItemType.ShulkerShell; + mappings[147849216] = ItemType.MusicDisc13; + mappings[147914752] = ItemType.MusicDiscCat; + mappings[147980288] = ItemType.MusicDiscBlocks; + mappings[148045824] = ItemType.MusicDiscChirp; + mappings[148111360] = ItemType.MusicDiscFar; + mappings[148176896] = ItemType.MusicDiscMall; + mappings[148242432] = ItemType.MusicDiscMellohi; + mappings[148307968] = ItemType.MusicDiscStal; + mappings[148373504] = ItemType.MusicDiscStrad; + mappings[148439040] = ItemType.MusicDiscWard; + mappings[148504576] = ItemType.MusicDisc11; + mappings[148570112] = ItemType.MusicDiscWait; + mappings[7274496] = ItemType.LilyPad; + mappings[8257536] = ItemType.OakSlab; + mappings[8257537] = ItemType.SpruceSlab; + mappings[8257538] = ItemType.BirchSlab; + mappings[8257539] = ItemType.JungleSlab; + mappings[8257540] = ItemType.AcaciaSlab; + mappings[8257541] = ItemType.DarkOakSlab; + mappings[9371648] = ItemType.OakButton; + mappings[14352384] = ItemType.WhiteShulkerBox; + mappings[14614528] = ItemType.YellowShulkerBox; + mappings[17563648] = ItemType.WoodenSword; + mappings[17629184] = ItemType.WoodenShovel; + mappings[17694720] = ItemType.WoodenPickaxe; + mappings[17760256] = ItemType.WoodenAxe; + mappings[19005440] = ItemType.WoodenHoe; + mappings[19333120] = ItemType.WheatSeeds; + mappings[19398656] = ItemType.Wheat; + mappings[21233664] = ItemType.OakDoor; + mappings[21364736] = ItemType.WaterBucket; + mappings[25296896] = ItemType.WritableBook; + mappings[25362432] = ItemType.WrittenBook; + } + + protected override Dictionary GetDict() + { + return mappings; + } + } +} \ No newline at end of file diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs index 988434871a..10a28af38d 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs @@ -197,6 +197,7 @@ public Protocol18Handler(TcpClient Client, int protocolVersion, IMinecraftComHan >= MC_1_16_1_Version => new ItemPalette1161(), >= MC_1_15_Version => new ItemPalette115(), >= MC_1_12_Version => new ItemPalette112(), + >= MC_1_11_Version => new ItemPalette111(), >= MC_1_10_Version => new ItemPalette110(), >= MC_1_9_Version => new ItemPalette19(), _ => new ItemPalette18() From 2ce0311949e931729d95ffb48b77bf1a84ec41f8 Mon Sep 17 00:00:00 2001 From: Anon Date: Tue, 12 Mar 2024 15:05:47 +0100 Subject: [PATCH 6/7] Fixed a crash in SendPlayerBlockPlacement --- .../Protocol/Handlers/Protocol18.cs | 59 +++++++++++-------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs index 10a28af38d..9fff7bfef6 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs @@ -3918,41 +3918,54 @@ public bool SendPlayerDigging(int status, Location location, Direction face, int public bool SendPlayerBlockPlacement(int hand, Location location, Direction face, int sequenceId) { - if (protocolVersion < MC_1_14_Version) + try { - var playerInventory = handler.GetInventory(0); - - if (playerInventory == null) - return false; - var packet = new List(); - packet.AddRange(dataTypes.GetLocation(location)); - packet.Add(dataTypes.GetBlockFace(face)); + switch (protocolVersion) + { + case < MC_1_9_Version: + packet.AddRange(dataTypes.GetLocation(location)); + packet.Add(dataTypes.GetBlockFace(face)); - var item = playerInventory.Items[((McClient)handler).GetCurrentSlot()]; - packet.AddRange(dataTypes.GetItemSlot(item, itemPalette)); + var playerInventory = handler.GetInventory(0); - packet.Add(0); // cursorX - packet.Add(0); // cursorY - packet.Add(0); // cursorZ + if (playerInventory?.Items is null) + return false; - SendPacket(PacketTypesOut.PlayerBlockPlacement, packet); - return true; - } + var slotWindowIds = new int[]{ 36, 37, 38, 39, 40, 41, 42, 43, 44 }; + var currentSlot = ((McClient)handler).GetCurrentSlot(); + + playerInventory.Items.TryGetValue(slotWindowIds[currentSlot], out var item); + packet.AddRange(dataTypes.GetItemSlot(item, itemPalette)); + + packet.Add(0); // cursorX + packet.Add(0); // cursorY + packet.Add(0); // cursorZ - try - { - var packet = new List(); - packet.AddRange(DataTypes.GetVarInt(hand)); - packet.AddRange(dataTypes.GetLocation(location)); - packet.AddRange(DataTypes.GetVarInt(dataTypes.GetBlockFace(face))); + return true; + case < MC_1_14_Version: + packet.AddRange(dataTypes.GetLocation(location)); + packet.AddRange(DataTypes.GetVarInt(dataTypes.GetBlockFace(face))); + packet.AddRange(DataTypes.GetVarInt(hand)); + break; + default: + packet.AddRange(DataTypes.GetVarInt(hand)); + packet.AddRange(dataTypes.GetLocation(location)); + packet.AddRange(DataTypes.GetVarInt(dataTypes.GetBlockFace(face))); + break; + } + packet.AddRange(dataTypes.GetFloat(0.5f)); // cursorX packet.AddRange(dataTypes.GetFloat(0.5f)); // cursorY packet.AddRange(dataTypes.GetFloat(0.5f)); // cursorZ - packet.Add(0); // insideBlock = false; + + if(protocolVersion >= MC_1_14_Version) + packet.Add(0); // insideBlock = false + if (protocolVersion >= MC_1_19_Version) packet.AddRange(DataTypes.GetVarInt(sequenceId)); + SendPacket(PacketTypesOut.PlayerBlockPlacement, packet); return true; } From 5044ec965b74055b5bdf2d40b40433ac42132c67 Mon Sep 17 00:00:00 2001 From: Anon Date: Tue, 12 Mar 2024 19:07:20 +0100 Subject: [PATCH 7/7] Un-commended try-catch block --- MinecraftClient/Protocol/Handlers/Protocol18.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs index 9fff7bfef6..3268ec22ae 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs @@ -370,8 +370,8 @@ internal Tuple> ReadNextPacket() /// TRUE if the packet was processed, FALSE if ignored or unknown internal bool HandlePacket(int packetId, Queue packetData) { - //try - //{ + try + { switch (currentState) { // https://wiki.vg/Protocol#Login @@ -454,7 +454,7 @@ internal bool HandlePacket(int packetId, Queue packetData) default: return true; } - /*} + } catch (Exception innerException) { if (innerException is ThreadAbortException || innerException is SocketException || @@ -469,7 +469,7 @@ internal bool HandlePacket(int packetId, Queue packetData) currentState == CurrentState.Login, innerException.GetType()), innerException); - }*/ + } return true; }