public override void Load() { Instance = this; if (!Main.dedServ) { AddTexture("MysteryItem", ReadTexture("MysteryItem")); AddTexture("StartBag", ReadTexture("StartBag")); AddTexture("MysteryTile", ReadTexture("MysteryTile")); } AddItem("MysteryItem", new MysteryItem()); AddGlobalItem("MysteryGlobalItem", new MysteryGlobalItem()); AddItem("StartBag", new StartBag()); AddItem("AprilFools", new AprilFools()); AddTile("MysteryTile", new MysteryTile(), "ModLoader/MysteryTile"); AddTile("PendingMysteryTile", new MysteryTile(), "ModLoader/MysteryTile"); AddTileEntity("MysteryTileEntity", new MysteryTileEntity()); AddPlayer("MysteryPlayer", new MysteryPlayer()); AddModWorld("MysteryWorld", new MysteryWorld()); AddModWorld("MysteryTilesWorld", new MysteryTilesWorld()); AddCommand("HelpCommand", new HelpCommand()); AddCommand("ModlistCommand", new ModlistCommand()); AddPatronSets(); AddPlayer("PatronModPlayer", new PatronModPlayer()); AddDeveloperSets(); AddPlayer("DeveloperPlayer", new DeveloperPlayer()); }
public override void Load() { Instance = this; /*if (!Main.dedServ) { * AddTexture("UnloadedItem", ReadTexture("UnloadedItem")); * AddTexture("StartBag", ReadTexture("StartBag")); * AddTexture("UnloadedTile", ReadTexture("UnloadedTile")); * }*/ AddContent <UnloadedItem>(); AddContent <UnloadedGlobalItem>(); AddContent <StartBag>(); AddContent <AprilFools>(); AddContent(new UnloadedTile()); AddContent(new UnloadedTile("PendingUnloadedTile")); AddContent <UnloadedTileEntity>(); AddContent <UnloadedPlayer>(); AddContent <UnloadedWorld>(); AddContent <UnloadedTilesWorld>(); AddContent <HelpCommand>(); AddContent <ModlistCommand>(); /*AddPatronSets(); * AddPlayer("PatronModPlayer", new PatronModPlayer()); * AddDeveloperSets(); * AddPlayer("DeveloperPlayer", new DeveloperPlayer());*/ }
private static bool LoadMods() { Interface.loadMods.SetProgressFinding(); TmodFile[] modFiles = FindMods(); List<TmodFile> enabledMods = new List<TmodFile>(); foreach (TmodFile modFile in modFiles) { if (IsEnabled(modFile.Name)) { enabledMods.Add(modFile); } } IDictionary<string, BuildProperties> properties = new Dictionary<string, BuildProperties>(); List<TmodFile> modsToLoad = new List<TmodFile>(); foreach (TmodFile modFile in enabledMods) { properties[modFile.Name] = BuildProperties.ReadModFile(modFile); modsToLoad.Add(modFile); } int previousCount = 0; int num = 0; Mod defaultMod = new ModLoaderMod(); defaultMod.Init(); mods[defaultMod.Name] = defaultMod; loadedMods.Add(defaultMod.Name); while (modsToLoad.Count > 0 && modsToLoad.Count != previousCount) { previousCount = modsToLoad.Count; int k = 0; while (k < modsToLoad.Count) { bool canLoad = true; foreach (string reference in properties[modsToLoad[k].Name].modReferences) { if (!ModLoaded(ModPath + Path.DirectorySeparatorChar + reference + ".tmod")) { canLoad = false; break; } } if (canLoad) { Interface.loadMods.SetProgressCompatibility(Path.GetFileNameWithoutExtension(modsToLoad[k].Name), num, enabledMods.Count); try { LoadMod(modsToLoad[k], properties[modsToLoad[k].Name]); } catch (Exception e) { DisableMod(modsToLoad[k].Name); ErrorLogger.LogLoadingError(modsToLoad[k].Name, properties[modsToLoad[k].Name].modBuildVersion, e); return false; } loadedMods.Add(modsToLoad[k].Name); num++; modsToLoad.RemoveAt(k); } else { k++; } } } if (modsToLoad.Count > 0) { foreach (TmodFile modFile in modsToLoad) { DisableMod(modFile.Name); } ErrorLogger.LogMissingLoadReference(modsToLoad); return false; } return true; }