/// <summary>
        /// Call this from the MOD main class to execute the patch.
        /// </summary>
        public virtual void Patch()
        {
            Atlas.Sprite sprite = GetItemSprite();

            TechType = TechTypeHandler.Main.AddTechType(TechTypeName, FriendlyName, Description, sprite, false);

            SetCustomLanguageText();

            PrefabHandler.Main.RegisterPrefab(this);
            CraftDataHandler.Main.SetTechData(TechType, GetRecipe());
            SpriteHandler.Main.RegisterSprite(TechType, sprite);
            CraftDataHandler.Main.SetItemSize(TechType, new Vector2int(1, 1));
            CraftDataHandler.Main.AddToGroup(TechGroup.VehicleUpgrades, TechCategory.VehicleUpgrades, TechType);
            CraftDataHandler.Main.SetEquipmentType(TechType, ArmType == ArmType.ExosuitArm ? EquipmentType.ExosuitArm : (EquipmentType)100);
            CraftDataHandler.Main.SetQuickSlotType(TechType, QuickSlotType.Selectable);
            CraftDataHandler.Main.SetBackgroundType(TechType, CraftData.BackgroundType.ExosuitArm);

            EncyData encyData = GetEncyclopediaData();

            if (encyData != null)
            {
                isEncyExists = true;

                PDAEncyclopedia.EntryData entryData = new PDAEncyclopedia.EntryData()
                {
                    key      = ClassID,
                    path     = EncyHelper.GetEncyPath(encyData.node),
                    nodes    = EncyHelper.GetEncyNodes(encyData.node),
                    unlocked = false,
                    popup    = null,
                    image    = encyData.image,
                    audio    = null
                };

                PDAEncyclopediaHandler.Main.AddCustomEntry(entryData);

                LanguageHandler.Main.SetLanguageLine($"Ency_{ClassID}", encyData.title);
                LanguageHandler.Main.SetLanguageLine($"EncyDesc_{ClassID}", encyData.description);
            }

            if (RequiredForUnlock == TechType.None && _Fragment != null)
            {
                PDAScanner.EntryData scannerEntryData = new PDAScanner.EntryData()
                {
                    key              = _Fragment.TechType,
                    blueprint        = TechType,
                    destroyAfterScan = _Fragment.DestroyAfterScan,
                    encyclopedia     = isEncyExists ? ClassID : null,
                    isFragment       = true,
                    locked           = false,
                    scanTime         = _Fragment.ScanTime,
                    totalFragments   = _Fragment.TotalFragments
                };

                PDAHandler.Main.AddCustomScannerEntry(scannerEntryData);

                KnownTechHandler.Main.SetAnalysisTechEntry(TechType, new TechType[1] {
                    TechType
                });
            }
            else
            {
                KnownTechHandler.Main.SetAnalysisTechEntry(RequiredForUnlock, new TechType[1] {
                    TechType
                }, $"{FriendlyName} blueprint discovered!");
            }

            if (ArmType == ArmType.ExosuitArm)
            {
                CraftTreeHandler.Main.AddCraftingNode(CraftTree.Type.SeamothUpgrades, TechType, new string[] { "ExosuitModules" });
            }
            else
            {
                CraftTreeHandler.Main.AddCraftingNode(CraftTree.Type.SeamothUpgrades, TechType, new string[] { "SeamothModules" });
            }

            RegisterArm();
        }
        private IEnumerator PatchAsync()
        {
            while (!SpriteManager.hasInitialized)
            {
                BZLogger.Debug($"{TechTypeName} Spritemanager is not ready!");
                yield return(null);
            }

            BZLogger.Debug($"{TechTypeName} Async patch started.");

            Sprite sprite = GetItemSprite();

            SpriteHandler.Main.RegisterSprite(TechType, sprite);

            PrefabHandler.Main.RegisterPrefab(this);
            CraftDataHandler.Main.SetTechData(TechType, GetRecipe());
            CraftDataHandler.Main.SetItemSize(TechType, new Vector2int(1, 1));
            CraftDataHandler.Main.AddToGroup(TechGroup.VehicleUpgrades, TechCategory.VehicleUpgrades, TechType);
            CraftDataHandler.Main.SetEquipmentType(TechType, (EquipmentType)200);
            CraftDataHandler.Main.SetQuickSlotType(TechType, QuickSlotType.Selectable);
            CraftDataHandler.Main.SetBackgroundType(TechType, CraftData.BackgroundType.ExosuitArm);

            EncyData encyData = GetEncyclopediaData();

            if (encyData != null)
            {
                isEncyExists = true;

                PDAEncyclopedia.EntryData entryData = new PDAEncyclopedia.EntryData()
                {
                    key      = ClassID,
                    path     = EncyHelper.GetEncyPath(encyData.node),
                    nodes    = EncyHelper.GetEncyNodes(encyData.node),
                    kind     = PDAEncyclopedia.EntryData.Kind.Encyclopedia,
                    unlocked = false,
                    popup    = _Fragment != null ? _Fragment.UnlockSprite : sprite,
                    image    = encyData.image,
                    audio    = null,
                    hidden   = false
                };

                PDAEncyclopediaHandler.Main.AddCustomEntry(entryData);

                LanguageHandler.Main.SetLanguageLine($"Ency_{ClassID}", encyData.title);
                LanguageHandler.Main.SetLanguageLine($"EncyDesc_{ClassID}", encyData.description);
            }

            if (RequiredForUnlock == TechType.None && _Fragment != null)
            {
                PDAScanner.EntryData scannerEntryData = new PDAScanner.EntryData()
                {
                    key              = _Fragment.TechType,
                    blueprint        = TechType,
                    destroyAfterScan = _Fragment.DestroyAfterScan,
                    encyclopedia     = isEncyExists ? ClassID : null,
                    isFragment       = true,
                    locked           = false,
                    scanTime         = _Fragment.ScanTime,
                    totalFragments   = _Fragment.TotalFragments,
                    unlockStoryGoal  = false
                };

                PDAHandler.Main.AddCustomScannerEntry(scannerEntryData);

                KnownTechHandler.Main.SetAnalysisTechEntry(TechType, new TechType[1] {
                    TechType
                }, _Fragment.UnlockSprite);
            }
            else
            {
                KnownTechHandler.Main.SetAnalysisTechEntry(RequiredForUnlock, new TechType[1] {
                    TechType
                }, $"{FriendlyName} blueprint discovered!");
            }

            CraftTreeHandler.Main.AddTabNode(CraftTree.Type.Workbench, "SeaTruckWBUpgrades", "Seatruck Upgrades", SpriteManager.Get(TechType.SeaTruck));

            CraftTreeHandler.Main.AddCraftingNode(CraftTree.Type.Fabricator, TechType, new string[] { "Upgrades", "SeatruckUpgrades" });
            CraftTreeHandler.Main.AddCraftingNode(CraftTree.Type.Workbench, TechType, new string[] { "SeaTruckWBUpgrades" });
            CraftTreeHandler.Main.AddCraftingNode(CraftTree.Type.SeaTruckFabricator, TechType, new string[] { "Upgrades" });
            CraftTreeHandler.Main.AddCraftingNode(CraftTree.Type.SeamothUpgrades, TechType, new string[] { "SeaTruckUpgrade" });

            PostPatch();

            yield break;
        }