示例#1
0
  @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) {

    }
  }
示例#2
0
  public static void create() {

    boolean register = false;

    if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
      register = hasOptifine = FMLClientHandler.instance().hasOptifine();
    }

    for (ModContainer modContainer : ModAPIManager.INSTANCE.getAPIList()) {
      if ("appliedenergistics2|API".equals(modContainer.getModId())) {
        if ("rv1".equals(modContainer.getVersion())) {
          hasOldAE2 = modContainer.getVersion() + " from " + modContainer.getSource().getName();
          register = true;
        } else if (!"rv2".equals(modContainer.getVersion())) {
          hasUnknownAE2 = modContainer.getVersion() + " from " + modContainer.getSource().getName();
          register = true;
        }
      } else if ("CoFHAPI|energy".equals(modContainer.getModId())) {
        if ("1.7.10R1.0.0".equals(modContainer.getVersion())
            || "1.7.10R1.0.1".equals(modContainer.getVersion())) {
          hasOldRF = modContainer.getVersion() + " from " + modContainer.getSource().getName();
          register = true;
        }
      }
    }

    if (register) {
      FMLCommonHandler.instance().registerCrashCallable(new EnderIOCrashCallable());
    }
  }
示例#3
0
  public static boolean hasMod(String modid, String version) {
    for (int i = 0; i < Loader.instance().getActiveModList().size(); i++) {
      ModContainer mod = Loader.instance().getActiveModList().get(i);

      if ((mod.getModId() + mod.getVersion().replaceFirst("v", "")).matches(modid + version)) {
        return true;
      }
    }

    return false;
  }
  @Override

  /** Adds the buttons (and other controls) to the screen in question. */
  public void initGui() {
    for (ModContainer mod : mods) {
      listWidth = Math.max(listWidth, getFontRenderer().getStringWidth(mod.getName()) + 10);
      listWidth = Math.max(listWidth, getFontRenderer().getStringWidth(mod.getVersion()) + 10);
    }
    listWidth = Math.min(listWidth, 150);
    StringTranslate translations = StringTranslate.getInstance();
    this.controlList.add(
        new GuiSmallButton(
            6, this.width / 2 - 75, this.height - 38, translations.translateKey("gui.done")));
    this.modList = new GuiSlotModList(this, mods, listWidth);
    this.modList.registerScrollButtons(this.controlList, 7, 8);
  }
示例#5
0
  /**
   * This packet is executed on the client to evaluate the server's mod list against the client
   *
   * @see cpw.mods.fml.common.network.FMLPacket#execute(INetworkManager, FMLNetworkHandler,
   *     NetHandler, String)
   */
  @Override
  public void execute(
      INetworkManager mgr, FMLNetworkHandler handler, NetHandler netHandler, String userName) {
    List<String> missingMods = Lists.newArrayList();
    Map<String, String> modVersions = Maps.newHashMap();
    Map<String, ModContainer> indexedModList =
        Maps.newHashMap(Loader.instance().getIndexedModList());

    for (String m : sentModList) {
      ModContainer mc = indexedModList.get(m);
      if (mc == null) {
        missingMods.add(m);
        continue;
      }
      indexedModList.remove(m);
      modVersions.put(m, mc.getVersion());
    }

    if (indexedModList.size() > 0) {
      for (Entry<String, ModContainer> e : indexedModList.entrySet()) {
        if (e.getValue().isNetworkMod()) {
          NetworkModHandler missingHandler =
              FMLNetworkHandler.instance().findNetworkModHandler(e.getValue());
          if (missingHandler.requiresServerSide()) {
            // TODO : what should we do if a mod is marked "serverSideRequired"? Stop the
            // connection?
            FMLLog.warning(
                "The mod %s was not found on the server you connected to, but requested that the server side be present",
                e.getKey());
          }
        }
      }
    }

    FMLLog.fine("The server has compatibility level %d", compatibilityLevel);
    FMLCommonHandler.instance().getSidedDelegate().setClientCompatibilityLevel(compatibilityLevel);

    mgr.func_74429_a(
        PacketDispatcher.getPacket(
            "FML", FMLPacket.makePacket(MOD_LIST_RESPONSE, modVersions, missingMods)));
  }
 public boolean isSkinCompatibleVersion() {
   if (isModLoaded()) {
     ModContainer mc = Loader.instance().getIndexedModList().get(getModId());
     if (mc != null) {
       String version = mc.getVersion();
       String[] versionSplit = version.split("\\.");
       try {
         int majorVersion = Integer.parseInt(versionSplit[0]);
         if (majorVersion > 6) {
           ModLogger.log("BuildCraft robot skin support active.");
           return true;
         } else {
           ModLogger.log("BuildCraft is out of date. Unable to active robot skin support.");
         }
       } catch (Exception e) {
         return false;
       }
     }
   }
   return false;
 }
  @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_);
  }