public static String[] getModIDs() { List<ModContainer> modList = Loader.instance().getActiveModList(); List<String> modIDs = new ArrayList<String>(); for (ModContainer modContainer : modList) { if (modContainer instanceof FMLModContainer) { modIDs.add(modContainer.getModId()); } } Collections.sort(modIDs, new Comparator<String>() { @Override public int compare(String o1, String o2) { return Loader.instance().getIndexedModList().get(o1).getName().compareTo(Loader.instance().getIndexedModList().get(o2).getName()); } }); return modIDs.toArray(new String[modIDs.size()]); }
public Properties getVersionProperties() { if (this.modContainer instanceof FMLModContainer) { return ((FMLModContainer)this.modContainer).searchForVersionProperties(); } return null; }
@EventHandler public void construct(FMLConstructionEvent event) { ModLoadingListener thisListener = null; for (ModContainer mod : Loader.instance().getActiveModList()) { if (mod instanceof FMLModContainer) { EventBus bus = null; try { // Its a bit questionable to be changing FML itself, but reflection is better than ASM transforming // forge Field f = FMLModContainer.class.getDeclaredField("eventBus"); f.setAccessible(true); bus = (EventBus) f.get(mod); } catch (Throwable t) { t.printStackTrace(); } if (bus != null) { if (mod.getModId().equals(Lib.Mod.ID)) { thisListener = new ModLoadingListener(mod); bus.register(thisListener); } else bus.register(new ModLoadingListener(mod)); } } } if (thisListener != null) ModLoadingListener.doProgress(State.CONSTRUCT, thisListener); }
@Override public Iterable<String[]> dump(int mode) { List<String[]> list = new LinkedList<String[]>(); for (ModContainer mod : Loader.instance().getModList()) { list.add(new String[] { mod.getModId(), mod.getName(), mod.getVersion(), String.valueOf(!(mod instanceof FMLModContainer)), String.valueOf(mod.canBeDisabled()), mod.getDependencies().toString() }); } return list; }