Created
June 14, 2014 16:56
-
-
Save kosakriszi/a88fbdaac022632258e7 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
// first I add the URL of the binary to the LaunchClassLoader's search paths | |
classLoader.addURL(forgeLib.toURI().toURL()); | |
JarFile forgeJar = new JarFile(forgeLib); | |
Enumeration<JarEntry> entries = forgeJar.entries(); | |
// here, I make an effort to pre-load all the class files inside the binary, | |
// this seems to be necessary for it to even find the classes | |
while(entries.hasMoreElements()) { | |
String entryName = entries.nextElement().getName(); | |
if(entryName.endsWith(".class")) { | |
String searchName = entryName.substring(0, entryName.length()-6).replace('/', '.'); | |
classLoader.findClass(searchName); | |
} | |
} | |
forgeJar.close(); | |
// find the tweaker class, no big deal | |
forgeTweaker = (ITweaker) classLoader.findClass("cpw.mods.fml.common.launcher.FMLTweaker").newInstance(); | |
// and finally, I add the tweaker to the tweaker queue | |
List<String> tweakClasses = (List<String>) Launch.blackboard.get("TweakClasses"); | |
tweakClasses.add("cpw.mods.fml.common.launcher.FMLTweaker"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment