Commit 4a9abacab556cd0a2d68720d3c9ef23e401621d3

Authored by Mumfrey
1 parent a15b480a

add things to the disabled mod list on error, so that utterly broken mods show u…

…p when a notification does
java/client/com/mumfrey/liteloader/client/gui/GuiPanelMods.java
@@ -103,7 +103,7 @@ public class GuiPanelMods extends GuiPanel @@ -103,7 +103,7 @@ public class GuiPanelMods extends GuiPanel
103 } 103 }
104 104
105 // Disabled mods 105 // Disabled mods
106 - for (ModInfo<Loadable<?>> disabledMod : mods.getDisabledMods()) 106 + for (ModInfo<?> disabledMod : mods.getDisabledMods())
107 { 107 {
108 GuiModListEntry modListEntry = new GuiModListEntry(mods, environment, this.mc.fontRendererObj, this.brandColour, decorators, disabledMod); 108 GuiModListEntry modListEntry = new GuiModListEntry(mods, environment, this.mc.fontRendererObj, this.brandColour, decorators, disabledMod);
109 sortedMods.put(modListEntry.getKey(), modListEntry); 109 sortedMods.put(modListEntry.getKey(), modListEntry);
java/common/com/mumfrey/liteloader/core/LiteLoader.java
@@ -620,7 +620,7 @@ public final class LiteLoader @@ -620,7 +620,7 @@ public final class LiteLoader
620 { 620 {
621 List<Loadable<?>> disabledMods = new ArrayList<Loadable<?>>(); 621 List<Loadable<?>> disabledMods = new ArrayList<Loadable<?>>();
622 622
623 - for (ModInfo<Loadable<?>> disabledMod : this.mods.getDisabledMods()) 623 + for (ModInfo<?> disabledMod : this.mods.getDisabledMods())
624 { 624 {
625 disabledMods.add(disabledMod.getContainer()); 625 disabledMods.add(disabledMod.getContainer());
626 } 626 }
java/common/com/mumfrey/liteloader/core/LiteLoaderMods.java
1 package com.mumfrey.liteloader.core; 1 package com.mumfrey.liteloader.core;
2 2
3 import java.io.File; 3 import java.io.File;
4 -import java.util.Collection;  
5 import java.util.Collections; 4 import java.util.Collections;
6 import java.util.HashMap; 5 import java.util.HashMap;
7 import java.util.LinkedList; 6 import java.util.LinkedList;
@@ -16,9 +15,9 @@ import net.minecraft.client.resources.IResourcePack; @@ -16,9 +15,9 @@ import net.minecraft.client.resources.IResourcePack;
16 import com.mumfrey.liteloader.LiteMod; 15 import com.mumfrey.liteloader.LiteMod;
17 import com.mumfrey.liteloader.api.ModLoadObserver; 16 import com.mumfrey.liteloader.api.ModLoadObserver;
18 import com.mumfrey.liteloader.common.LoadingProgress; 17 import com.mumfrey.liteloader.common.LoadingProgress;
19 -import com.mumfrey.liteloader.interfaces.LoaderEnumerator;  
20 import com.mumfrey.liteloader.interfaces.Loadable; 18 import com.mumfrey.liteloader.interfaces.Loadable;
21 import com.mumfrey.liteloader.interfaces.LoadableMod; 19 import com.mumfrey.liteloader.interfaces.LoadableMod;
  20 +import com.mumfrey.liteloader.interfaces.LoaderEnumerator;
22 import com.mumfrey.liteloader.interfaces.TweakContainer; 21 import com.mumfrey.liteloader.interfaces.TweakContainer;
23 import com.mumfrey.liteloader.launch.ClassTransformerManager; 22 import com.mumfrey.liteloader.launch.ClassTransformerManager;
24 import com.mumfrey.liteloader.launch.LiteLoaderTweaker; 23 import com.mumfrey.liteloader.launch.LiteLoaderTweaker;
@@ -90,7 +89,7 @@ public class LiteLoaderMods @@ -90,7 +89,7 @@ public class LiteLoaderMods
90 /** 89 /**
91 * Mods which are loaded but disabled 90 * Mods which are loaded but disabled
92 */ 91 */
93 - protected final LinkedList<NonMod> disabledMods = new LinkedList<NonMod>(); 92 + protected final LinkedList<ModInfo<?>> disabledMods = new LinkedList<ModInfo<?>>();
94 93
95 private int startupErrorCount, criticalErrorCount; 94 private int startupErrorCount, criticalErrorCount;
96 95
@@ -103,11 +102,10 @@ public class LiteLoaderMods @@ -103,11 +102,10 @@ public class LiteLoaderMods
103 this.configManager = configManager; 102 this.configManager = configManager;
104 } 103 }
105 104
106 - @SuppressWarnings("unchecked")  
107 void init(List<ModLoadObserver> observers) 105 void init(List<ModLoadObserver> observers)
108 { 106 {
109 this.observers = observers; 107 this.observers = observers;
110 - this.disabledMods.addAll((Collection<? extends NonMod>)this.enumerator.getDisabledContainers()); 108 + this.disabledMods.addAll(this.enumerator.getDisabledContainers());
111 } 109 }
112 110
113 void onPostInit() 111 void onPostInit()
@@ -148,7 +146,7 @@ public class LiteLoaderMods @@ -148,7 +146,7 @@ public class LiteLoaderMods
148 /** 146 /**
149 * Get a list containing all mod files which were NOT loaded 147 * Get a list containing all mod files which were NOT loaded
150 */ 148 */
151 - public List<? extends ModInfo<Loadable<?>>> getDisabledMods() 149 + public List<? extends ModInfo<?>> getDisabledMods()
152 { 150 {
153 return this.disabledMods; 151 return this.disabledMods;
154 } 152 }
@@ -446,6 +444,7 @@ public class LiteLoaderMods @@ -446,6 +444,7 @@ public class LiteLoaderMods
446 catch (Throwable th) 444 catch (Throwable th)
447 { 445 {
448 this.onModLoadFailed(container, mod.getModClassName(), "an error occurred", th); 446 this.onModLoadFailed(container, mod.getModClassName(), "an error occurred", th);
  447 + this.registerModStartupError(mod, th);
449 } 448 }
450 } 449 }
451 } 450 }
@@ -522,7 +521,13 @@ public class LiteLoaderMods @@ -522,7 +521,13 @@ public class LiteLoaderMods
522 { 521 {
523 LiteLoaderLogger.warning("Not loading mod %s, %s", identifier, reason); 522 LiteLoaderLogger.warning("Not loading mod %s, %s", identifier, reason);
524 523
525 - if (container != LoadableMod.NONE && !this.disabledMods.contains(container)) 524 + for (ModInfo<?> mod : this.disabledMods)
  525 + {
  526 + if (mod.getContainer().equals(container))
  527 + return;
  528 + }
  529 +
  530 + if (container != LoadableMod.NONE)
526 { 531 {
527 this.disabledMods.add(new NonMod(container, false)); 532 this.disabledMods.add(new NonMod(container, false));
528 } 533 }
@@ -762,6 +767,11 @@ public class LiteLoaderMods @@ -762,6 +767,11 @@ public class LiteLoaderMods
762 this.startupErrorCount++; 767 this.startupErrorCount++;
763 if (critical) this.criticalErrorCount++; 768 if (critical) this.criticalErrorCount++;
764 mod.registerStartupError(th); 769 mod.registerStartupError(th);
  770 +
  771 + if (!this.loadedMods.contains(mod) && !this.disabledMods.contains(mod))
  772 + {
  773 + this.disabledMods.add(mod);
  774 + }
765 } 775 }
766 776
767 void updateSharedModList() 777 void updateSharedModList()