Ejemplo n.º 1
0
 @Override
 public void addModAsResource(ModContainer container) {
   Class<?> resourcePackType = container.getCustomResourcePackClass();
   if (resourcePackType != null) {
     try {
       ResourcePack pack =
           (ResourcePack)
               resourcePackType.getConstructor(ModContainer.class).newInstance(container);
       resourcePackList.add(pack);
       resourcePackMap.put(container.getModId(), pack);
     } catch (NoSuchMethodException e) {
       FMLLog.log(
           Level.SEVERE,
           "The container %s (type %s) returned an invalid class for it's resource pack.",
           container.getName(),
           container.getClass().getName());
       return;
     } catch (Exception e) {
       FMLLog.log(
           Level.SEVERE,
           e,
           "An unexpected exception occurred constructing the custom resource pack for %s",
           container.getName());
       throw Throwables.propagate(e);
     }
   }
 }
Ejemplo n.º 2
0
  public ClassMeta getClassInfo(Class<?> cls) {
    final Package pkg = cls.getPackage();

    URL loadedFrom = null;

    try {
      loadedFrom = cls.getProtectionDomain().getCodeSource().getLocation();
    } catch (Throwable t) {
      Log.warn(t, "Failed to get source for %s", cls);
    }

    final API apiAnnotation = pkg.getAnnotation(API.class);
    final ApiInfo apiInfo = apiAnnotation != null ? new ApiInfo(apiAnnotation) : null;

    Map<File, Set<String>> mods = Maps.newHashMap();
    for (ModCandidate candidate : table.getCandidatesFor(pkg.getName())) {
      if (!candidate.getClassList().contains(cls.getName().replace('.', '/'))) continue;

      final File candidateFile = candidate.getModContainer();

      Set<String> modIds = Sets.newHashSet();
      mods.put(candidateFile, modIds);
      for (ModContainer mod : candidate.getContainedMods()) modIds.add(mod.getModId());
    }

    return new ClassMeta(cls, loadedFrom, apiInfo, mods);
  }
 @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");
 }
Ejemplo n.º 4
0
 private void doModEntityRegistration(Class<? extends Entity> entityClass, String entityName, int id, Object mod, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates)
 {
     ModContainer mc = FMLCommonHandler.instance().findContainerFor(mod);
     EntityRegistration er = new EntityRegistration(mc, entityClass, entityName, id, trackingRange, updateFrequency, sendsVelocityUpdates);
     try
     {
         entityClassRegistrations.put(entityClass, er);
         entityNames.put(entityName, mc);
         if (!EntityList.classToStringMapping.containsKey(entityClass))
         {
             String entityModName = String.format("%s.%s", mc.getModId(), entityName);
             EntityList.classToStringMapping.put(entityClass, entityModName);
             EntityList.stringToClassMapping.put(entityModName, entityClass);
             FMLLog.finest("Automatically registered mod %s entity %s as %s", mc.getModId(), entityName, entityModName);
         }
         else
         {
             FMLLog.fine("Skipping automatic mod %s entity registration for already registered class %s", mc.getModId(), entityClass.getName());
         }
     }
     catch (IllegalArgumentException e)
     {
         FMLLog.log(Level.WARNING, e, "The mod %s tried to register the entity (name,class) (%s,%s) one or both of which are already registered", mc.getModId(), entityName, entityClass.getName());
         return;
     }
     entityRegistrations.put(mc, er);
 }
Ejemplo n.º 5
0
 @Override
 public byte[] generatePacket(Object... data) {
   ByteArrayDataOutput dat = ByteStreams.newDataOutput();
   Set<ModContainer> activeMods = FMLNetworkHandler.instance().getNetworkModList();
   dat.writeInt(activeMods.size());
   for (ModContainer mc : activeMods) {
     dat.writeUTF(mc.getModId());
   }
   dat.writeByte(FMLNetworkHandler.getCompatibilityLevel());
   return dat.toByteArray();
 }
 /** @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);
   }
 }
Ejemplo n.º 7
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;
  }
Ejemplo n.º 8
0
  @Override
  public void addRecyclingRecipe(ItemStack recycledItem, String... blacklist) {

    bufferedRecyclingItems.add(recycledItem);
    if (blacklist.length > 0) {
      ModContainer mc = Loader.instance().activeModContainer();
      BluePower.log.info(
          (mc != null ? mc.getName() : "Unknown mod")
              + " added to the Alloy Furnace recycling blacklist: "
              + Arrays.toString(blacklist));
      Collections.addAll(this.blacklist, blacklist);
    }
  }
Ejemplo n.º 9
0
 public ItemData(Item item, ModContainer mc) {
   this.itemId = item.id;
   if (item.getClass().equals(ItemBlock.class)) {
     this.itemType = Block.byId[this.itemId].getClass().getName();
   } else {
     this.itemType = item.getClass().getName();
   }
   this.modId = mc.getModId();
   if (!modOrdinals.containsKey(mc.getModId())) {
     modOrdinals.put(mc.getModId(), HashMultiset.<String>create());
   }
   this.ordinal = modOrdinals.get(mc.getModId()).add(itemType, 1);
 }
Ejemplo n.º 10
0
 public void registerGuiHandler(Object mod, IGuiHandler handler) {
   ModContainer mc = FMLCommonHandler.instance().findContainerFor(mod);
   NetworkModHandler nmh = FMLNetworkHandler.instance().findNetworkModHandler(mc);
   if (nmh == null) {
     FMLLog.log(
         Level.FINE,
         "The mod %s needs to be a @NetworkMod to register a Networked Gui Handler",
         mc.getModId());
   } else {
     serverGuiHandlers.put(mc, handler);
   }
   clientGuiHandlers.put(mc, handler);
 }
  @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);
  }
Ejemplo n.º 12
0
 @PreInit
 public void preInit(FMLPreInitializationEvent event) {
   Configuration config = new Configuration(event.getSuggestedConfigurationFile());
   config.load();
   this.allowOps = config.get("Settings", "allowOps", true).getBoolean(true);
   this.createUsersRecords = config.get("Settings", "createUsersRecords", false).getBoolean(false);
   this.debug = config.get("Settings", "debug", false).getBoolean(false);
   config.save();
   this.permController = new PermissionsController();
   this.permHandler = new PermissionInvocationHandler();
   ArrayList<String> set = new ArrayList();
   for (ModContainer mod : Loader.instance().getActiveModList()) {
     if (!set.contains(mod.getSource().getAbsolutePath()))
       set.add(mod.getSource().getAbsolutePath());
   }
   for (String path : set) checkLoadedModForPermissionClass(new File(path));
 }
Ejemplo n.º 13
0
	@EventHandler
	public void load(FMLInitializationEvent evt)
	{
		if (!Loader.isModLoaded("Railcraft"))
		{
			return;
		}
		try
		{
			String id = Block.blockRegistry.getNameForObject(MineFactoryReloadedCore.factoryDecorativeStoneBlock);
			FMLInterModComms.sendMessage("Railcraft", "balast", String.format("%s@%s", id, 8));
			FMLInterModComms.sendMessage("Railcraft", "balast", String.format("%s@%s", id, 9));
			// white sand? black sand?

			Object rockCrusher = Class.forName("mods.railcraft.api.crafting.RailcraftCraftingManager").getField("rockCrusher").get(null);
			Method createNewRecipe = Class.forName("mods.railcraft.api.crafting.IRockCrusherCraftingManager").getMethod("createNewRecipe", ItemStack.class, boolean.class, boolean.class);
			Method addOutput = Class.forName("mods.railcraft.api.crafting.IRockCrusherRecipe").getMethod("addOutput", ItemStack.class, float.class);

			Object recipe = createNewRecipe.invoke(rockCrusher, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 10), true, false);
			addOutput.invoke(recipe, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 2), 1.0f); // Paved Blackstone -> Cobble 

			recipe = createNewRecipe.invoke(rockCrusher, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 11), true, false);
			addOutput.invoke(recipe, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 3), 1.0f); // Paved Whitestone -> Cobble

			recipe = createNewRecipe.invoke(rockCrusher, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 0), true, false);
			addOutput.invoke(recipe, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 2), 1.0f); // Smooth Blackstone -> Cobble 

			recipe = createNewRecipe.invoke(rockCrusher, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 1), true, false);
			addOutput.invoke(recipe, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 3), 1.0f); // Smooth Whitestone -> Cobble

			recipe = createNewRecipe.invoke(rockCrusher, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 2), true, false);
			addOutput.invoke(recipe, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 8), 1.0f); // Cobble Blackstone -> Gravel + flint
			addOutput.invoke(recipe, new ItemStack(Items.flint, 1, 0), 0.05f);

			recipe = createNewRecipe.invoke(rockCrusher, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 3), true, false);
			addOutput.invoke(recipe, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 9), 1.0f); // Cobble Whitestone -> Gravel + flint
			addOutput.invoke(recipe, new ItemStack(Items.flint, 1, 0), 0.05f);
		}
		catch (Throwable _)
		{
			ModContainer This = FMLCommonHandler.instance().findContainerFor(this);
			FMLLog.log(This.getModId(), Level.WARN, "There was a problem loading %s.", This.getName());
			_.printStackTrace();
		}
	}
Ejemplo n.º 14
0
  /**
   * Prefix the supplied name with the current mod id.
   *
   * <p>If no mod id can be determined, minecraft will be assumed. The prefix is separated with a
   * colon.
   *
   * <p>If there's already a prefix, it'll be prefixed again if the new prefix doesn't match the old
   * prefix, as used by vanilla calls to addObject.
   *
   * @param name name to prefix.
   * @return prefixed name.
   */
  private String addPrefix(String name) {
    int index = name.lastIndexOf(':');
    String oldPrefix = index == -1 ? "" : name.substring(0, index);
    String prefix;
    ModContainer mc = Loader.instance().activeModContainer();

    if (mc != null) {
      prefix = mc.getModId();
    } else // no mod container, assume minecraft
    {
      prefix = "minecraft";
    }

    if (!oldPrefix.equals(prefix)) {
      name = prefix + ":" + name;
    }

    return name;
  }
Ejemplo n.º 15
0
  public static void openConfigScreen() {
    for (ModContainer mod : Loader.instance().getModList()) {
      if (mod.getModId() == null) continue;

      if (mod.getModId().equals(Main.MOD_ID)) {
        try {
          IModGuiFactory guiFactory = FMLClientHandler.instance().getGuiFactoryFor(mod);
          GuiScreen newScreen =
              guiFactory
                  .mainConfigGuiClass()
                  .getConstructor(GuiScreen.class)
                  .newInstance(Main.mc.currentScreen);
          Main.mc.displayGuiScreen(newScreen);
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    }
  }
Ejemplo n.º 16
0
 public void loadLocalization(String localizationFile, String lang, boolean isXML) {
   URL urlResource = this.getClass().getResource(localizationFile);
   if (urlResource != null) {
     loadLocalization(urlResource, lang, isXML);
   } else {
     ModContainer activeModContainer = Loader.instance().activeModContainer();
     if (activeModContainer != null) {
       FMLLog.log(
           activeModContainer.getModId(),
           Level.SEVERE,
           "The language resource %s cannot be located on the classpath. This is a programming error.",
           localizationFile);
     } else {
       FMLLog.log(
           Level.SEVERE,
           "The language resource %s cannot be located on the classpath. This is a programming error.",
           localizationFile);
     }
   }
 }
Ejemplo n.º 17
0
 public static void registerGlobalEntityID(Class <? extends Entity > entityClass, String entityName, int id, int backgroundEggColour, int foregroundEggColour)
 {
     if (EntityList.classToStringMapping.containsKey(entityClass))
     {
         ModContainer activeModContainer = Loader.instance().activeModContainer();
         String modId = "unknown";
         if (activeModContainer != null)
         {
             modId = activeModContainer.getModId();
         }
         else
         {
             FMLLog.severe("There is a rogue mod failing to register entities from outside the context of mod loading. This is incredibly dangerous and should be stopped.");
         }
         FMLLog.warning("The mod %s tried to register the entity class %s which was already registered - if you wish to override default naming for FML mod entities, register it here first", modId, entityClass);
         return;
     }
     instance().validateAndClaimId(id);
     EntityList.addMapping(entityClass, entityName, id, backgroundEggColour, foregroundEggColour);
 }
Ejemplo n.º 18
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
 protected InputStream getInputStreamByName(String resourceName) throws IOException {
   try {
     return super.getInputStreamByName(resourceName);
   } catch (IOException ioe) {
     if ("pack.mcmeta".equals(resourceName)) {
       FMLLog.log(
           container.getName(),
           Level.WARNING,
           "Mod %s is missing a pack.mcmeta file, things may not work well",
           container.getName());
       return new ByteArrayInputStream(
           ("{\n"
                   + " \"pack\": {\n"
                   + "   \"description\": \"dummy FML pack for "
                   + container.getName()
                   + "\",\n"
                   + "   \"pack_format\": 1\n"
                   + "}\n"
                   + "}")
               .getBytes(Charsets.UTF_8));
     } else throw ioe;
   }
 }
 @Override
 public String getPackName() {
   return "FMLFileResourcePack:" + container.getName();
 }
  private void buildGraph(List<ModContainer> modList, Map<String, ModContainer> nameLookup) {
    modGraph = new DirectedGraph<ModContainer>();
    modGraph.addNode(beforeAll);
    modGraph.addNode(before);
    modGraph.addNode(afterAll);
    modGraph.addNode(after);
    modGraph.addEdge(before, after);
    modGraph.addEdge(beforeAll, before);
    modGraph.addEdge(after, afterAll);

    for (ModContainer mod : modList) {
      modGraph.addNode(mod);
    }

    for (ModContainer mod : modList) {
      if (mod.isImmutable()) {
        // Immutable mods are always before everything
        modGraph.addEdge(beforeAll, mod);
        modGraph.addEdge(mod, before);
        continue;
      }
      boolean preDepAdded = false;
      boolean postDepAdded = false;

      for (ArtifactVersion dep : mod.getDependencies()) {
        preDepAdded = true;

        String modid = dep.getLabel();
        if (modid.equals("*")) {
          // We are "after" everything
          modGraph.addEdge(mod, afterAll);
          modGraph.addEdge(after, mod);
          postDepAdded = true;
        } else {
          modGraph.addEdge(before, mod);
          if (nameLookup.containsKey(modid) || Loader.isModLoaded(modid)) {
            modGraph.addEdge(nameLookup.get(modid), mod);
          }
        }
      }

      for (ArtifactVersion dep : mod.getDependants()) {
        postDepAdded = true;

        String modid = dep.getLabel();
        if (modid.equals("*")) {
          // We are "before" everything
          modGraph.addEdge(beforeAll, mod);
          modGraph.addEdge(mod, before);
          preDepAdded = true;
        } else {
          modGraph.addEdge(mod, after);
          if (Loader.isModLoaded(modid)) {
            modGraph.addEdge(mod, nameLookup.get(modid));
          }
        }
      }

      if (!preDepAdded) {
        modGraph.addEdge(before, mod);
      }

      if (!postDepAdded) {
        modGraph.addEdge(mod, after);
      }
    }
  }
  @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_);
  }
 /**
  * Get a logger instance configured to write to the FML Log as a parent, identified by modid.
  * Handy for mod logging! Configurations can be applied through the <code>
  * config/logging.properties</code> file, specifying logging levels for your ModID. Use this!
  *
  * @return A logger
  */
 public Logger getModLog() {
   Logger log = Logger.getLogger(modContainer.getModId());
   log.setParent(FMLLog.getLogger());
   return log;
 }
Ejemplo n.º 25
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) {

    }
  }
 @Override
 public BufferedImage getPackImage() throws IOException {
   return ImageIO.read(getInputStreamByName(container.getMetadata().logoFile));
 }
Ejemplo n.º 27
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());
    }
  }
 public FMLFolderResourcePack(ModContainer container) {
   super(container.getSource());
   this.container = container;
 }