-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Forge Mod Loader #1
Conversation
Is this gonna be the new Cauldron? :P |
@TekkitCommando 😉 well, this might not happen due to the inherent challenges in supporting Forge/FML in a non-Minecraft environment in any useful capacity (more details at https://forums.glowstone.net/t/any-way-to-run-forge-mods-on-glowstone/94). The current major problem though is the java.lang.ClassCircularityError exception in net.minecraftforge.fml.common.asm.transformers.EventSubscriberTransformer (stack trace in deathcap/Glowstone#2) which prevents event subscriptions from being registered. So I doubt this project will reach Cauldron's level of compatibility in Forge + Bukkit, but it does in some sense share a similar philosophy of aiming for the broadest possible API compatibility (basically, the way I see it the more API support the better) |
Yep I agree |
Updated to rebase on master but still has the EventSubscriberTransformer issue (disabled), and other problems:
|
Found a fix for the ASM java.lang.ClassCircularityError exception in net.minecraftforge.fml.common.asm.transformers.EventSubscriberTransformer with java.lang.NoClassDefFoundError: org/apache/commons/lang3/JavaVersion (deathcap/Glowstone#2) via https://github.com/SpongePowered/Sponge/blob/c3691746e9d1b5e86a73d124d8e3218cdc164670/src/main/java/org/spongepowered/mod/SpongeCoremod.java#L40 // Transformer exclusions
((net.minecraft.launchwrapper.LaunchClassLoader) getClass().getClassLoader()).addTransformerExclusion("ninja.leaping.configurate"); if I edit FML to add this exclusion, then the event subscriber transform no longer crashes: --- a/src/main/java/net/minecraftforge/fml/common/launcher/FMLServerTweaker.java
+++ b/src/main/java/net/minecraftforge/fml/common/launcher/FMLServerTweaker.java
@@ -20,6 +20,7 @@ public class FMLServerTweaker extends FMLTweaker {
classLoader.addTransformerExclusion("net.minecraftforge.fml.relauncher.");
classLoader.addTransformerExclusion("net.minecraftforge.fml.common.asm.transformers.");
classLoader.addClassLoaderExclusion("LZMA.");
+ classLoader.addTransformerExclusion("org.apache.commons.lang3");
FMLLaunchHandler.configureForServerLaunch(classLoader, this);
FMLLaunchHandler.appendCoreMods(); launch output: https://gist.github.com/deathcap/0d9aa6e228d6c29c12fd problem is now how to add this exclusion without modifying FML. Sponge uses a CoreMod update: added a simple "GSFMLCoreMod" to add this exclusion, so no longer need to modify FML |
An important milestone, now under a thousand compile errors
TODO: is this available for use as a dependency? Couldn't find on Maven Central
…eakers are not implemented
…ssloader mismatch as fmlReentry()
… itself? Instead of setting LaunchClassLoader's parent classloader to the system class loader, reuse the same URLs from the system classloader for the LaunchClassLoader which also inherits from URLClassLoader. Now the loader's getClass().getClassLoader() is LaunchClassLoader, but, it still mysteriously fails with ClassCastException: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at net.minecraft.launchwrapper.Launch.main(Launch.java:40) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.run(ServerLaunchWrapper.java:43) at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.main(ServerLaunchWrapper.java:12) at net.glowstone.GlowServer.main(GlowServer.java:105) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) Caused by: java.lang.ExceptionInInitializerError at net.minecraft.server.MinecraftServer.main2(MinecraftServer.java:49) at net.minecraft.server.MinecraftServer.main(MinecraftServer.java:43) ... 17 more Caused by: java.lang.ClassCastException: net.minecraft.launchwrapper.LaunchClassLoader cannot be cast to net.minecraft.launchwrapper.LaunchClassLoader at net.minecraftforge.fml.common.ModClassLoader.<init>(ModClassLoader.java:49) at net.minecraftforge.fml.common.Loader.<init>(Loader.java:184) at net.minecraftforge.fml.common.Loader.instance(Loader.java:161) at net.minecraftforge.fml.common.FMLCommonHandler.<init>(FMLCommonHandler.java:106) at net.minecraftforge.fml.common.FMLCommonHandler.<clinit>(FMLCommonHandler.java:96) ... 19 more A problem occurred running the Server launcher.java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.run(ServerLaunchWrapper.java:43) at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.main(ServerLaunchWrapper.java:12) at net.glowstone.GlowServer.main(GlowServer.java:105) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at net.minecraft.launchwrapper.Launch.main(Launch.java:43) ... 12 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at net.minecraft.launchwrapper.Launch.main(Launch.java:40) ... 12 more Caused by: java.lang.ExceptionInInitializerError at net.minecraft.server.MinecraftServer.main2(MinecraftServer.java:49) at net.minecraft.server.MinecraftServer.main(MinecraftServer.java:43) ... 17 more Caused by: java.lang.ClassCastException: net.minecraft.launchwrapper.LaunchClassLoader cannot be cast to net.minecraft.launchwrapper.LaunchClassLoader at net.minecraftforge.fml.common.ModClassLoader.<init>(ModClassLoader.java:49) at net.minecraftforge.fml.common.Loader.<init>(Loader.java:184) at net.minecraftforge.fml.common.Loader.instance(Loader.java:161) at net.minecraftforge.fml.common.FMLCommonHandler.<init>(FMLCommonHandler.java:106) at net.minecraftforge.fml.common.FMLCommonHandler.<clinit>(FMLCommonHandler.java:96) ... 19 more
Fixes the annoying repeating log message: 328:[21:00:43] [main/ERROR] [LaunchWrapper/mcp]: The jar file glowstone-0.0.1-SNAPSHOT.jar has a security seal for path net.minecraftforge.fml.common.functions, but that path is defined and not secure
Pointing to commit: deathcap/FML@a02af74 Disable ASM event transformers for now Disabled since these cause ClassCircularityErrors for some reason: 21:26:57] [main/ERROR] [LaunchWrapper]: A critical problem occurred registering the ASM transformer class $wrapper.net.minecraftforge.fml.common.asm.transformers.EventSubscriberTransformer java.lang.ClassNotFoundException: $wrapper.net.minecraftforge.fml.common.asm.transformers.EventSubscriberTransformer at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at java.lang.ClassLoader.loadClass(ClassLoader.java:425) ~[?:1.7.0_72] at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ~[?:1.7.0_72] at net.minecraft.launchwrapper.LaunchClassLoader.registerTransformer(LaunchClassLoader.java:88) [glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper.injectIntoClassLoader(CoreModManager.java:118) [glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at net.minecraft.launchwrapper.Launch.launch(Launch.java:115) [glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_72] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_72] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_72] at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_72] at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.run(ServerLaunchWrapper.java:43) [glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.main(ServerLaunchWrapper.java:12) [glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at net.glowstone.GlowServer.main(GlowServer.java:105) [glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] Caused by: net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerException: Exception in class transformer net.minecraftforge.fml.common.asm.transformers.EventSubscriptionTransformer@e0e37b3 from coremod FMLCorePlugin at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:234) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] ... 13 more Caused by: java.lang.ClassCircularityError: net/minecraftforge/fml/common/eventhandler/Event at net.minecraftforge.fml.common.asm.transformers.EventSubscriptionTransformer.buildEvents(EventSubscriptionTransformer.java:85) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at net.minecraftforge.fml.common.asm.transformers.EventSubscriptionTransformer.transform(EventSubscriptionTransformer.java:62) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:230) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] ... 13 more [21:26:57] [main/ERROR] [LaunchWrapper]: Unable to launch java.lang.RuntimeException: java.lang.ClassNotFoundException: net.minecraftforge.fml.common.asm.FMLSanityChecker at net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper.injectIntoClassLoader(CoreModManager.java:155) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at net.minecraft.launchwrapper.Launch.launch(Launch.java:115) [glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_72] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_72] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_72] at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_72] at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.run(ServerLaunchWrapper.java:43) [glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.main(ServerLaunchWrapper.java:12) [glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at net.glowstone.GlowServer.main(GlowServer.java:105) [glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] Caused by: java.lang.ClassNotFoundException: net.minecraftforge.fml.common.asm.FMLSanityChecker at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at java.lang.ClassLoader.loadClass(ClassLoader.java:425) ~[?:1.7.0_72] at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ~[?:1.7.0_72] at java.lang.Class.forName0(Native Method) ~[?:1.7.0_72] at java.lang.Class.forName(Class.java:274) ~[?:1.7.0_72] at net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper.injectIntoClassLoader(CoreModManager.java:143) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] ... 9 more Caused by: net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerException: Exception in class transformer net.minecraftforge.fml.common.asm.transformers.BlamingTransformer@357c4ab7 from coremod FMLCorePlugin at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:234) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at java.lang.ClassLoader.loadClass(ClassLoader.java:425) ~[?:1.7.0_72] at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ~[?:1.7.0_72] at java.lang.Class.forName0(Native Method) ~[?:1.7.0_72] at java.lang.Class.forName(Class.java:274) ~[?:1.7.0_72] at net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper.injectIntoClassLoader(CoreModManager.java:143) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] ... 9 more Caused by: java.lang.NoClassDefFoundError: org/apache/commons/lang3/JavaVersion at net.minecraftforge.fml.common.asm.transformers.BlamingTransformer$VersionVisitor.visit(BlamingTransformer.java:60) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at org.objectweb.asm.ClassReader.accept(ClassReader.java:622) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at org.objectweb.asm.ClassReader.accept(ClassReader.java:506) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at net.minecraftforge.fml.common.asm.transformers.BlamingTransformer.transform(BlamingTransformer.java:39) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:230) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] at java.lang.ClassLoader.loadClass(ClassLoader.java:425) ~[?:1.7.0_72] at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ~[?:1.7.0_72] at java.lang.Class.forName0(Native Method) ~[?:1.7.0_72] at java.lang.Class.forName(Class.java:274) ~[?:1.7.0_72] at net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper.injectIntoClassLoader(CoreModManager.java:143) ~[glowstone-0.0.1-SNAPSHOT.jar:git-Glowstone-1.8-225-g2125021] ... 9 more 21:26:57 [INFO] This server is running Glowstone version git-Glowstone-1.8-225-g2125021 (Implementing API version 1.8-R1-SNAPSHOT) 21:26:58 [INFO] Recipes: 295 shaped, 63 shapeless, 24 furnace, 15 fuels.
This reverts commit 82b11a2.
Rebased on master to resolve conflicts, mod "loading" works again: https://gist.github.com/deathcap/d366631d22220d54f25d - but the problem of having the mods usefully interface with the server is still unsolved. Another interesting problem came up in discussion on Gitter yesterday is supporting the Forge wire protocol in Glowstone++. First step is updating the server list ping packet (lists server type, installed mods, whether client mods are allowed), PR'd this separately in #153. Server type will likely need to change to Next step is supporting the Forge/FML handshaking protocol, for reference, this is how Bungeecord does it: SpigotMC/BungeeCord#1091 SpigotMC/BungeeCord#899 - If only the Forge handshake protocol is supported, then client/server mods would have to be ported specifically to run on Glowstone++ servers (since they almost always depend on Minecraft internals not present here), but interoperating with existing client mods may be a (remote) possibility. Upon receiving |
Somehow FML is dead. You should change the submodule to minecraft forge... |
FML was integrated into Forge as there was little to no reason to keep them separate as a modding library and mod loading library. There are other libraries available as mod loaders (LiteLoader is a pretty neat one that relies on Mixins, and has been intending to be as compatible with almost all mods as possible). Personally, I don't see much of a reason for FML to be included in GS++ when bukkit plugins are the only things really supported currently. FML itself supports much more on top of Minecraft including class transformations (which are entirely separate from the Bukkit API usage). Just my two cents. |
Forge is too connected to Mojang's code to be acceptable for Glowstone. Closing as this will never get pulled. |
I think it may be possible to use some parts of FML (Forge Mod Loader, or more specifically the mod loading pieces of what is now integrated into MinecraftForge as liach mentions) within Glowstone, the mod class loading is mostly generic enough, but much of the other functionality such as the registries (for items, blocks, recipes, etc.) does rely on internal Mojang classes (which had to be stubbed to make this PR work), so I agree it's probably not feasible nor desirable or useful at least as currently designed to include FML in Glowstone++; leaving closed. |
I guess we could use it if we ever provided an API for mod-like things. |
Adds forge mod loader.