Created
June 16, 2014 04:38
-
-
Save kosakriszi/3f39710f2bfba3273e9e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is the forge implementation for loading coremods | |
private static Method ADDURL; | |
// the following takes place inside the injectIntoClassLoader(LaunchClassLoader classLoader) method | |
if(ADDURL == null) { | |
ADDURL = URLClassLoader.class.getDeclaredMethod("addURL", URL.class); | |
ADDURL.setAccessible(true); | |
} | |
ADDURL.invoke(classLoader.getClass().getClassLoader(), forgeLib.toURI().toURL()); | |
classLoader.addURL(forgeLib.toURI().toURL()); | |
// here I just grab the tweaker instance as per usual | |
forgeTweaker = ((ITweaker) Class.forName("cpw.mods.fml.common.launcher.FMLTweaker", false, classLoader).newInstance()); | |
Logger.log("Starting Forge!"); | |
// I call the tweaker like this for cleaner console output, | |
// it's effectively the same, I have tried both ways | |
forgeTweaker.acceptOptions(args, gameDir, assetsDir, profile); | |
forgeTweaker.injectIntoClassLoader(classLoader); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment