Commit f6840e83820b5829e1f920c7e5d31588dc09d715

Authored by Mumfrey
1 parent 303ac2af

move mod info panel to separate class

java/client/com/mumfrey/liteloader/client/gui/GuiModInfoPanel.java 0 → 100644
  1 +package com.mumfrey.liteloader.client.gui;
  2 +
  3 +import static com.mumfrey.liteloader.client.util.GLClippingPlanes.*;
  4 +import net.minecraft.client.gui.FontRenderer;
  5 +import net.minecraft.client.gui.Gui;
  6 +import net.minecraft.client.resources.I18n;
  7 +
  8 +import com.google.common.base.Strings;
  9 +import com.mumfrey.liteloader.core.ModInfo;
  10 +
  11 +public class GuiModInfoPanel extends Gui
  12 +{
  13 + private static final int TITLE_COLOUR = GuiModListEntry.WHITE;
  14 + private static final int AUTHORS_COLOUR = GuiModListEntry.WHITE;
  15 + private static final int DIVIDER_COLOUR = GuiModListEntry.GREY;
  16 + private static final int DESCRIPTION_COLOUR = GuiModListEntry.WHITE;
  17 +
  18 + private final FontRenderer fontRenderer;
  19 +
  20 + private final int brandColour;
  21 +
  22 + private final ModInfo<?> modInfo;
  23 +
  24 + private GuiSimpleScrollBar scrollBar = new GuiSimpleScrollBar();
  25 +
  26 + private boolean mouseOverPanel, mouseOverScrollBar;
  27 +
  28 + public GuiModInfoPanel(FontRenderer fontRenderer, int brandColour, ModInfo<?> modInfo)
  29 + {
  30 + this.fontRenderer = fontRenderer;
  31 + this.brandColour = brandColour;
  32 + this.modInfo = modInfo;
  33 + }
  34 +
  35 + public void draw(int mouseX, int mouseY, float partialTicks, int xPosition, int yPosition, int width, int height)
  36 + {
  37 + int bottom = height + yPosition;
  38 + int yPos = yPosition + 2;
  39 +
  40 + this.mouseOverPanel = this.isMouseOver(mouseX, mouseY, xPosition, yPos, width, height);
  41 +
  42 + this.fontRenderer.drawString(this.modInfo.getDisplayName(), xPosition + 5, yPos, GuiModInfoPanel.TITLE_COLOUR); yPos += 10;
  43 + this.fontRenderer.drawString(I18n.format("gui.about.versiontext", this.modInfo.getVersion()), xPosition + 5, yPos, GuiModListEntry.VERSION_TEXT_COLOUR); yPos += 10;
  44 +
  45 + drawRect(xPosition + 5, yPos, xPosition + width, yPos + 1, GuiModInfoPanel.DIVIDER_COLOUR); yPos += 4; // divider
  46 +
  47 + this.fontRenderer.drawString(I18n.format("gui.about.authors") + ": \2477" + this.modInfo.getAuthor(), xPosition + 5, yPos, GuiModInfoPanel.AUTHORS_COLOUR); yPos += 10;
  48 + if (!Strings.isNullOrEmpty(this.modInfo.getURL()))
  49 + {
  50 + this.fontRenderer.drawString(this.modInfo.getURL(), xPosition + 5, yPos, GuiModListEntry.BLEND_2THRDS & this.brandColour); yPos += 10;
  51 + }
  52 +
  53 + drawRect(xPosition + 5, yPos, xPosition + width, yPos + 1, GuiModInfoPanel.DIVIDER_COLOUR); yPos += 4; // divider
  54 + drawRect(xPosition + 5, bottom - 1, xPosition + width, bottom, GuiModInfoPanel.DIVIDER_COLOUR); // divider
  55 +
  56 + int scrollHeight = bottom - yPos - 3;
  57 + int totalHeight = this.fontRenderer.splitStringWidth(this.modInfo.getDescription(), width - 11);
  58 +
  59 + this.scrollBar.setMaxValue(totalHeight - scrollHeight);
  60 + this.scrollBar.drawScrollBar(mouseX, mouseY, partialTicks, xPosition + width - 5, yPos, 5, scrollHeight, totalHeight);
  61 +
  62 + this.mouseOverScrollBar = this.isMouseOver(mouseX, mouseY, xPosition + width - 5, yPos, 5, scrollHeight);
  63 +
  64 + glEnableClipping(-1, -1, yPos, bottom - 3);
  65 + this.fontRenderer.drawSplitString(this.modInfo.getDescription(), xPosition + 5, yPos - this.scrollBar.getValue(), width - 11, GuiModInfoPanel.DESCRIPTION_COLOUR);
  66 + }
  67 +
  68 + private boolean isMouseOver(int mouseX, int mouseY, int x, int y, int width, int height)
  69 + {
  70 + return mouseX > x && mouseX < x + width && mouseY > y && mouseY < y + height;
  71 + }
  72 +
  73 + public void mousePressed()
  74 + {
  75 + if (this.mouseOverScrollBar)
  76 + {
  77 + this.scrollBar.setDragging(true);
  78 + }
  79 + }
  80 +
  81 + public void mouseReleased()
  82 + {
  83 + this.scrollBar.setDragging(false);
  84 + }
  85 +
  86 + public boolean mouseWheelScrolled(int mouseWheelDelta)
  87 + {
  88 + if (this.mouseOverPanel)
  89 + {
  90 + this.scrollBar.offsetValue(-mouseWheelDelta / 8);
  91 + return true;
  92 + }
  93 +
  94 + return false;
  95 + }
  96 +}
java/client/com/mumfrey/liteloader/client/gui/GuiModListEntry.java
@@ -12,7 +12,6 @@ import net.minecraft.client.gui.FontRenderer; @@ -12,7 +12,6 @@ import net.minecraft.client.gui.FontRenderer;
12 import net.minecraft.client.gui.Gui; 12 import net.minecraft.client.gui.Gui;
13 import net.minecraft.client.resources.I18n; 13 import net.minecraft.client.resources.I18n;
14 14
15 -import com.google.common.base.Strings;  
16 import com.mumfrey.liteloader.LiteMod; 15 import com.mumfrey.liteloader.LiteMod;
17 import com.mumfrey.liteloader.api.ModInfoDecorator; 16 import com.mumfrey.liteloader.api.ModInfoDecorator;
18 import com.mumfrey.liteloader.core.LiteLoaderMods; 17 import com.mumfrey.liteloader.core.LiteLoaderMods;
@@ -31,37 +30,33 @@ import com.mumfrey.liteloader.util.render.IconTextured; @@ -31,37 +30,33 @@ import com.mumfrey.liteloader.util.render.IconTextured;
31 */ 30 */
32 public class GuiModListEntry extends Gui 31 public class GuiModListEntry extends Gui
33 { 32 {
34 - private static final int BLACK = 0xFF000000;  
35 - private static final int DARK_GREY = 0xB0333333;  
36 - private static final int GREY = 0xFF999999;  
37 - private static final int WHITE = 0xFFFFFFFF; 33 + static final int BLACK = 0xFF000000;
  34 + static final int DARK_GREY = 0xB0333333;
  35 + static final int GREY = 0xFF999999;
  36 + static final int WHITE = 0xFFFFFFFF;
38 37
39 - private static final int BLEND_2THRDS = 0xB0FFFFFF;  
40 - private static final int BLEND_HALF = 0x80FFFFFF; 38 + static final int BLEND_2THRDS = 0xB0FFFFFF;
  39 + static final int BLEND_HALF = 0x80FFFFFF;
41 40
42 - private static final int API_COLOUR = 0xFFAA00AA;  
43 - private static final int EXTERNAL_ENTRY_COLOUR = 0xFF47D1AA;  
44 - private static final int MISSING_DEPENDENCY_COLOUR = 0xFFFFAA00;  
45 - private static final int ERROR_COLOUR = 0xFFFF5555;  
46 - private static final int ERROR_GRADIENT_COLOUR = 0xFFAA0000;  
47 - private static final int ERROR_GRADIENT_COLOUR2 = 0xFF550000; 41 + static final int API_COLOUR = 0xFFAA00AA;
  42 + static final int EXTERNAL_ENTRY_COLOUR = 0xFF47D1AA;
  43 + static final int MISSING_DEPENDENCY_COLOUR = 0xFFFFAA00;
  44 + static final int ERROR_COLOUR = 0xFFFF5555;
  45 + static final int ERROR_GRADIENT_COLOUR = 0xFFAA0000;
  46 + static final int ERROR_GRADIENT_COLOUR2 = 0xFF550000;
48 47
49 - private static final int TITLE_COLOUR = GuiModListEntry.WHITE;  
50 - private static final int VERSION_TEXT_COLOUR = GuiModListEntry.GREY;  
51 - private static final int GRADIENT_COLOUR2 = GuiModListEntry.BLEND_2THRDS & GuiModListEntry.DARK_GREY;  
52 - private static final int HANGER_COLOUR = GuiModListEntry.GREY;  
53 - private static final int HANGER_COLOUR_MOUSEOVER = GuiModListEntry.WHITE;  
54 - private static final int AUTHORS_COLOUR = GuiModListEntry.WHITE;  
55 - private static final int DIVIDER_COLOUR = GuiModListEntry.GREY;  
56 - private static final int DESCRIPTION_COLOUR = GuiModListEntry.WHITE; 48 + static final int VERSION_TEXT_COLOUR = GuiModListEntry.GREY;
  49 + static final int GRADIENT_COLOUR2 = GuiModListEntry.BLEND_2THRDS & GuiModListEntry.DARK_GREY;
  50 + static final int HANGER_COLOUR = GuiModListEntry.GREY;
  51 + static final int HANGER_COLOUR_MOUSEOVER = GuiModListEntry.WHITE;
57 52
58 - private static final int PANEL_HEIGHT = 32;  
59 - private static final int PANEL_SPACING = 4; 53 + static final int PANEL_HEIGHT = 32;
  54 + static final int PANEL_SPACING = 4;
60 55
61 /** 56 /**
62 * For text display 57 * For text display
63 */ 58 */
64 - private FontRenderer fontRenderer; 59 + private final FontRenderer fontRenderer;
65 60
66 private final int brandColour; 61 private final int brandColour;
67 62
@@ -69,42 +64,14 @@ public class GuiModListEntry extends Gui @@ -69,42 +64,14 @@ public class GuiModListEntry extends Gui
69 64
70 private final LiteLoaderMods mods; 65 private final LiteLoaderMods mods;
71 66
72 - private ModInfo<?> modInfo; 67 + private final ModInfo<?> modInfo;
73 68
74 - /**  
75 - * The identifier of the mod, used as the enablement/disablement key  
76 - */  
77 - private String identifier;  
78 -  
79 - /**  
80 - * Display name of the mod, disabled mods use the file/folder name  
81 - */  
82 - private String name;  
83 -  
84 - /**  
85 - * Mod version string  
86 - */  
87 - private String version;  
88 -  
89 - /**  
90 - * Mod author, from the metadata  
91 - */  
92 - private String author = I18n.format("gui.unknown");  
93 -  
94 - /**  
95 - * Mod URL, from the metadata  
96 - */  
97 - private String url = null;  
98 -  
99 - /**  
100 - * Mod description, from metadata  
101 - */  
102 - private String description = ""; 69 + private final GuiModInfoPanel infoPanel;
103 70
104 /** 71 /**
105 * Whether the mod is currently active 72 * Whether the mod is currently active
106 */ 73 */
107 - private boolean enabled; 74 + private boolean isActive;
108 75
109 private boolean isMissingDependencies; 76 private boolean isMissingDependencies;
110 77
@@ -136,7 +103,7 @@ public class GuiModListEntry extends Gui @@ -136,7 +103,7 @@ public class GuiModListEntry extends Gui
136 /** 103 /**
137 * True if the mouse was over this mod on the last render 104 * True if the mouse was over this mod on the last render
138 */ 105 */
139 - private boolean mouseOverListEntry, mouseOverInfo, mouseOverScrollBar; 106 + private boolean mouseOver;
140 107
141 private IconClickable mouseOverIcon = null; 108 private IconClickable mouseOverIcon = null;
142 109
@@ -146,11 +113,6 @@ public class GuiModListEntry extends Gui @@ -146,11 +113,6 @@ public class GuiModListEntry extends Gui
146 private boolean external; 113 private boolean external;
147 114
148 private List<IconTextured> modIcons = new ArrayList<IconTextured>(); 115 private List<IconTextured> modIcons = new ArrayList<IconTextured>();
149 -  
150 - /**  
151 - * Scroll bar control for the mod info  
152 - */  
153 - private GuiSimpleScrollBar scrollBar = new GuiSimpleScrollBar();  
154 116
155 /** 117 /**
156 * Mod list entry for an ACTIVE mod 118 * Mod list entry for an ACTIVE mod
@@ -166,21 +128,17 @@ public class GuiModListEntry extends Gui @@ -166,21 +128,17 @@ public class GuiModListEntry extends Gui
166 this.decorators = decorators; 128 this.decorators = decorators;
167 this.modInfo = modInfo; 129 this.modInfo = modInfo;
168 130
169 - this.identifier = modInfo.getIdentifier();  
170 - this.name = modInfo.getDisplayName();  
171 - this.version = modInfo.getVersion();  
172 - this.author = modInfo.getAuthor();  
173 - this.enabled = modInfo.isActive(); 131 + this.infoPanel = new GuiModInfoPanel(fontRenderer, brandColour, modInfo);
  132 +
  133 + this.isActive = modInfo.isActive();
174 this.canBeToggled = modInfo.isToggleable() && mods.getEnabledModsList().saveAllowed(); 134 this.canBeToggled = modInfo.isToggleable() && mods.getEnabledModsList().saveAllowed();
175 - this.willBeEnabled = mods.isModEnabled(this.identifier);; 135 + this.willBeEnabled = mods.isModEnabled(this.modInfo.getIdentifier());;
176 this.external = modInfo.getContainer().isExternalJar(); 136 this.external = modInfo.getContainer().isExternalJar();
177 - this.description = modInfo.getDescription();  
178 - this.url = modInfo.getURL();  
179 this.isErrored = modInfo.getStartupErrors() != null && modInfo.getStartupErrors().size() > 0; 137 this.isErrored = modInfo.getStartupErrors() != null && modInfo.getStartupErrors().size() > 0;
180 138
181 if (!modInfo.isActive()) 139 if (!modInfo.isActive())
182 { 140 {
183 - this.enabled = modInfo.getContainer().isEnabled(environment); 141 + this.isActive = modInfo.getContainer().isEnabled(environment);
184 142
185 Loadable<?> modContainer = modInfo.getContainer(); 143 Loadable<?> modContainer = modInfo.getContainer();
186 if (modContainer instanceof LoadableMod<?>) 144 if (modContainer instanceof LoadableMod<?>)
@@ -212,7 +170,7 @@ public class GuiModListEntry extends Gui @@ -212,7 +170,7 @@ public class GuiModListEntry extends Gui
212 * @param selected 170 * @param selected
213 * @return 171 * @return
214 */ 172 */
215 - public int drawListEntry(int mouseX, int mouseY, float partialTicks, int xPosition, int yPosition, int width, boolean selected) 173 + public int draw(int mouseX, int mouseY, float partialTicks, int xPosition, int yPosition, int width, boolean selected)
216 { 174 {
217 int gradientColour = this.getGradientColour(selected); 175 int gradientColour = this.getGradientColour(selected);
218 int titleColour = this.getTitleColour(selected); 176 int titleColour = this.getTitleColour(selected);
@@ -220,8 +178,8 @@ public class GuiModListEntry extends Gui @@ -220,8 +178,8 @@ public class GuiModListEntry extends Gui
220 178
221 this.drawGradientRect(xPosition, yPosition, xPosition + width, yPosition + GuiModListEntry.PANEL_HEIGHT, gradientColour, GuiModListEntry.GRADIENT_COLOUR2); 179 this.drawGradientRect(xPosition, yPosition, xPosition + width, yPosition + GuiModListEntry.PANEL_HEIGHT, gradientColour, GuiModListEntry.GRADIENT_COLOUR2);
222 180
223 - String titleText = this.getTitleText();  
224 - String versionText = this.getVersionText(); 181 + String titleText = this.modInfo.getDisplayName();
  182 + String versionText = I18n.format("gui.about.versiontext", this.modInfo.getVersion());
225 String statusText = this.getStatusText(); 183 String statusText = this.getStatusText();
226 184
227 for (ModInfoDecorator decorator : this.decorators) 185 for (ModInfoDecorator decorator : this.decorators)
@@ -234,8 +192,9 @@ public class GuiModListEntry extends Gui @@ -234,8 +192,9 @@ public class GuiModListEntry extends Gui
234 this.fontRenderer.drawString(versionText, xPosition + 5, yPosition + 12, GuiModListEntry.VERSION_TEXT_COLOUR); 192 this.fontRenderer.drawString(versionText, xPosition + 5, yPosition + 12, GuiModListEntry.VERSION_TEXT_COLOUR);
235 this.fontRenderer.drawString(statusText, xPosition + 5, yPosition + 22, statusColour); 193 this.fontRenderer.drawString(statusText, xPosition + 5, yPosition + 22, statusColour);
236 194
237 - this.mouseOverListEntry = this.isMouseOver(mouseX, mouseY, xPosition, yPosition, width, PANEL_HEIGHT);  
238 - drawRect(xPosition, yPosition, xPosition + 1, yPosition + PANEL_HEIGHT, this.mouseOverListEntry ? GuiModListEntry.HANGER_COLOUR_MOUSEOVER : GuiModListEntry.HANGER_COLOUR); 195 + this.mouseOver = this.isMouseOver(mouseX, mouseY, xPosition, yPosition, width, PANEL_HEIGHT);
  196 + int hangerColour = this.mouseOver ? GuiModListEntry.HANGER_COLOUR_MOUSEOVER : GuiModListEntry.HANGER_COLOUR;
  197 + drawRect(xPosition, yPosition, xPosition + 1, yPosition + PANEL_HEIGHT, hangerColour);
239 198
240 for (ModInfoDecorator decorator : this.decorators) 199 for (ModInfoDecorator decorator : this.decorators)
241 { 200 {
@@ -286,65 +245,6 @@ public class GuiModListEntry extends Gui @@ -286,65 +245,6 @@ public class GuiModListEntry extends Gui
286 } 245 }
287 246
288 /** 247 /**
289 - * Draw this entry as the info page  
290 - *  
291 - * @param mouseX  
292 - * @param mouseY  
293 - * @param partialTicks  
294 - * @param xPosition  
295 - * @param yPosition  
296 - * @param width  
297 - */  
298 - public void drawInfo(final int mouseX, final int mouseY, final float partialTicks, final int xPosition, final int yPosition, final int width, final int height)  
299 - {  
300 - int bottom = height + yPosition;  
301 - int yPos = yPosition + 2;  
302 -  
303 - this.mouseOverInfo = this.isMouseOver(mouseX, mouseY, xPosition, yPos, width, height);  
304 -  
305 - this.fontRenderer.drawString(this.getTitleText(), xPosition + 5, yPos, GuiModListEntry.TITLE_COLOUR); yPos += 10;  
306 - this.fontRenderer.drawString(this.getVersionText(), xPosition + 5, yPos, GuiModListEntry.VERSION_TEXT_COLOUR); yPos += 10;  
307 -  
308 - drawRect(xPosition + 5, yPos, xPosition + width, yPos + 1, GuiModListEntry.DIVIDER_COLOUR); yPos += 4; // divider  
309 -  
310 - this.fontRenderer.drawString(I18n.format("gui.about.authors") + ": \2477" + this.author, xPosition + 5, yPos, GuiModListEntry.AUTHORS_COLOUR); yPos += 10;  
311 - if (!Strings.isNullOrEmpty(this.url))  
312 - {  
313 - this.fontRenderer.drawString(this.url, xPosition + 5, yPos, GuiModListEntry.BLEND_2THRDS & this.brandColour); yPos += 10;  
314 - }  
315 -  
316 - drawRect(xPosition + 5, yPos, xPosition + width, yPos + 1, GuiModListEntry.DIVIDER_COLOUR); yPos += 4; // divider  
317 - drawRect(xPosition + 5, bottom - 1, xPosition + width, bottom, GuiModListEntry.DIVIDER_COLOUR); // divider  
318 -  
319 - int scrollHeight = bottom - yPos - 3;  
320 - int totalHeight = this.fontRenderer.splitStringWidth(this.description, width - 11);  
321 -  
322 - this.scrollBar.setMaxValue(totalHeight - scrollHeight);  
323 - this.scrollBar.drawScrollBar(mouseX, mouseY, partialTicks, xPosition + width - 5, yPos, 5, scrollHeight, totalHeight);  
324 -  
325 - this.mouseOverScrollBar = this.isMouseOver(mouseX, mouseY, xPosition + width - 5, yPos, 5, scrollHeight);  
326 -  
327 - glEnableClipping(-1, -1, yPos, bottom - 3);  
328 - this.fontRenderer.drawSplitString(this.description, xPosition + 5, yPos - this.scrollBar.getValue(), width - 11, GuiModListEntry.DESCRIPTION_COLOUR);  
329 - }  
330 -  
331 - /**  
332 - * @return  
333 - */  
334 - protected String getTitleText()  
335 - {  
336 - return this.name;  
337 - }  
338 -  
339 - /**  
340 - * @return  
341 - */  
342 - protected String getVersionText()  
343 - {  
344 - return I18n.format("gui.about.versiontext", this.version);  
345 - }  
346 -  
347 - /**  
348 * @return 248 * @return
349 */ 249 */
350 protected String getStatusText() 250 protected String getStatusText()
@@ -367,9 +267,9 @@ public class GuiModListEntry extends Gui @@ -367,9 +267,9 @@ public class GuiModListEntry extends Gui
367 } 267 }
368 else if (this.canBeToggled) 268 else if (this.canBeToggled)
369 { 269 {
370 - if (!this.enabled && !this.willBeEnabled) statusText = "\2477" + I18n.format("gui.status.disabled");  
371 - if (!this.enabled && this.willBeEnabled) statusText = "\247a" + I18n.format("gui.status.pending.enabled");  
372 - if ( this.enabled && !this.willBeEnabled) statusText = "\247c" + I18n.format("gui.status.pending.disabled"); 270 + if (!this.isActive && !this.willBeEnabled) statusText = "\2477" + I18n.format("gui.status.disabled");
  271 + if (!this.isActive && this.willBeEnabled) statusText = "\247a" + I18n.format("gui.status.pending.enabled");
  272 + if ( this.isActive && !this.willBeEnabled) statusText = "\247c" + I18n.format("gui.status.pending.disabled");
373 } 273 }
374 274
375 return statusText; 275 return statusText;
@@ -397,7 +297,7 @@ public class GuiModListEntry extends Gui @@ -397,7 +297,7 @@ public class GuiModListEntry extends Gui
397 if (this.isMissingDependencies) return GuiModListEntry.MISSING_DEPENDENCY_COLOUR; 297 if (this.isMissingDependencies) return GuiModListEntry.MISSING_DEPENDENCY_COLOUR;
398 if (this.isMissingAPIs) return GuiModListEntry.API_COLOUR; 298 if (this.isMissingAPIs) return GuiModListEntry.API_COLOUR;
399 if (this.isErrored) return GuiModListEntry.ERROR_COLOUR; 299 if (this.isErrored) return GuiModListEntry.ERROR_COLOUR;
400 - if (!this.enabled) return GuiModListEntry.GREY; 300 + if (!this.isActive) return GuiModListEntry.GREY;
401 return this.external ? GuiModListEntry.EXTERNAL_ENTRY_COLOUR : GuiModListEntry.WHITE; 301 return this.external ? GuiModListEntry.EXTERNAL_ENTRY_COLOUR : GuiModListEntry.WHITE;
402 } 302 }
403 303
@@ -430,19 +330,6 @@ public class GuiModListEntry extends Gui @@ -430,19 +330,6 @@ public class GuiModListEntry extends Gui
430 return mouseX > x && mouseX < x + width && mouseY > y && mouseY < y + height; 330 return mouseX > x && mouseX < x + width && mouseY > y && mouseY < y + height;
431 } 331 }
432 332
433 - public void mousePressed()  
434 - {  
435 - if (this.mouseOverScrollBar)  
436 - {  
437 - this.scrollBar.setDragging(true);  
438 - }  
439 - }  
440 -  
441 - public void mouseReleased()  
442 - {  
443 - this.scrollBar.setDragging(false);  
444 - }  
445 -  
446 /** 333 /**
447 * Toggle the enablement status of this mod, if supported 334 * Toggle the enablement status of this mod, if supported
448 */ 335 */
@@ -451,13 +338,13 @@ public class GuiModListEntry extends Gui @@ -451,13 +338,13 @@ public class GuiModListEntry extends Gui
451 if (this.canBeToggled) 338 if (this.canBeToggled)
452 { 339 {
453 this.willBeEnabled = !this.willBeEnabled; 340 this.willBeEnabled = !this.willBeEnabled;
454 - this.mods.setModEnabled(this.identifier, this.willBeEnabled); 341 + this.mods.setModEnabled(this.modInfo.getIdentifier(), this.willBeEnabled);
455 } 342 }
456 } 343 }
457 344
458 public String getKey() 345 public String getKey()
459 { 346 {
460 - return (this.isErrored ? "0000" : "") + this.identifier + Integer.toHexString(this.hashCode()); 347 + return (this.isErrored ? "0000" : "") + this.modInfo.getIdentifier() + Integer.toHexString(this.hashCode());
461 } 348 }
462 349
463 public LiteMod getModInstance() 350 public LiteMod getModInstance()
@@ -472,27 +359,27 @@ public class GuiModListEntry extends Gui @@ -472,27 +359,27 @@ public class GuiModListEntry extends Gui
472 359
473 public String getName() 360 public String getName()
474 { 361 {
475 - return getTitleText(); 362 + return this.modInfo.getDisplayName();
476 } 363 }
477 364
478 public String getVersion() 365 public String getVersion()
479 { 366 {
480 - return this.version; 367 + return this.modInfo.getVersion();
481 } 368 }
482 369
483 public String getAuthor() 370 public String getAuthor()
484 { 371 {
485 - return this.author; 372 + return this.modInfo.getAuthor();
486 } 373 }
487 374
488 public String getDescription() 375 public String getDescription()
489 { 376 {
490 - return this.description; 377 + return this.modInfo.getDescription();
491 } 378 }
492 379
493 public boolean isEnabled() 380 public boolean isEnabled()
494 { 381 {
495 - return this.enabled; 382 + return this.isActive;
496 } 383 }
497 384
498 public boolean canBeToggled() 385 public boolean canBeToggled()
@@ -507,12 +394,12 @@ public class GuiModListEntry extends Gui @@ -507,12 +394,12 @@ public class GuiModListEntry extends Gui
507 394
508 public boolean isMouseOverIcon() 395 public boolean isMouseOverIcon()
509 { 396 {
510 - return this.mouseOverListEntry && this.mouseOverIcon != null; 397 + return this.mouseOver && this.mouseOverIcon != null;
511 } 398 }
512 399
513 public boolean isMouseOver() 400 public boolean isMouseOver()
514 { 401 {
515 - return this.mouseOverListEntry; 402 + return this.mouseOver;
516 } 403 }
517 404
518 public void iconClick(Object source) 405 public void iconClick(Object source)
@@ -522,15 +409,9 @@ public class GuiModListEntry extends Gui @@ -522,15 +409,9 @@ public class GuiModListEntry extends Gui
522 this.mouseOverIcon.onClicked(source, this); 409 this.mouseOverIcon.onClicked(source, this);
523 } 410 }
524 } 411 }
525 -  
526 - public boolean mouseWheelScrolled(int mouseWheelDelta) 412 +
  413 + public GuiModInfoPanel getInfoPanel()
527 { 414 {
528 - if (this.mouseOverInfo)  
529 - {  
530 - this.scrollBar.offsetValue(-mouseWheelDelta / 8);  
531 - return true;  
532 - }  
533 -  
534 - return false; 415 + return this.infoPanel;
535 } 416 }
536 } 417 }
java/client/com/mumfrey/liteloader/client/gui/GuiPanelMods.java
@@ -201,7 +201,7 @@ public class GuiPanelMods extends GuiPanel @@ -201,7 +201,7 @@ public class GuiPanelMods extends GuiPanel
201 201
202 if (this.selectedMod != null && this.selectedMod == lastSelectedMod) 202 if (this.selectedMod != null && this.selectedMod == lastSelectedMod)
203 { 203 {
204 - this.selectedMod.mousePressed(); 204 + this.selectedMod.getInfoPanel().mousePressed();
205 } 205 }
206 } 206 }
207 } 207 }
@@ -257,7 +257,7 @@ public class GuiPanelMods extends GuiPanel @@ -257,7 +257,7 @@ public class GuiPanelMods extends GuiPanel
257 257
258 if (this.selectedMod != null) 258 if (this.selectedMod != null)
259 { 259 {
260 - this.selectedMod.mouseReleased(); 260 + this.selectedMod.getInfoPanel().mouseReleased();
261 } 261 }
262 } 262 }
263 } 263 }
@@ -265,7 +265,7 @@ public class GuiPanelMods extends GuiPanel @@ -265,7 +265,7 @@ public class GuiPanelMods extends GuiPanel
265 @Override 265 @Override
266 void mouseWheelScrolled(int mouseWheelDelta) 266 void mouseWheelScrolled(int mouseWheelDelta)
267 { 267 {
268 - if (this.selectedMod == null || !this.selectedMod.mouseWheelScrolled(mouseWheelDelta)) 268 + if (this.selectedMod == null || !this.selectedMod.getInfoPanel().mouseWheelScrolled(mouseWheelDelta))
269 { 269 {
270 this.scrollBar.offsetValue(-mouseWheelDelta / 8); 270 this.scrollBar.offsetValue(-mouseWheelDelta / 8);
271 } 271 }
@@ -329,7 +329,7 @@ public class GuiPanelMods extends GuiPanel @@ -329,7 +329,7 @@ public class GuiPanelMods extends GuiPanel
329 for (GuiModListEntry mod : this.mods) 329 for (GuiModListEntry mod : this.mods)
330 { 330 {
331 // drawListEntry returns a value indicating the height of the item drawn 331 // drawListEntry returns a value indicating the height of the item drawn
332 - yPos += mod.drawListEntry(mouseX, mouseY, partialTicks, MARGIN, yPos, width - 6, mod == this.selectedMod); 332 + yPos += mod.draw(mouseX, mouseY, partialTicks, MARGIN, yPos, width - 6, mod == this.selectedMod);
333 } 333 }
334 334
335 yPos = 0; 335 yPos = 0;
@@ -361,7 +361,7 @@ public class GuiPanelMods extends GuiPanel @@ -361,7 +361,7 @@ public class GuiPanelMods extends GuiPanel
361 361
362 int spaceForButtons = this.btnConfig.visible || this.btnToggle.visible ? 28 : 0; 362 int spaceForButtons = this.btnConfig.visible || this.btnToggle.visible ? 28 : 0;
363 glEnableClipping(left, right, GuiLiteLoaderPanel.PANEL_TOP, this.height - GuiLiteLoaderPanel.PANEL_BOTTOM - spaceForButtons); 363 glEnableClipping(left, right, GuiLiteLoaderPanel.PANEL_TOP, this.height - GuiLiteLoaderPanel.PANEL_BOTTOM - spaceForButtons);
364 - this.selectedMod.drawInfo(mouseX, mouseY, partialTicks, left, GuiLiteLoaderPanel.PANEL_TOP, right - left, height - spaceForButtons); 364 + this.selectedMod.getInfoPanel().draw(mouseX, mouseY, partialTicks, left, GuiLiteLoaderPanel.PANEL_TOP, right - left, height - spaceForButtons);
365 glDisableClipping(); 365 glDisableClipping();
366 } 366 }
367 } 367 }
@@ -374,7 +374,7 @@ public class GuiPanelMods extends GuiPanel @@ -374,7 +374,7 @@ public class GuiPanelMods extends GuiPanel
374 { 374 {
375 if (this.selectedMod != null) 375 if (this.selectedMod != null)
376 { 376 {
377 - this.selectedMod.mouseReleased(); 377 + this.selectedMod.getInfoPanel().mouseReleased();
378 } 378 }
379 379
380 this.selectedMod = mod; 380 this.selectedMod = mod;