Jump to content

(Modding Noob Here) Weird imports in someone else's mod when updating to 1.6.2


Kraethi

Recommended Posts

Hey there, new to modding but not to minecraft. :P

One of my favorite mods is lagging behind in development, so I decided I'd give a shot at updating it from 1.5.2 to 1.6.2 myself. I figured out how to set up MCP and forge, and have the mod itself all decompiled and added.

 

The majority of the java errors, however, aren't related to new methods. In the section at the top of just about every .java file (I'm also a java noob, but I don't really think this issue is so java-related) there are several lines that start with "import". Some of these have normal things following them, like "cpw.mods.fml..." (etc). The majority of the java errors are from lines like "import aab" and "import dk", which gives me "the import aab cannot be resolved" which in turn messes everything up further down in the code when it tries to use "aab" or whatever.

 

The only thing I can think of is that these correspond to the .class files in the original, compiled and obfuscated minecraft.jar. What can I do to figure out what on earth these are supposed to mean and fix them? I apologize in advance if this turns out to be a stupid question, as I couldn't find any evidence of anyone else having had this problem before.

 

Link to comment
Share on other sites

/cough/ so I'm a bit of an idiot, I found the file in MCP containing all the names of the classes. Should I replace, say, every "aab" with "net.minecraft.item.crafting.RecipesMapCloning", for example? There also seems to be some ambiguity. Is there any way I can iron this out with certainty?

Link to comment
Share on other sites

So it sounds like you are dealing with "obfuscated" class files. When Minecraft recompiles it's code it uses a system that essentially makes all class names, methods and fields almost unusable by renaming and refactoring them to names such as aab, aac, ect. This would explain why your import statements would include these weird names.

 

But as for fixing these, it's nearly impossible with the information you have given us so far. What mod is it that you are trying to update? Is it open source? If not, where did you get it's source from? Did you install Forge correctly?

 

Without this information none of us can really help you.

 

Cheers,

Follow me on twitter! @keepablock

Read up on whats new! www.catacombs.co

width=700 height=60http://electronic-chronic.com/assets/keep-a-block/wikilink/wikilink_logo.png[/img]

Link to comment
Share on other sites

the file in MCP containing all the names of the classes. Should I replace, say, every "aab" with "net.minecraft.item.crafting.RecipesMapCloning", for example?

You can use MCP to deobfuscate by adding your mod classes to the Minecraft jar and then decompiling, or (perhaps easier) deobfuscate by feeding your mod jar to a tool like BON.

 

There also seems to be some ambiguity. Is there any way I can iron this out with certainty?

You may be seeing apparent ambiguity in the obfuscated code since the Java runtime additionally uses type information to uniquely identify symbols. Nothing is stopping the bytecode from using the same name if it unique according to the JVM, for example see: https://github.com/MinecraftForge/FML/issues/210 (since fixed). Additionally the same name can be reused in a different context, so it cannot be substituted purely textually. But FML, MCP, BON, etc. all deobf properly and reliably.

Link to comment
Share on other sites

Thank you both for your help! You were right about the obfuscated class files. As it turns out, each corresponded to a single .java file in the source code, so that cleaned itself up nicely. I have another, unrelated problem now, having to do with refreshBoundTexture() and GUI tooltips but I'll wait until I'm back on my desktop to post a new topic. Thank you both!

Link to comment
Share on other sites

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.