Jump to content

Recommended Posts

Posted

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.

Posted

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?

Posted

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.

Posted

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.

Posted

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... :o

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.