Jump to content




Need help setting up the mod API


3 replies to this topic

#1 wiggle1000

  • Members
  • 17 posts

Posted 20 March 2017 - 09:50 PM

I've been toiling for days over this problem: I have no idea how to use the CC API in my mod!
I'm using IntelliJ IDEA, and forge for 1.7.10. I can't get the mod to show up when I test the game..

Basically: What steps can I take to install the mod API (for use in making peripherals, etc.)?

Edited by wiggle1000, 20 March 2017 - 10:15 PM.


#2 SquidDev

    Frickin' laser beams | Resident Necromancer

  • Members
  • 1,427 posts
  • LocationDoes anyone put something serious here?

Posted 20 March 2017 - 11:49 PM

Firstly, I'd seriously consider developing for 1.8.9/1.10.2 instead of 1.7.10. Porting mods between versions is a bit of a pain, so if you're going in fresh I'd just start using as recent a version as possible. Anyway, in order to depend on ComputerCraft: you basically have two options:

Embedding the API
This is the "standard" way of including APIs. It makes it easier to work with the source, but does mean you have to keep the API up to date with the mod's version.

If you open the CC jar as a zip file (using something like 7zip, or your OS's built in archiver), you'll see an api/src folder. You want to extract that to the "src/api/java" directory, so you have something like this.

You should now be able to use the CC APIs. You may need to re-generate the project files if they don't show up immediately. Note, you'll also need to copy the CC jar into the run/mods folder for it to be loaded at runtime.

Adding as a dependency
This is the method I use in my mods. It makes it slightly easier to manage versions as you aren't bundling anything.

Open your build.gradle file and add the following code:
repositories {
  ivy {
	name = "ComputerCraft"
	artifactPattern "http://addons-origin.cursecdn.com/files/2269/339/[module][revision](.[ext])"
  }
}

dependencies {
  compile "ComputerCraft:ComputerCraft:1.75"
}
Please be aware that the version numbers and repository strings are different for different versions of the mods. There is a list of version strings here.



Note, in both cases you may need to install CodeChickenCore: this allows obfuscated mods to run in a deobfuscated environment. Be aware that this is only needed in 1.7.10, Forge for 1.8.9+ does this automatically.

Edited by SquidDev, 20 March 2017 - 11:51 PM.


#3 Kyahne

  • Members
  • 4 posts
  • LocationThe Nether around 24000, 62, 1296

Posted 21 March 2017 - 12:47 AM

@SquidDev, as a sidenote (wiggle is a co-dev of mine), porting between 1.7.10 -> 1.9/1.10/1.11 is actually fairly easy, we made our 1.11 HxCCore and ported back within a few hours to all the versions we have on curse. Render code is the only pain.

Also, on topic, you make an amazingly complete post sir I commend your effort in making the forums requiring less replys to get the job done.
As a fellow developer I thank you as this has helped me out quite a bit (not directly as I know how to gradle etc.. but helping teach someone that helps me since I can't teach...)..

#4 wiggle1000

  • Members
  • 17 posts

Posted 21 March 2017 - 01:33 AM

View PostSquidDev, on 20 March 2017 - 11:49 PM, said:

-SNIP-

Thank you, I'm trying the second method now. Works like a charm! Thank you, thank you! The process for setting these things up isn't well documented.. You're a life saver!

Edited by wiggle1000, 21 March 2017 - 02:02 AM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users