Example #1
0
        public override void ProcessTriggers(TriggersSet triggersSet)
        {
            base.ProcessTriggers(triggersSet);

            if (DepositAll.JustPressed)
            {
                ChestUI.DepositAll();
            }
            if (LootAll.JustPressed)
            {
                ChestUI.LootAll();
            }
            if (QuickStack.JustPressed)
            {
                player.QuickStackAllChests();
                ChestUI.QuickStack();
            }
            if (Restock.JustPressed)
            {
                ChestUI.Restock();
            }
            if (SortChest.JustPressed)
            {
                ItemSorting.SortChest();
            }
            if (SortInventory.JustPressed)
            {
                ItemSorting.SortInventory();
            }
        }
Example #2
0
        public string GetField(ItemSorting sorting, out bool descending)
        {
            if (sorting.HasFlag(ItemSorting.Descending))
            {
                descending = true;
                sorting    = sorting & ~ItemSorting.Descending;
            }
            else
            {
                descending = false;
            }
            switch (sorting)
            {
            case ItemSorting.Name: return(Name);

            case ItemSorting.Category: return(category.ToString());

            case ItemSorting.Priority: return(priority.ToString());   /*High Medium Low*/

            case ItemSorting.DateAdded: return(Date_Added.ToShortDateString());

            case ItemSorting.DatePurchased: return(Date_Purchased.ToShortDateString());

            default: throw new Exception($"Unknown Sorting: {sorting}");
            }
        }
Example #3
0
        public ItemSorting SortOptions(string command, out bool valid /*, MenuDisplay menu, List list*/)
        {
            valid = true;
            ItemSorting option = new ItemSorting();

            switch (command)
            {
            case "N": option = ItemSorting.Name; break;

            case "C": option = ItemSorting.Category; break;

            case "P": option = ItemSorting.Priority; break;

            case "D": option = ItemSorting.DateAdded; break;

            case "B": option = ItemSorting.DatePurchased; break;

            default: option = ItemSorting.Name;

                StatusUpdate();
                StatusUpdate($"Please Select one of the options above", ActionStatus.ActionFailure);
                valid = false;
                break;
            }
            return(option);
        }
Example #4
0
        internal static void Load()
        {
            Interface.loadMods.SetLoadStage("tModLoader.MSIntializing", ModLoader.Mods.Length);
            LoadModContent(mod => {
                mod.loading = true;
                mod.File?.Read(TmodFile.LoadedState.Streaming, mod.LoadResourceFromStream);
                mod.Autoload();
                mod.Load();
                mod.loading = false;
            });

            Interface.loadMods.SetLoadStage("tModLoader.MSSettingUp");
            ResizeArrays();
            RecipeGroupHelper.FixRecipeGroupLookups();

            Interface.loadMods.SetLoadStage("tModLoader.MSLoading", ModLoader.Mods.Length);
            LoadModContent(mod => {
                mod.SetupContent();
                mod.PostSetupContent();
                mod.File?.UnloadAssets();
            });

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

            Main.player[255] = new Player(false);             // setup inventory is unnecessary

            RefreshModLanguage(Language.ActiveCulture);
            MapLoader.SetupModMap();
            ItemSorting.SetupWhiteLists();
            PlayerInput.ReInitialize();
            SetupRecipes();
        }
Example #5
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();
        }
Example #6
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;
            }
        }
Example #7
0
        internal static void SortList(MenuDisplay menu, ListDisplay list)
        {
            ItemSorting sortingMethod = new ItemSorting();


            ItemSorting orderMethod = new ItemSorting();
            bool        valid       = false;

            while (valid == false)
            {
                menu.ActionInstructionsClear();
                menu.ActionPrompt.Clear();
                for (int i = 0; i < MenuDisplay.itemSortingList.Count() - 1 /*Not counting Descending*/; ++i)
                {
                    menu.ActionPrompt.Add($"{menu.SortOptions(MenuDisplay.itemSortingList[i])}  Sort by {MenuDisplay.itemSortingList[i]}");
                }
                menu.ActionPrompt.Add($" ");
                menu.ActionPrompt.Add($"Your Choice: ");
                menu.ActionInstructions(menu.ActionPrompt);

                string stringInput = Console.ReadKey().KeyChar.ToString().ToUpper();
                sortingMethod = menu.SortOptions(stringInput, out bool validSort);

                valid = validSort;
            }
            menu.StatusUpdate();

            valid = false;
            while (valid == false)
            {
                menu.ActionInstructionsClear();
                menu.ActionPrompt.Clear();
                menu.ActionPrompt.Add($"Sort by {sortingMethod.ToString()}:");
                menu.ActionPrompt.Add($" ");
                menu.ActionPrompt.Add($"A  Sort Ascending");
                menu.ActionPrompt.Add($"D  Sort Descending");
                menu.ActionPrompt.Add($" ");
                menu.ActionPrompt.Add($"Your Choice: ");
                menu.ActionInstructions(menu.ActionPrompt);

                string stringInput = Console.ReadKey().KeyChar.ToString().ToUpper();
                orderMethod = menu.OrderOptions(stringInput, sortingMethod, out bool validOrder);
                valid       = validOrder;
            }
            menu.StatusUpdate();

            ItemsList.ItemSorter sorter = new ItemsList.ItemSorter(orderMethod);
            ItemsList.UserShoppingList.Sort(sorter);

            menu.ActionInstructionsClear();
            menu.ActionPrompt.Clear();
            ItemsList.CurrentSorting = sortingMethod;
            list.DisplayCurrentList(ItemsList.UserShoppingList);
            menu.StatusUpdate($"Sorting changed to {sortingMethod.ToString()}, {ListDisplay.Order}", MenuDisplay.ActionStatus.ActionSuccess);
        }
Example #8
0
        public string OrderOptions(string command, ItemSorting sorting /*, MenuDisplay menu, List list*/)
        {
            string option = "";

            switch (command)
            {
            case "A": option = "ascending"; break;

            case "D": option = "descending"; break;
            }
            return(option);
        }
Example #9
0
        internal static void Load(CancellationToken token)
        {
            CacheVanillaState();

            Interface.loadMods.SetLoadStage("tModLoader.MSIntializing", ModLoader.Mods.Length);
            LoadModContent(token, mod => {
                ContentInstance.Register(mod);
                mod.loading = true;
                mod.AutoloadConfig();
                mod.PrepareAssets();
                mod.Autoload();
                mod.Load();
                SystemHooks.OnModLoad(mod);
                mod.loading = false;
            });

            Interface.loadMods.SetLoadStage("tModLoader.MSSettingUp");
            ResizeArrays();
            RecipeGroupHelper.FixRecipeGroupLookups();

            Interface.loadMods.SetLoadStage("tModLoader.MSLoading", ModLoader.Mods.Length);
            LoadModContent(token, mod => {
                mod.SetupContent();
                mod.PostSetupContent();
                SystemHooks.PostSetupContent(mod);
            });

            MemoryTracking.Finish();

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

            Main.player[255] = new Player(false);             // setup inventory is unnecessary

            RefreshModLanguage(Language.ActiveCulture);
            MapLoader.SetupModMap();
            RarityLoader.Initialize();

            ContentSamples.Initialize();
            PlayerInput.reinitialize = true;
            SetupBestiary(token);
            SetupRecipes(token);
            ContentSamples.RebuildItemCreativeSortingIDsAfterRecipesAreSetUp();
            ItemSorting.SetupWhiteLists();

            MenuLoader.GotoSavedModMenu();
            BossBarLoader.GotoSavedStyle();
        }
Example #10
0
        public override void OnInitialize()
        {
            var header = new UIText("Sorting Options");

            header.Top.Set(Main.instance.invBottom, 0);
            header.Left.Set(506 + 130, 0); // magic number because vanilla does it the same way lmao
            Append(header);

            list = new UIList();
            list.Top.Set(Main.instance.invBottom + 30, 0);
            list.Left.Set(506 + 130, 0);
            list.Width.Set(400, 0);
            list.Height.Set(400, 0);
            list.ListPadding = 14;
            list.SetPadding(2);
            Append(list);

            AddSortOption("Default sort", (evt, elm) => ItemSorting.SortChest());
            AddSortOption("Sort by ID", (evt, elm) => NewItemSorting.Sort(x => x.type, _reversed));
            AddSortOption("Sort Alphabetically", (evt, elm) => NewItemSorting.Sort(x => x.Name, _reversed));
            AddSortOption("Sort by rarity", (evt, elm) => NewItemSorting.Sort(x => x.rare, !_reversed));
            AddSortOption("Sort by stack size", (evt, elm) => NewItemSorting.Sort(x => x.stack, !_reversed));
            AddSortOption("Sort by value", (evt, elm) => NewItemSorting.Sort(x => x.value, !_reversed));
            AddSortOption("Sort by damage", (evt, elm) => NewItemSorting.Sort(x => x.damage, !_reversed));
            AddSortOption("Sort by defense", (evt, elm) => NewItemSorting.Sort(x => x.defense, !_reversed));
            AddSortOption("Sort by Mod", new MouseEvent(ModCarusel));
            AddSortOption("Sort randomly", (evt, elm) => NewItemSorting.Sort(x => Main.rand.NextFloat(), _reversed));

            var option = new UITextOption("Reversed: No");

            option.OnClick += (evt, elm) =>
            {
                _reversed = !_reversed;
                option.SetText(_reversed ? "Reversed: Yes" : "Reversed: No");
            };
            list.Add(option);

            var searchbox = new UIBetterTextBox("search item", Color.White);

            searchbox.Top.Set(Main.instance.invBottom + 170, 0);
            searchbox.Left.Set(71, 0);
            searchbox.Width.Set(209, 0);
            searchbox.Height.Set(30, 0);
            searchbox.OnTextChanged += () => NewItemSorting.Sort(x => x.Name.ToLower().Contains(searchbox.currentString.ToLower()), true);
            Append(searchbox);
        }
Example #11
0
        internal static bool Load()
        {
            try
            {
                Interface.loadMods.SetLoadStage("tModLoader.MSIntializing", ModLoader.Mods.Length);
                LoadModContent(mod => {
                    mod.loading = true;
                    mod.File?.Read(TmodFile.LoadedState.Streaming, mod.LoadResourceFromStream);
                    mod.Autoload();
                    mod.Load();
                    mod.loading = false;
                });

                Interface.loadMods.SetLoadStage("tModLoader.MSSettingUp");
                ResizeArrays();
                RecipeGroupHelper.FixRecipeGroupLookups();

                Interface.loadMods.SetLoadStage("tModLoader.MSLoading", ModLoader.Mods.Length);
                LoadModContent(mod => {
                    mod.SetupContent();
                    mod.PostSetupContent();
                    mod.File?.UnloadAssets();
                });

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

                Main.player[255] = new Player(false);                 // setup inventory is unnecessary

                RefreshModLanguage(Language.ActiveCulture);
                MapLoader.SetupModMap();
                ItemSorting.SetupWhiteLists();
                PlayerInput.ReInitialize();
                SetupRecipes();
                return(true);
            }
            catch (LoadingException e)
            {
                ModLoader.DisableMod(e.mod.Name);
                ErrorLogger.LogLoadingError(e.mod.Name, e.mod.Version, e.InnerException, e is AddRecipesException);
                Main.menuMode = Interface.errorMessageID;
                return(false);
            }
        }
Example #12
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();
        }
Example #13
0
        public string SortOptions(ItemSorting command /*, MenuDisplay menu, List list*/)
        {
            string option = "";

            switch (command)
            {
            case ItemSorting.Name: option = "N"; break;

            case ItemSorting.Category: option = "C"; break;

            case ItemSorting.Priority: option = "P"; break;

            case ItemSorting.DateAdded: option = "D"; break;

            case ItemSorting.DatePurchased: option = "B"; break;
            }
            return(option);
        }
Example #14
0
        internal static void Unload()
        {
            while (loadOrder.Count > 0)
            {
                GetMod(loadOrder.Pop()).UnloadContent();
            }

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

            ItemLoader.Unload();
            EquipLoader.Unload();
            ModDust.Unload();
            TileLoader.Unload();
            WallLoader.Unload();
            ProjectileLoader.Unload();
            NPCLoader.Unload();
            NPCHeadLoader.Unload();
            PlayerHooks.Unload();
            BuffLoader.Unload();
            MountLoader.Unload();
            ModGore.Unload();
            SoundLoader.Unload();
            BackgroundTextureLoader.Unload();
            UgBgStyleLoader.Unload();
            SurfaceBgStyleLoader.Unload();
            GlobalBgStyleLoader.Unload();
            WaterStyleLoader.Unload();
            WaterfallStyleLoader.Unload();
            mods.Clear();
            ResizeArrays(true);
            MapLoader.UnloadModMap();
            ItemSorting.SetupWhiteLists();
            modHotKeys.Clear();
            WorldHooks.Unload();
            RecipeHooks.Unload();

            if (!Main.dedServ && Main.netMode != 1)             //disable vanilla client compatiblity restrictions when reloading on a client
            {
                ModNet.AllowVanillaClients = false;
            }
        }
Example #15
0
        public ItemSorting OrderOptions(string command, ItemSorting sorting, out bool valid)
        {
            valid = true;
            ItemSorting option = new ItemSorting();

            switch (command)
            {
            case "A": option = sorting; ListDisplay.Descending = false; ListDisplay.Order = "Ascending"; break;

            case "D": option = sorting; ListDisplay.Descending = true; ListDisplay.Order = "Descending"; break;

            default:
                option = (sorting);     /*Placeholder because it will not activate*/
                StatusUpdate();
                StatusUpdate($"Please Select one of the options above", ActionStatus.ActionFailure);
                valid = false;
                break;
            }
            return(option);
        }
Example #16
0
        internal static void Load()
        {
            CacheVanillaState();

            Interface.loadMods.SetLoadStage("tModLoader.MSIntializing", ModLoader.Mods.Length);
            MemoryTracking.Start();
            LoadModContent(mod => {
                mod.AutoloadConfig();
                mod.loading = true;
                mod.LoadResources();
                mod.Autoload();
                mod.Load();
                mod.loading = false;
                MemoryTracking.Load(mod);
            });

            Interface.loadMods.SetLoadStage("tModLoader.MSSettingUp");
            ResizeArrays();
            RecipeGroupHelper.FixRecipeGroupLookups();

            MemoryTracking.MidReset();
            Interface.loadMods.SetLoadStage("tModLoader.MSLoading", ModLoader.Mods.Length);
            LoadModContent(mod => {
                mod.SetupContent();
                mod.PostSetupContent();
                MemoryTracking.Finish(mod);
            });

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

            Main.player[255] = new Player(false);             // setup inventory is unnecessary

            RefreshModLanguage(Language.ActiveCulture);
            MapLoader.SetupModMap();
            ItemSorting.SetupWhiteLists();
            PlayerInput.ReInitialize();
            SetupRecipes();
        }
Example #17
0
//Sorting Logic
        public string GetField(ItemSorting sorting)
        {
            return(GetField(sorting, out bool notUsed));
        }
Example #18
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();
        }
Example #19
0
 public ItemSorter(ItemSorting sorting)
 {
     Descending = sorting.HasFlag(ItemSorting.Descending);
     Sorting    = sorting & ~ItemSorting.Descending;
 }
Example #20
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();
        }