[1.7.2] How do I properly install the IC2 API so that I can create an addon for IC2

  • Hey all!
    I'm LFX and I'm programming a mod about clones and automation called Cloned Helpers, but for some of the aspects I need to use IndustrialCraft2. I know there is an API able to be downloaded but I don't know how to install the java and class files and use them as referenced libraries when modding with Forge and Gradle. I do however know how to install the jar file so that when modding I have IC2 installed. My main problem is that I don't know how to get the IC2 API as a referenced library so that I can mod referencing the IC2 API for 1.7.2. Please help me if you can!
    Thanks,
    LFX

    • Official Post

    If you want to ship the IC2 api, extract the api zip to src/main/java (next to your own files), otherwise extract it to src/api/java.


    You could also use the deobf jar and reference it as a dependency, see http://www.gradle.org/docs/cur…tml#sub:file_dependencies
    example:

    Code
    dependencies {
        compile files('some/path/industrialcraft-2-dev-deobf_2.1.445-experimental.jar')
    }


    Do NOT put it in buildscript { dependencies {} }, but in the root of build.gradle.


    In eclipse just add the deobf jar as a library to your build path.

    • Official Post

    What Player said is correct, BUT if it is an IC2 Addon, what means that IC2 must be installed for it to work, then DO NOT SHIP THE API UNDER ANY CIRCUMSTANCES. Since it is an Addon, IC2 is always installed, so the API is always there (provided by IC2 itself), meaning you don't need to include it in your Mod Download at all.


    Shipping any API of any Mod within your own Mod download is something you must avoid if possible, because if the API updates you will get crash problems when overriding the new API with your old one (what is a 50/50 Chance).

  • Thank you both so much!
    When I put in the dependencies I edit the build.gradle and put

    Code
    dependencies {	compile files('some/path/industrialcraft-2-dev-deobf_2.1.445-experimental.jar') }


    in right? Also would I extract the API zip to src/api/java and reference the deobf jar as a dependency and a referenced library, or would I do one or the other.



    By the way I'm a big fan of IC2 and I feel honored to get Player himself to respond to me. I have also checked out Greg Tech and I think that's awesome as well!

  • Hey Player I'm sorry for asking so many questions but I just want to make sure this is right. If it's not right can you give me a step by step of the API zip method?


    So what I think I should do is just extract it to src/api/java


    After doing that I can reference all of the API classes and interfaces in my code right? And it will all work if all I do is extract that API zip?


    If not please tell me step by step what to do. I understand that you are a very busy guy with your IC2 modding and I respect that. If you can't reply then I understand.

  • I'll try that but to me it only looks like a linked folder not something that I can reference the classes of.

  • Also, after extracting the API zip to src/api/java do I have to run


    Code
    ./gradlew setupDecompWorkspace --refresh-dependencies


    or


    Code
    ./gradlew eclipse



    again in Terminal? Would it hurt to try? I just don't want to have to download everything again.


    Thanks for helping!

  • So it seems you are not knowledgeable in eclipse's folder reading structure. I am not saying this is a bad thing, I was until I started modding because I used a different java compiler. So what I did was I put my API folder in Forge/src/RANDOM PACKAGE I CREATED

  • That doesn't answer my question. Should I do ./gradlew setupDecompWorkspace again or ./gradlew eclipse again or is it intelligent enough not to need that.

  • So I got it all to work and I have access to all of the files but when I start up Minecraft IC2 isn't installed. Should I just get the experimental version of the mod that goes with the version of the API I have and put it in the mods folder for testing purposes? That sounds like what I should do but I just want to make sure.

  • What I think I should do is install the corresponding version of IC2 into the mods folder. Is that right? If so, then before distribution of the mod should I take IC2 out of the mods folder or not or does it not matter?

  • Thank you so much! Should I take it out of the mods folder before compiling and distributing my mod or not or should it not matter? This might be kind of a dumb question but I've never compiled and distributed a mod before so I wouldn't know. I really appreciate your help!