Jump to content

[1.14.2] MC Source Obfuscation


PhilipChonacky

Recommended Posts

I have been modding with the latest MCF version for MC 1.14.2 [1.14.2 - 26.0.63] and finding the level of Obfuscation almost unbearable (It seems to have been getting steadily worse since 1.12).  Are there any tools/workarounds out there to help deal with this (or any notions if/when this will get better)? Or should I just go back to modding 1.12?

 

I keep older versions around to use as reference, but as some of the structure has changed sufficiently that the classes don't always line up without going through long sessions of stare-and-compare.

 

/P

 

bonus question: Is Forge still relying in MCP for code deobfuscation?

Edited by PhilipChonacky
add question
Link to comment
Share on other sites

Update to 1.14.3 and use the latest mcp snapshot to get up to date mappings. Also, it takes time until all the fields and methods get named, 1.14 is relatively new.

 

Edit: And yes, Forge still uses MCP internally to provide names in development environment.

Edited by m00nl1ght
Link to comment
Share on other sites

9 minutes ago, m00nl1ght said:

use the latest mcp snapshot to get up to date mappings.

Thank you  - I just figured out how to update the mappings by editing the 'build.gradle' file and rerunning the gradle scripts.  I had been updating Forge, but neglected the mappings.

 

Quote

minecraft {
    // The mappings can be changed at any time, and must be in the following format.
    // snapshot_YYYYMMDD   Snapshot are built nightly.
    // stable_#            Stables are built at the discretion of the MCP team.
    // Use non-default mappings at your own risk. they may not always work.
    // Simply re-run your setup task after changing the mappings to update your workspace.
    mappings channel: 'snapshot', version: '20190624-1.14.2'

 

Link to comment
Share on other sites

5 minutes ago, m00nl1ght said:

What do you mean by "compiled" code? The java bytecode? Why?

 

i will try an explain better, im trying to figure out how the crossbow works but then i open the compiled .class file all i see inside the method is stuff like this : 

 

    public static int getMiningSpeedup(LivingEntity p_205134_0_) {
        // <editor-fold defaultstate="collapsed" desc="Compiled Code">
        /* 0: iconst_0
         * 1: istore_1
         * 2: iconst_0
         * 3: istore_2
         * 4: aload_0
         * 5: getstatic     net/minecraft/potion/Effects.HASTE:Lnet/minecraft/potion/Effect;
         * 8: invokevirtual net/minecraft/entity/LivingEntity.isPotionActive:(Lnet/minecraft/potion/Effect;)Z
         * 11: ifeq          25
         * 14: aload_0
         * 15: getstatic     net/minecraft/potion/Effects.HASTE:Lnet/minecraft/potion/Effect;
         * 18: invokevirtual net/minecraft/entity/LivingEntity.getActivePotionEffect:(Lnet/minecraft/potion/Effect;)Lnet/minecraft/potion/EffectInstance;
         * 21: invokevirtual net/minecraft/potion/EffectInstance.getAmplifier:()I
         * 24: istore_1
         * 25: aload_0
         * 26: getstatic     net/minecraft/potion/Effects.CONDUIT_POWER:Lnet/minecraft/potion/Effect;
         * 29: invokevirtual net/minecraft/entity/LivingEntity.isPotionActive:(Lnet/minecraft/potion/Effect;)Z
         * 32: ifeq          46
         * 35: aload_0
         * 36: getstatic     net/minecraft/potion/Effects.CONDUIT_POWER:Lnet/minecraft/potion/Effect;
         * 39: invokevirtual net/minecraft/entity/LivingEntity.getActivePotionEffect:(Lnet/minecraft/potion/Effect;)Lnet/minecraft/potion/EffectInstance;
         * 42: invokevirtual net/minecraft/potion/EffectInstance.getAmplifier:()I
         * 45: istore_2
         * 46: iload_1
         * 47: iload_2
         * 48: invokestatic  java/lang/Math.max:(II)I
         * 51: ireturn
         *  */
        // </editor-fold>
    }

[ just a random class from the forge libary. ] 

will that be deoft too at some point is my question. i saw a tutorial for version1.13 where the guy was able to look past it somehow :)

hope this helps

Link to comment
Share on other sites

51 minutes ago, m00nl1ght said:

1. Normally you should never need to open a .class file, only .java files.

2. How did you setup your workspace, what IDE are you using?

 

1. cant find those. still new to this. i tryed the forge-version-mappedsnapshot.jar (do you need the exact version numbers ?) as that was what a kind youtuber showed. 
2. running it though netbeans with console gradlew commands

Link to comment
Share on other sites

I have never used NetBeans before, so no idea how source attachments work there.

However, there should be some way to specify the location of the sources.

The file is called something like

forge-1.14.2-26.0.13_mapped_snapshot_20190609-1.14.2-sources.jar

 

Anyway, I recommend using an IDE with gradle integration (for example IntelliJ), because it can automatically attach the sources.

Edited by m00nl1ght
fix typo
Link to comment
Share on other sites

6 minutes ago, m00nl1ght said:

I have never used NetBeans before, so no idea how source attachments work there.

However, there should be some way to specify the location of the sources.

The file is called something like


forge-1.14.2-26.0.13_mapped_snapshot_20190609-1.14.2-sources.jar

 

Anyway, I recommend using an IDE with gradle integration (for example IntelliJ), because it can automatically attach the sources.

it has gradle support? 

ohh ill check that, thanks :D

 

Link to comment
Share on other sites

hmmm looked around for the file you mentioned under my gradle cache. (whire i found the forge-1.14.3-27.0.23_mapped_snapshot_20190704-1.14.3) assumed it whould be there as well with out any luck. ill try fire up eclipse as that is most people seams too be using (just hate working with it) and i will work my way from there. 

thank you soo much for trying Moon ❤️ 

Link to comment
Share on other sites

If you are using an IDE you should NEVER need to root around in the gradle cache manually, both Eclipse and Intellij link it as a dependency so you can browse it as such

  • Like 1

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

Spoiler

Logs (Most issues require logs to diagnose):

Spoiler

Please post logs using one of the following sites (Thank you Lumber Wizard for the list):

https://gist.github.com/100MB Requires member (Free)

https://pastebin.com/: 512KB as guest, 10MB as Pro ($$$)

https://hastebin.com/: 400KB

Do NOT use sites like Mediafire, Dropbox, OneDrive, Google Drive, or a site that has a countdown before offering downloads.

 

What to provide:

...for Crashes and Runtime issues:

Minecraft 1.14.4 and newer:

Post debug.log

Older versions:

Please update...

 

...for Installer Issues:

Post your installer log, found in the same place you ran the installer

This log will be called either installer.log or named the same as the installer but with .log on the end

Note for Windows users:

Windows hides file extensions by default so the installer may appear without the .jar extension then when the .log is added the log will appear with the .jar extension

 

Where to get it:

Mojang Launcher: When using the Mojang launcher debug.log is found in .minecraft\logs.

 

Curse/Overwolf: If you are using the Curse Launcher, their configurations break Forge's log settings, fortunately there is an easier workaround than I originally thought, this works even with Curse's installation of the Minecraft launcher as long as it is not launched THROUGH Twitch:

Spoiler
  1. Make sure you have the correct version of Forge installed (some packs are heavily dependent on one specific build of Forge)
  2. Make a launcher profile targeting this version of Forge.
  3. Set the launcher profile's GameDir property to the pack's instance folder (not the instances folder, the folder that has the pack's name on it).
  4. Now launch the pack through that profile and follow the "Mojang Launcher" instructions above.

Video:

Spoiler

 

 

 

or alternately, 

 

Fallback ("No logs are generated"):

If you don't see logs generated in the usual place, provide the launcher_log.txt from .minecraft

 

Server Not Starting:

Spoiler

If your server does not start or a command window appears and immediately goes away, run the jar manually and provide the output.

 

Reporting Illegal/Inappropriate Adfocus Ads:

Spoiler

Get a screenshot of the URL bar or copy/paste the whole URL into a thread on the General Discussion board with a description of the Ad.

Lex will need the Ad ID contained in that URL to report it to Adfocus' support team.

 

Posting your mod as a GitHub Repo:

Spoiler

When you have an issue with your mod the most helpful thing you can do when asking for help is to provide your code to those helping you. The most convenient way to do this is via GitHub or another source control hub.

When setting up a GitHub Repo it might seem easy to just upload everything, however this method has the potential for mistakes that could lead to trouble later on, it is recommended to use a Git client or to get comfortable with the Git command line. The following instructions will use the Git Command Line and as such they assume you already have it installed and that you have created a repository.

 

  1. Open a command prompt (CMD, Powershell, Terminal, etc).
  2. Navigate to the folder you extracted Forge’s MDK to (the one that had all the licenses in).
  3. Run the following commands:
    1. git init
    2. git remote add origin [Your Repository's URL]
      • In the case of GitHub it should look like: https://GitHub.com/[Your Username]/[Repo Name].git
    3. git fetch
    4. git checkout --track origin/master
    5. git stage *
    6. git commit -m "[Your commit message]"
    7. git push
  4. Navigate to GitHub and you should now see most of the files.
    • note that it is intentional that some are not synced with GitHub and this is done with the (hidden) .gitignore file that Forge’s MDK has provided (hence the strictness on which folder git init is run from)
  5. Now you can share your GitHub link with those who you are asking for help.

[Workaround line, please ignore]

 

Link to comment
Share on other sites

Hmm okay just ran the gradlew eclipse command, opened eclipse and now i can see some source files. all good, opened the same file back in netbeans and that is linked perfect as well. 
 

Name	forge-1.14.3-27.0.20_mapped_snapshot_20190704-1.14.3



file : GLX from pacage package com.mojang.blaze3d.platform; 
[Removed]

 

that is all good and pretty, however 

some other files under package net.minecraft.state for example is still  the compiled jiberish. 

[Removed]


im calling it a nigth and concluding that the mapper and forge it self is still in beta and i should properly wait untill a stable release, thank a lot guys i learned some new thing here that hopefully will make the error fixing easyer in the future.

 

Edited by DaemonUmbra
Removed Mojang Code
Link to comment
Share on other sites

I've noticed that on 1.13+ the sources don't always get attached properly for every file (or IntelliJ is doing its indexes wrong).
IntelliJ comes with a built-in decompiler so this isn't really an issue for me though. Eclipse also has a decompiler plugin that you can install.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

Just wanted to add this one last item:

 

MCP mapping lists can be found here: http://export.mcpbot.bspk.rs/snapshot/

Modify the "Mappings Channel" line to match the datecode part of the snapshot name

(This applies to MC 1.13 and newer)

 

Example:

if the line reads:  mappings channel: 'snapshot', version: '20190704-1.14.3'

and the snapshot export name is: mcp_snapshot-20190706-1.14.3.zip,

then modify the line to read:  mappings channel: 'snapshot', version: '20190706-1.14.3

 

Link to comment
Share on other sites

  • 3 weeks later...

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.