@SubscribeEvent public void onCrashReportEvent(CrashReportEvent event) { if (!diagnostics) return; if (event.getHeader().length() > 0) { return; } Throwable t = event.getThrowable(); if (t instanceof LoaderException || t instanceof InvocationTargetException || t instanceof ReportedException) { t = t.getCause(); } if (t == null) { return; } try { event.setHeader(handleThrowable(t)); } catch (Throwable t2) { // Ignore any errors. We don't want to f**k up the crash reports. } List<ModContainer> mods = Utils.getModsFromStackTrace(event.getThrowable().getStackTrace()); Set<ModContainer> s = Sets.newHashSet(); ModContainer active = Loader.instance().activeModContainer(); if (!mods.isEmpty() || (active != null && !active.getModId().equals("SquidAPI"))) { CrashReportCategory c = event.createCategory("Possibly involved mods"); if (active != null && !active.getModId().equals("SquidAPI")) c.addCrashSection( active.getName(), String.format( "Version: %s. Main class: %s. Source: %s. Url: %s. Checksum: %s.", active.getVersion(), active.getMod().getClass().getName(), active.getSource().getName(), active.getMetadata().url, getChecksum(active.getSource()))); for (ModContainer mod : mods) { if (!s.contains(mod)) { c.addCrashSection( mod.getName(), String.format( "Version: %s. Main class: %s. Source: %s. Url: %s. Checksum: %s.", mod.getVersion(), mod.getMod().getClass().getName(), mod.getSource().getName(), mod.getMetadata().url, getChecksum(mod.getSource()))); s.add(mod); } } } try { if (Utils.isCoolSquid()) { event.setHeader("DRM!!! IT'S DRMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM!!!!!!!!!"); } } catch (Throwable t2) { } }
/** @param guiMainMenu */ public GuiModList(GuiScreen mainMenu) { this.mainMenu = mainMenu; this.mods = new ArrayList<ModContainer>(); FMLClientHandler.instance().addSpecialModEntries(mods); for (ModContainer mod : Loader.instance().getModList()) { if (mod.getMetadata() != null && mod.getMetadata().parentMod != null) { continue; } mods.add(mod); } }
@Override public void applyModContainer(ModContainer activeContainer) { this.modContainer = activeContainer; this.modMetadata = activeContainer.getMetadata(); this.sourceFile = activeContainer.getSource(); this.suggestedConfigFile = new File(configurationDir, activeContainer.getModId() + ".cfg"); }
@Override public BufferedImage getPackImage() throws IOException { return ImageIO.read(getInputStreamByName(container.getMetadata().logoFile)); }
@Override /** Draws the screen and all the components in it. */ public void drawScreen(int p_571_1_, int p_571_2_, float p_571_3_) { this.modList.drawScreen(p_571_1_, p_571_2_, p_571_3_); this.drawCenteredString(this.fontRenderer, "Mod List", this.width / 2, 16, 0xFFFFFF); int offset = this.listWidth + 20; if (selectedMod != null) { GL11.glEnable(GL11.GL_BLEND); if (!selectedMod.getMetadata().autogenerated) { int shifty = 35; if (!selectedMod.getMetadata().logoFile.isEmpty()) { int texture = this.mc.renderEngine.getTexture(selectedMod.getMetadata().logoFile); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.renderEngine.bindTexture(texture); Dimension dim = TextureFXManager.instance().getTextureDimensions(texture); int top = 32; Tessellator tess = Tessellator.instance; tess.startDrawingQuads(); tess.addVertexWithUV(offset, top + dim.height, zLevel, 0, 1); tess.addVertexWithUV(offset + dim.width, top + dim.height, zLevel, 1, 1); tess.addVertexWithUV(offset + dim.width, top, zLevel, 1, 0); tess.addVertexWithUV(offset, top, zLevel, 0, 0); tess.draw(); shifty += 65; } this.fontRenderer.drawStringWithShadow( selectedMod.getMetadata().name, offset, shifty, 0xFFFFFF); shifty += 12; shifty = drawLine( String.format( "Version: %s (%s)", selectedMod.getMetadata().version, selectedMod.getVersion()), offset, shifty); shifty = drawLine( String.format("Mod State: %s", Loader.instance().getModState(selectedMod)), offset, shifty); if (!selectedMod.getMetadata().credits.isEmpty()) { shifty = drawLine( String.format("Credits: %s", selectedMod.getMetadata().credits), offset, shifty); } shifty = drawLine( String.format("Authors: %s", selectedMod.getMetadata().getAuthorList()), offset, shifty); shifty = drawLine(String.format("URL: %s", selectedMod.getMetadata().url), offset, shifty); shifty = drawLine( selectedMod.getMetadata().childMods.isEmpty() ? "No child mods for this mod" : String.format("Child mods: %s", selectedMod.getMetadata().getChildModList()), offset, shifty); this.getFontRenderer() .drawSplitString( selectedMod.getMetadata().description, offset, shifty + 10, this.width - offset - 20, 0xDDDDDD); } else { offset = (this.listWidth + this.width) / 2; this.drawCenteredString(this.fontRenderer, selectedMod.getName(), offset, 35, 0xFFFFFF); this.drawCenteredString( this.fontRenderer, String.format("Version: %s", selectedMod.getVersion()), offset, 45, 0xFFFFFF); this.drawCenteredString( this.fontRenderer, String.format("Mod State: %s", Loader.instance().getModState(selectedMod)), offset, 55, 0xFFFFFF); this.drawCenteredString( this.fontRenderer, "No mod information found", offset, 65, 0xDDDDDD); this.drawCenteredString( this.fontRenderer, "Ask your mod author to provide a mod mcmod.info file", offset, 75, 0xDDDDDD); } GL11.glDisable(GL11.GL_BLEND); } super.drawScreen(p_571_1_, p_571_2_, p_571_3_); }