From a2bc30b35699ab67d4052c78c61633fa9351be91 Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 16 Oct 2012 13:21:10 -0400 Subject: [PATCH] Coremods can be specified via the command line: fml.coreMod.load= This will help with developing coremods --- .../relauncher/RelaunchLibraryManager.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/common/cpw/mods/fml/relauncher/RelaunchLibraryManager.java b/common/cpw/mods/fml/relauncher/RelaunchLibraryManager.java index b9a2d7e510..0676fa2dcb 100644 --- a/common/cpw/mods/fml/relauncher/RelaunchLibraryManager.java +++ b/common/cpw/mods/fml/relauncher/RelaunchLibraryManager.java @@ -63,6 +63,42 @@ public class RelaunchLibraryManager downloadMonitor.updateProgressString("All core mods are successfully located"); // Now that we have the root plugins loaded - lets see what else might be around + String commandLineCoremods = System.getProperty("fml.coreMods.load",""); + for (String s : commandLineCoremods.split(",")) + { + if (s.isEmpty()) + { + continue; + } + FMLRelaunchLog.info("Found a command line coremod : %s", s); + try + { + actualClassLoader.addTransformerExclusion(s); + Class coreModClass = Class.forName(s, true, actualClassLoader); + TransformerExclusions trExclusions = coreModClass.getAnnotation(IFMLLoadingPlugin.TransformerExclusions.class); + if (trExclusions!=null) + { + for (String st : trExclusions.value()) + { + actualClassLoader.addTransformerExclusion(st); + } + } + IFMLLoadingPlugin plugin = (IFMLLoadingPlugin) coreModClass.newInstance(); + loadPlugins.add(plugin); + if (plugin.getLibraryRequestClass()!=null) + { + for (String libName : plugin.getLibraryRequestClass()) + { + libraries.add((ILibrarySet) Class.forName(libName, true, actualClassLoader).newInstance()); + } + } + } + catch (Throwable e) + { + FMLRelaunchLog.log(Level.SEVERE,e,"Exception occured trying to load coremod %s",s); + throw new RuntimeException(e); + } + } discoverCoreMods(mcDir, actualClassLoader, loadPlugins, libraries); List caughtErrors = new ArrayList();