Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

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

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?

  • Author

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

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.

  • Author

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

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.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.