IC2 decompilation with MCP : patches now available

  • So, this is a post about modding IC2.


    To do so, you'll generally need to decompile it. Firstly you'll need to grab MCP5.0 from http://mcp.ocean-labs.de/index.php/MCP_Releases.


    Unzip/extract that file to somewhere. Follow it's instructions and make sure you can decompile the vanilla client and server.


    To decompile IC2, you'll need the same mods that you have already: ModLoader, ModLoaderMP, and minecraft forge.


    Replace your vanilla jars in the MCP jars folder with the modded ones (avoid any mods other than those three in the jar files).


    To decompile IC2, you'll need to add in IC2 to the jars. For this, I normally extract the client and server jars to temporary directories and run "jar uf <path to the right one of minecraft.jar or minecraft_server.jar>" from the temporary extraction directories.


    Finally, you'll need the compressed file here http://www.mediafire.com/?xmpgh41i5focmpc (sorry, it's mediafire, but the forums won't accept tar.gz files, and I hate using zip).


    This contains two patches (one client, one server) and a script which calls into MCP to decompile, before applying the patches and then decompiling again (successfully, the second time).


    I am truly sorry that this is probably a linux/cygwin only solution, but MCP does not want to cooperate in building a useful patching environment, so I've had to work around the fun and games there. More info in my detail post below: http://forum.industrial-craft.…ad&postID=29078#post29078

  • OK, so the solution isn't perfect, because it requires Linux or Cygwin to work. Basically, it uses vanilla MCP to decompile normally, and then patches the errors out after the normal decompilation fails (because of the recompile step).


    To use, simply extract the attached tar gzip file to the top level MCP directory where you have extracted MCP and verified that you can do a normal decompilation of both client and server. (three new files: ic2decompile.sh, minecraft_ic2.patch and minecraft_server_ic2.patch should appear) and run the ic2decompile.sh script.


    It will decompile client and server (you need both!) and then patch with this patchset. Note, this is for IC2 1.42 (sorry, I built these patches before 1.43 landed) so you should start with that if possible. It will probably work fine on 1.43, but I haven't tested it and it's Christmas Eve.


    I will probably leave this here, because I don't have a windows environment, and I've already spent far too long looking at MCP (which is a bit of an hackfest to be honest) and I just want to write some fun code and play the game with my kids.


    Anyone else is free to take this work and try and incorporate it into the vanilla MCP process if they wish- I just wasted a day trying to do the same :(

  • I'm on Windows right now. So need to setup MCP on Ubuntu to test it. But whold it be bossible with a bat script too? :) Anyway thanks for the patch :) You're awsome!

  • This is just based on assumptions but one could manually patch without Cygwin if they think it's too much work/too complicated.
    Just look at the patch files and do all the changes manually or use any windows based patcher to apply them.


    I haven't tried this yet, i make the fixes myself.

  • This is just based on assumptions but one could manually patch without Cygwin if they think it's too much work/too complicated.
    Just look at the patch files and do all the changes manually or use any windows based patcher to apply them.


    I haven't tried this yet, i make the fixes myself.


    Agreed, there's a bunch of ways to do this- I just don't want to waste any more time trying to get MCP to like my patches :(

  • You can apply the patches on Windows using gnuwin32, but the gnuwin32 patch (also used by MCP) needs patch files to be converted to CRLF due to a known bug.


    Use Notepad++ to convert the patches to CRLF and use this batch after decompiling with errors:

    Code
    1. @echo off
    2. cd src
    3. ..\runtime\bin\applydiff.exe -p0 <..\minecraft_ic2.patch
    4. ..\runtime\bin\applydiff.exe -p0 <..\minecraft_server_ic2.patch


    EDIT: Why is Forge requesting obfuscated classes as method parameters?

  • I dunno how technically difficult it would be, but it seems to me the easiest thing to do would be to resolve the issue modloader has deobfuscating enum list. That way it wouldn't require you to keep update this every time there is a new version of IC2.

  • Can someone make a video or just explain with more details this part, because I can't fully understand it. Thanks!

  • You might want to edit the OP slightly..

    you'll need the same mods that you have already: ModLoader, ModLoaderMP, and minecraft forge.


    ModLoader and ModLoaderMP are no longer required! :D :Industrial Diamond: There is a diamond for helping me begin to mod.

  • how so you re decompile the jars? I used the script richardg posted but now there is no client src. I noticed the .sh file but windows won't run those.
    doh! just used google, figured out what the CRLF files are, so should I just try to convert the .sh or what?
    Made Ez decompiler. Just Extract the Jar that shows up in the src folder and ignore any errors. Enjoy :)
    need dev permission, but I will release the decompiler once i get the OK

  • I resurrect this just to update a few Informations about decompiling IC² with MC1.3.2


    1. setup MCP like normal and make it READY for decompiling
    2. install Forge into the minecraft.jar inside your jars-folder
    3. delete the 3 "XX-Integration"-Folders in your IC²-jar
    4. install IC2 into the minecraft.jar
    5. delete META-INF inside your minecraft.jar NOW
    6. put the content of the lib-Folder which is in your .minecraft into the lib-Folder of MCP
    7. run the decompile.bat
    8. now you have the source, but it contains a few very minor Errors.

  • I get a bunch of errors when I try to recompile it, mostly Forge and FML cause them, but when I decompiled it then it showed just 2 errors.
    I really want to change the nano suit energy usage, so it is worth making.

    Fusion Power Engineering Industries® Making Fusion™ Automation Chamber© is DONE!!!!!!!! HAYO!!!



    Hint: Click the Automation Chamber text to see how it looks :D

  • I've tried to decompile this so many times, and it hasn't worked once! Can someone do a video tutorial please?


    EDIT: Derp, didn't realise that it's not supposed to have no errors...


    COMING !SOON: Melumpkins, the Addon!

    The post was edited 1 time, last by Trintus ().

  • in computer sience same actions lead to same result, no matter how many times you decompile result will be same and it will be with errors.

    Unsafe.putObject(42,Unsafe.staticFieldOffset(42.getDeclaredFields()[42]),43);

  • If you overflow a buffer then you'll be writing into memory that contains whatever the operating system put there. One run it could be unused memory, the next run the OS might allocate that space for another variable in your program. Hence, different results from the same code. I didn't say anything about changing the buffer size.