Posted November 26, 201311 yr Hello Gents, I have been spending some time trying to create a new mod. I have created the foundation of the mod by editing Minecraft code (yes, I know its not allow for distributional, but it was only for testing purposes.). Now that I have the mod working partial, I went and started the core mod using ASM. If I run my core mod by itself, it works great. If I run my mod by itself, it works great. If I run my coremod with my mod, it fails. I've been getting some very weird errors. First java.lang.NoSuchMethodError: ww.<init>(Ljava/lang/String;)V at mods.scourgecraft.creative.CreativeTabBlock.<init>(CreativeTabBlock.java:15) . I did some research by using JD-GUI and noticed that the minecraft.jar actually does not have the normal CreativeTab(String) method in it. Yet, when I decompiled Forge after downloading, the constructor does exist. I am lost on how it appears on the decompile but yet disappears later. I followed guides to modify the core and it works fine by itself, but it seems once I modify the core my normal mod doesn't function with odd errors. Both forge of the coremod and the mod are identical. Any leads to the right direction would be great.
November 26, 201311 yr Author Wow. I think I fixed it. You cannot run a core mod with your mod. But you can run a mod with your core mod. (In Development mode speaking terms). Once I ran it the opposite way, the coremod loaded fine in the mod environment. Can anyone elaborate on this?
November 27, 201311 yr Actually the coremod shouldn't launch at all in dev environment. You are supposed to patch minecraft files when developing. Then only include the compiled transformers into the coremod jar. You can include a mod into a coremod jar by setting FMLCorePluginContainsFMLMod: true in the Manifest file.
November 27, 201311 yr Author I wonder if the theory of patching changed in 1.6.4. In reference to this post: http://www.minecraftforum.net/topic/1909746-forgecore-modding-classcircularityerror/ The user changed the way he was using ASM. And now he uses features like ClassPatcher.addPatchesFrom((File)data.get("coremodLocation")); MethodNode methodNode; Label label; if (deobfuscated) { MethodNode methodNode = new MethodNode(1, "registerIcons", "(Lnet/minecraft/client/renderer/texture/IconRegister;)V", null, null); methodNode.visitFieldInsn(178, "poersch/minecraft/bettergrassandleaves/BetterGrassAndLeavesMod", "workingRegisterIconsHook", "Z"); Label label = new Label(); methodNode.visitJumpInsn(154, label); methodNode.visitVarInsn(25, 1); methodNode.visitMethodInsn(184, "poersch/minecraft/bettergrassandleaves/renderer/BlockRendererList", "onRegisterIconsHook", "(Lnet/minecraft/client/renderer/texture/IconRegister;)V"); methodNode.visitLabel(label); methodNode.visitFrame(3, 0, null, 0, null); methodNode.visitInsn(177); ClassPatcher.addPatcherFor("net.minecraft.block.BlockGrass", new InstructionInjector(methodNode, 1)); } else { methodNode = new MethodNode(1, "a", "(Lmt;)V", null, null); methodNode.visitFieldInsn(178, "poersch/minecraft/bettergrassandleaves/BetterGrassAndLeavesMod", "workingRegisterIconsHook", "Z"); label = new Label(); methodNode.visitJumpInsn(154, label); methodNode.visitVarInsn(25, 1); methodNode.visitMethodInsn(184, "poersch/minecraft/bettergrassandleaves/renderer/BlockRendererList", "onRegisterIconsHook", "(Lnet/minecraft/client/renderer/texture/IconRegister;)V"); methodNode.visitLabel(label); methodNode.visitFrame(3, 0, null, 0, null); methodNode.visitInsn(177); ClassPatcher.addPatcherFor("aon", new InstructionInjector(methodNode, 1)); } So he has a folder called patches and it takes that code and injects it into the core somehow? Blah. Im lost. I'll have to back to reading the basics.
November 27, 201311 yr ClassCircularityError is probably an error he made. Except for "tweakers priority" added by Forge (which is optional), i don't see anything that would make patching any different in 1.6.4. This code you are showing doesn't make sense to me. It looks like it is visiting his own classes and patch them afterwards... Why would anyone do that instead of writing the code directly ? And using (net.minecraft.block.BlockGrass, net/minecraft/client/renderer/texture/IconRegister) unobfuscated class name too ! Anyway, you can do that to Minecraft classes indeed, if you don't want to touch Mojang code directly. Though unnecessary work in my opinion.
November 28, 201311 yr I would make my own copy of the class that it loads in your mod so it uses yours for it and not mojangs but this is untested. Just thinking about class loaders.
November 28, 201311 yr You might want to use something like ClassPatchManager, if you are interested into *.patch files.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.