ResetRecipeGroups() static private method

static private ResetRecipeGroups ( ) : void
return void
Esempio n. 1
0
        internal static void Unload()
        {
            ContentInstance.Clear();
            ModTypeLookup.Clear();
            ItemLoader.Unload();
            EquipLoader.Unload();
            ModPrefix.Unload();
            ModDust.Unload();
            TileLoader.Unload();
            ModTileEntity.UnloadAll();
            WallLoader.Unload();
            ProjectileLoader.Unload();
            NPCLoader.Unload();
            NPCHeadLoader.Unload();
            PlayerHooks.Unload();
            BuffLoader.Unload();
            MountLoader.Unload();
            RarityLoader.Unload();
            DamageClassLoader.Unload();
            ModGore.Unload();
            SoundLoader.Unload();
            DisposeMusic();
            BackgroundTextureLoader.Unload();
            UgBgStyleLoader.Unload();
            SurfaceBgStyleLoader.Unload();
            GlobalBgStyleLoader.Unload();
            WaterStyleLoader.Unload();
            WaterfallStyleLoader.Unload();
            WorldHooks.Unload();
            ResizeArrays(true);
            for (int k = 0; k < Recipe.maxRecipes; k++)
            {
                Main.recipe[k] = new Recipe();
            }
            Recipe.numRecipes = 0;
            RecipeGroupHelper.ResetRecipeGroups();
            Recipe.SetupRecipes();
            MapLoader.UnloadModMap();
            ItemSorting.SetupWhiteLists();
            HotKeyLoader.Unload();
            RecipeHooks.Unload();
            CommandManager.Unload();
            TagSerializer.Reload();
            ModNet.Unload();
            Config.ConfigManager.Unload();
            CustomCurrencyManager.Initialize();
            EffectsTracker.RemoveModEffects();

            // ItemID.Search = IdDictionary.Create<ItemID, short>();
            // NPCID.Search = IdDictionary.Create<NPCID, short>();
            // ProjectileID.Search = IdDictionary.Create<ProjectileID, short>();
            // TileID.Search = IdDictionary.Create<TileID, ushort>();
            // WallID.Search = IdDictionary.Create<WallID, ushort>();
            // BuffID.Search = IdDictionary.Create<BuffID, int>();

            ContentSamples.Initialize();

            CleanupModReferences();
        }
Esempio n. 2
0
        internal static void Unload()
        {
            while (loadOrder.Count > 0)
            {
                GetMod(loadOrder.Pop()).UnloadContent();
            }

            loadOrder.Clear();
            loadedMods = new Mod[0];

            ItemLoader.Unload();
            EquipLoader.Unload();
            ModPrefix.Unload();
            ModDust.Unload();
            TileLoader.Unload();
            ModTileEntity.Unload();
            WallLoader.Unload();
            ProjectileLoader.Unload();
            NPCLoader.Unload();
            NPCHeadLoader.Unload();
            PlayerHooks.Unload();
            BuffLoader.Unload();
            MountLoader.Unload();
            ModGore.Unload();
            SoundLoader.Unload();
            DisposeMusic();
            BackgroundTextureLoader.Unload();
            UgBgStyleLoader.Unload();
            SurfaceBgStyleLoader.Unload();
            GlobalBgStyleLoader.Unload();
            WaterStyleLoader.Unload();
            WaterfallStyleLoader.Unload();
            mods.Clear();
            WorldHooks.Unload();
            ResizeArrays(true);
            for (int k = 0; k < Recipe.maxRecipes; k++)
            {
                Main.recipe[k] = new Recipe();
            }
            Recipe.numRecipes = 0;
            RecipeGroupHelper.ResetRecipeGroups();
            Recipe.SetupRecipes();
            MapLoader.UnloadModMap();
            ItemSorting.SetupWhiteLists();
            modHotKeys.Clear();
            RecipeHooks.Unload();
            CommandManager.Unload();
            TagSerializer.Reload();
            ModNet.Unload();
            GameContent.UI.CustomCurrencyManager.Initialize();
            CleanupModReferences();

            if (!Main.dedServ && Main.netMode != 1)             //disable vanilla client compatiblity restrictions when reloading on a client
            {
                ModNet.AllowVanillaClients = false;
            }
        }
Esempio n. 3
0
        private static void SetupRecipes()
        {
            Interface.loadMods.SetLoadStage("tModLoader.MSAddingRecipes");
            for (int k = 0; k < Recipe.maxRecipes; k++)
            {
                Main.recipe[k] = new Recipe();
            }

            Recipe.numRecipes = 0;
            RecipeGroupHelper.ResetRecipeGroups();
            Recipe.SetupRecipes();
        }
Esempio n. 4
0
        private static void SetupRecipes(CancellationToken token)
        {
            Interface.loadMods.SetLoadStage("tModLoader.MSAddingRecipes");
            for (int k = 0; k < Recipe.maxRecipes; k++)
            {
                token.ThrowIfCancellationRequested();
                Main.recipe[k] = new Recipe();
            }

            Recipe.numRecipes = 0;
            RecipeGroupHelper.ResetRecipeGroups();
            Recipe.SetupRecipes();
        }
Esempio n. 5
0
        internal static void Unload()
        {
            ItemLoader.Unload();
            EquipLoader.Unload();
            ModPrefix.Unload();
            ModDust.Unload();
            TileLoader.Unload();
            ModTileEntity.Unload();
            WallLoader.Unload();
            ProjectileLoader.Unload();
            NPCLoader.Unload();
            NPCHeadLoader.Unload();
            PlayerHooks.Unload();
            BuffLoader.Unload();
            MountLoader.Unload();
            ModGore.Unload();
            SoundLoader.Unload();
            DisposeMusic();
            BackgroundTextureLoader.Unload();
            UgBgStyleLoader.Unload();
            SurfaceBgStyleLoader.Unload();
            GlobalBgStyleLoader.Unload();
            WaterStyleLoader.Unload();
            WaterfallStyleLoader.Unload();
            WorldHooks.Unload();
            ResizeArrays(true);
            for (int k = 0; k < Recipe.maxRecipes; k++)
            {
                Main.recipe[k] = new Recipe();
            }
            Recipe.numRecipes = 0;
            RecipeGroupHelper.ResetRecipeGroups();
            Recipe.SetupRecipes();
            MapLoader.UnloadModMap();
            ItemSorting.SetupWhiteLists();
            modHotKeys.Clear();
            RecipeHooks.Unload();
            CommandManager.Unload();
            TagSerializer.Reload();
            ModNet.Unload();
            Config.ConfigManager.Unload();
            CustomCurrencyManager.Initialize();
            EffectsTracker.RemoveModEffects();

            CleanupModReferences();
        }
Esempio n. 6
0
        internal static void do_Load(object threadContext)
        {
            if (!LoadMods())
            {
                Main.menuMode = Interface.errorMessageID;
                return;
            }
            if (Main.dedServ)
            {
                Console.WriteLine(Language.GetTextValue("tModLoader.AddingModContent"));
            }
            int num = 0;

            foreach (Mod mod in mods.Values)
            {
                Interface.loadMods.SetProgressInit(mod.Name, num, mods.Count);
                try
                {
                    mod.loading = true;
                    mod.File?.Read(TmodFile.LoadedState.Streaming, mod.LoadResourceFromStream);
                    mod.Autoload();
                    Interface.loadMods.SetSubProgressInit("");
                    mod.Load();
                    mod.loading = false;
                }
                catch (Exception e)
                {
                    DisableMod(mod.Name);
                    ErrorLogger.LogLoadingError(mod.Name, mod.tModLoaderVersion, e);
                    Main.menuMode = Interface.errorMessageID;
                    return;
                }
                num++;
            }
            Interface.loadMods.SetProgressSetup(0f);
            ResizeArrays();
            RecipeGroupHelper.FixRecipeGroupLookups();
            num = 0;
            foreach (Mod mod in mods.Values)
            {
                Interface.loadMods.SetProgressLoad(mod.Name, num, mods.Count);
                try
                {
                    mod.SetupContent();
                    mod.PostSetupContent();
                    mod.File?.UnloadAssets();
                }
                catch (Exception e)
                {
                    DisableMod(mod.Name);
                    ErrorLogger.LogLoadingError(mod.Name, mod.tModLoaderVersion, e);
                    Main.menuMode = Interface.errorMessageID;
                    return;
                }
                num++;
            }
            RefreshModLanguage(Language.ActiveCulture);

            if (Main.dedServ)
            {
                ModNet.AssignNetIDs();
                //Main.player[0] = new Player();
            }
            Main.player[255] = new Player(false);             // setup inventory is unnecessary

            MapLoader.SetupModMap();
            ItemSorting.SetupWhiteLists();

            Interface.loadMods.SetProgressRecipes();
            for (int k = 0; k < Recipe.maxRecipes; k++)
            {
                Main.recipe[k] = new Recipe();
            }
            Recipe.numRecipes = 0;
            RecipeGroupHelper.ResetRecipeGroups();
            try
            {
                Recipe.SetupRecipes();
            }
            catch (AddRecipesException e)
            {
                ErrorLogger.LogLoadingError(e.modName, version, e.InnerException, true);
                Main.menuMode = Interface.errorMessageID;
                return;
            }

            if (PostLoad != null)
            {
                PostLoad();
                PostLoad = null;
            }
            else
            {
                Main.menuMode = 0;
            }
            GameInput.PlayerInput.ReInitialize();
        }
Esempio n. 7
0
        internal static void do_Load(object threadContext)
        {
            if (!LoadMods())
            {
                Main.menuMode = Interface.errorMessageID;
                return;
            }
            if (Main.dedServ)
            {
                Console.WriteLine("Adding mod content...");
            }
            int num = 0;

            foreach (Mod mod in mods.Values)
            {
                Interface.loadMods.SetProgressInit(mod.Name, num, mods.Count);
                try
                {
                    mod.Autoload();
                    mod.Load();
                }
                catch (Exception e)
                {
                    DisableMod(mod.File);
                    ErrorLogger.LogLoadingError(mod.Name, mod.tModLoaderVersion, e);
                    Main.menuMode = Interface.errorMessageID;
                    return;
                }
                num++;
            }
            Interface.loadMods.SetProgressSetup(0f);
            ResizeArrays();
            num = 0;
            foreach (Mod mod in mods.Values)
            {
                Interface.loadMods.SetProgressLoad(mod.Name, num, mods.Count);
                try
                {
                    mod.SetupContent();
                    mod.PostSetupContent();
                }
                catch (Exception e)
                {
                    DisableMod(mod.File);
                    ErrorLogger.LogLoadingError(mod.Name, mod.tModLoaderVersion, e);
                    Main.menuMode = Interface.errorMessageID;
                    return;
                }
                num++;
            }

            if (Main.dedServ)
            {
                ModNet.AssignNetIDs();
            }

            MapLoader.SetupModMap();
            ItemSorting.SetupWhiteLists();

            Interface.loadMods.SetProgressRecipes();
            for (int k = 0; k < Recipe.maxRecipes; k++)
            {
                Main.recipe[k] = new Recipe();
            }
            Recipe.numRecipes = 0;
            RecipeGroupHelper.ResetRecipeGroups();
            try
            {
                Recipe.SetupRecipes();
            }
            catch (AddRecipesException e)
            {
                ErrorLogger.LogLoadingError(e.modName, version, e.InnerException, true);
                Main.menuMode = Interface.errorMessageID;
                return;
            }
            if (PostLoad != null)
            {
                PostLoad();
                PostLoad = null;
            }
            else
            {
                Main.menuMode = 0;
            }
            GameInput.PlayerInput.ReInitialize();
        }