Jump to content

Is it possible to edit minecraft's/forge's source code that is displayed?


Recommended Posts

Posted

For display purposes only. I don't want to touch the actual code.

 

all I want is to get rid of the weird names (change the names of locals, parameters, fields and methods to something more meaningful); and maybe add a few comments. Is it possible? maybe there's some eclipse tool to do this.

WIP mods: easyautomation, easyenergy, easyelectronics, easymoney, easytrasportation, easysecurity, easymultiverse, easyfactions, easymagick, easyalchemy, easyseasons

Posted

Minecraft:

 

Short answer: No

Long answer: since the source code of Minecraft is not public (as I know), you need to decompile the minecraft.jar, do your stuff and recompile it back into an minecraft.jar

 

Forge: Yes, just set up your environment and import the source code and do your stuff. Afterwards you need to use your modified source code to create your mods but I guess this is more complicated than it sounds?

Posted

I don't know how to do that. When I open any class from ForgeSrc I can only read the source code, not edit it.

WIP mods: easyautomation, easyenergy, easyelectronics, easymoney, easytrasportation, easysecurity, easymultiverse, easyfactions, easymagick, easyalchemy, easyseasons

Posted

Yes because the source code is imported in the mod environment as library.

You need to open the source code itselfe as project, but I haven't looked into the project structure of the source code so maybe it's not that simple.

Posted

If I did that wouldn't that recompile Forge classes thus making my mods incompatible with other versions of Forge?

WIP mods: easyautomation, easyenergy, easyelectronics, easymoney, easytrasportation, easysecurity, easymultiverse, easyfactions, easymagick, easyalchemy, easyseasons

Posted

Maybe the build number changes but since you don't modidy the structure and signature of the classes it shouldn't be a problem.

 

One thing you can do:

 

search on google for "contribute to minecraft forge" or something, maybe there is a tutorial where you can see how the source code itselfe is set up in an IDE so you can modify the source code and build it and after this use the build jar as library in your mod environment.

Posted

I think the OP is asking for a more thorough debobfuscation (replacing srg names with meaningful names) as well as injecting comments along with hooks. These things are not done lightly, and they're not done "at home", but they are done by Forge's developers. Each major revision of Forge seems to name several more methods and variables for ease of reading. Comments are generally written on methods and fields injected by Forge, but Minecraft's vanilla elements are usually bereft.

 

To contribute your own advancement of Forge, you could start by locating the GIT repo and associated discussions. First learn the customs for suggestions and contributions so you don't stumble in and bother some very busy volunteers with headaches they've already dismissed. Once you've gained enough familiarity to speak up, then you might be able to offer up a useful suggestion. If you're especially ambitious, then you could study up on the scripting technology that decompiles Minecraft, injects Forge hooks etc. If you then write a generally useful "transform", you can learn how to submit what's called a "pull request" to offer your transform to Forge.

 

For the less ambitious: Whenever one of your mods encounters a srg name or poorly documented vanilla method, put your own comments into your own code. If you have some software methodology chops, you can organize your own modding in "layers", with your own interfaces, abstract classes etc to insulate your "on the ground" mod classes from the harsh pseudo-reality of decompiled Java.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

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.