Commit aa7b247d5d477fff050079a9c612fe338fe6054b

Authored by Mumfrey
1 parent 180c08e5

Fix display bug with errored mods, add copy error to clipboard button

src/client/java/com/mumfrey/liteloader/client/gui/GuiPanelError.java
@@ -12,10 +12,12 @@ import java.util.List; @@ -12,10 +12,12 @@ import java.util.List;
12 12
13 import org.lwjgl.input.Keyboard; 13 import org.lwjgl.input.Keyboard;
14 14
  15 +import com.google.common.base.Joiner;
15 import com.mumfrey.liteloader.core.ModInfo; 16 import com.mumfrey.liteloader.core.ModInfo;
16 17
17 import net.minecraft.client.Minecraft; 18 import net.minecraft.client.Minecraft;
18 import net.minecraft.client.gui.GuiButton; 19 import net.minecraft.client.gui.GuiButton;
  20 +import net.minecraft.client.gui.GuiScreen;
19 import net.minecraft.client.resources.I18n; 21 import net.minecraft.client.resources.I18n;
20 22
21 public class GuiPanelError extends GuiPanel implements ScrollPanelContent 23 public class GuiPanelError extends GuiPanel implements ScrollPanelContent
@@ -98,6 +100,7 @@ public class GuiPanelError extends GuiPanel implements ScrollPanelContent @@ -98,6 +100,7 @@ public class GuiPanelError extends GuiPanel implements ScrollPanelContent
98 100
99 this.scrollPane.setSizeAndPosition(MARGIN, TOP, this.width - (MARGIN * 2), this.height - TOP - BOTTOM); 101 this.scrollPane.setSizeAndPosition(MARGIN, TOP, this.width - (MARGIN * 2), this.height - TOP - BOTTOM);
100 this.controls.add(new GuiButton(0, this.width - 59 - MARGIN, this.height - BOTTOM + 9, 60, 20, I18n.format("gui.done"))); 102 this.controls.add(new GuiButton(0, this.width - 59 - MARGIN, this.height - BOTTOM + 9, 60, 20, I18n.format("gui.done")));
  103 + this.controls.add(new GuiButton(1, this.width - 204 - MARGIN, this.height - BOTTOM + 9, 140, 20, I18n.format("gui.error.copytoclipboard")));
101 } 104 }
102 105
103 @Override 106 @Override
@@ -131,7 +134,10 @@ public class GuiPanelError extends GuiPanel implements ScrollPanelContent @@ -131,7 +134,10 @@ public class GuiPanelError extends GuiPanel implements ScrollPanelContent
131 @Override 134 @Override
132 void keyPressed(char keyChar, int keyCode) 135 void keyPressed(char keyChar, int keyCode)
133 { 136 {
134 - if (keyCode == Keyboard.KEY_ESCAPE) this.close(); 137 + if (keyCode == Keyboard.KEY_ESCAPE)
  138 + {
  139 + this.close();
  140 + }
135 } 141 }
136 142
137 @Override 143 @Override
@@ -161,6 +167,14 @@ public class GuiPanelError extends GuiPanel implements ScrollPanelContent @@ -161,6 +167,14 @@ public class GuiPanelError extends GuiPanel implements ScrollPanelContent
161 @Override 167 @Override
162 void actionPerformed(GuiButton control) 168 void actionPerformed(GuiButton control)
163 { 169 {
164 - if (control.id == 0) this.close(); 170 + if (control.id == 0)
  171 + {
  172 + this.close();
  173 + }
  174 +
  175 + if (control.id == 1)
  176 + {
  177 + GuiScreen.setClipboardString(Joiner.on('\n').join(this.scrollPaneContent));
  178 + }
165 } 179 }
166 } 180 }
src/client/java/com/mumfrey/liteloader/client/gui/modlist/ModList.java
@@ -76,7 +76,7 @@ public class ModList @@ -76,7 +76,7 @@ public class ModList
76 // Disabled mods 76 // Disabled mods
77 for (ModInfo<?> disabledMod : mods.getDisabledMods()) 77 for (ModInfo<?> disabledMod : mods.getDisabledMods())
78 { 78 {
79 - if (environment.getEnabledModsList().getEnabled(environment.getProfile(), disabledMod.getIdentifier()) == Enabled.DISABLED) 79 + if (environment.getEnabledModsList().getEnabled(environment.getProfile(), disabledMod.getIdentifier()) != Enabled.FILTERED)
80 { 80 {
81 ModListEntry modListEntry = new ModListEntry(this, mods, environment, minecraft.fontRendererObj, brandColour, decorators, disabledMod); 81 ModListEntry modListEntry = new ModListEntry(this, mods, environment, minecraft.fontRendererObj, brandColour, decorators, disabledMod);
82 sortedMods.put(modListEntry.getKey(), modListEntry); 82 sortedMods.put(modListEntry.getKey(), modListEntry);
src/main/java/com/mumfrey/liteloader/modconfig/ConfigManager.java
@@ -17,6 +17,7 @@ import com.google.common.collect.Maps; @@ -17,6 +17,7 @@ import com.google.common.collect.Maps;
17 import com.google.common.io.Files; 17 import com.google.common.io.Files;
18 import com.mumfrey.liteloader.Configurable; 18 import com.mumfrey.liteloader.Configurable;
19 import com.mumfrey.liteloader.LiteMod; 19 import com.mumfrey.liteloader.LiteMod;
  20 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
20 21
21 /** 22 /**
22 * Registry where we keep the mod config panel classes and config file writers 23 * Registry where we keep the mod config panel classes and config file writers
@@ -165,6 +166,10 @@ public class ConfigManager @@ -165,6 +166,10 @@ public class ConfigManager
165 } 166 }
166 catch (InstantiationException ex) {} 167 catch (InstantiationException ex) {}
167 catch (IllegalAccessException ex) {} 168 catch (IllegalAccessException ex) {}
  169 + catch (Exception ex)
  170 + {
  171 + LiteLoaderLogger.severe("Error creating mod configuration panel <%s> for mod %s", this.configPanels.get(modClass), modClass);
  172 + }
168 173
169 // If instantiation fails, remove the panel 174 // If instantiation fails, remove the panel
170 this.configPanels.remove(modClass); 175 this.configPanels.remove(modClass);
src/main/resources/assets/liteloader/lang/en_us.lang
@@ -86,6 +86,7 @@ gui.log.uploadsuccess=Upload succeeded, log available at @@ -86,6 +86,7 @@ gui.log.uploadsuccess=Upload succeeded, log available at
86 gui.log.closedialog=Close 86 gui.log.closedialog=Close
87 87
88 gui.error.title=Startup errors for %s 88 gui.error.title=Startup errors for %s
  89 +gui.error.copytoclipboard=Copy error to clipboard
89 90
90 gui.error.tooltip=%d mod startup error(s) detected (%d critical) 91 gui.error.tooltip=%d mod startup error(s) detected (%d critical)
91 92