Jump to content

Naming conventions and parameters in the forge code (not Java)?


icecubert

Recommended Posts

I'm pretty familiar with normal naming conventions in Java, what I wanted to ask about is specifically the forge mc code and how existing modders change it.

 

While making a few of my first basic mods, I encountered many parameters named "p_149727_4_", could I change those? Or is the convention to leave them like that? Also, if I were to change them... what do they mean? The code seems to be filled with random parameters and mysterious names. Did this happen because of de-obfuscation or did Notch/Jeb somehow work with this stuff.

 

I mean maybe it all make sense I'm just not used to it!

Link to comment
Share on other sites

I have discovered what a few of the parameters are for methods. If I don't know it, I play around with to see if I can figure it out. Once/If I do, I rename it to what it is.

We all stuff up sometimes... But I seem to be at the bottom of that pot.

Link to comment
Share on other sites

I have discovered what a few of the parameters are for methods. If I don't know it, I play around with to see if I can figure it out. Once/If I do, I rename it to what it is.

 

Thanks! I should probably do that too. Any ideas why the parameters are like that? Were they originally like that or did it happen through the whole process of decompiling the code and what not?

Link to comment
Share on other sites

I'm not sure if you understand where this source code is coming from.  Mojang (Minecraft developers) don't publish their code and it is provided to public in a compiled and obfuscated format -- basically it is not human readable.  However, Java is actually fairly prone to decompilation and deobfuscation by people dedicated to the task.  So some people have done that, and I think that is what the MCP does -- it maps the obfuscated code to deobfuscated code, making it essentially human readable.  However, each time there is a major version upgrade to Minecraft the work has to be done over again.  And it is never really complete.  So the weird method and parameter names you see are those areas of the code that they have not gotten around to deobfuscate.

 

Whether or not you can change them is really according to how Java works.  If they are local parameter names going into a method that you're overriding or copying, of course you can change them. 

 

However, if they are method names you have to think more carefully and understand what may be calling the method.  If some vanilla code elsewhere in Minecraft will call the method then of course you can't change the name because then it will break the call.  But if the method is only called within a class that you have control over, maybe that you copied, then of course you can change the name.

 

So those names are not really a "naming convention" but rather they are unfinished part of the deobfuscation and are admittedly not human readable.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Thanks for the info!

 

I thought it had something to do with de-obfuscating the code but this definitely cleared stuff up about how it worked. I think I'll look more into how the whole process works and how people went about doing it, it seems pretty interesting.

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.