How to install Forge & an external API
- To install Forge
- To be able to use External API's with Forge that don't reobfuscate with your code
- To be able to use Forge Gradle to deobfuscate Minecraft
- Know how to type with a keyboard
- Know how to download files
- A Minecraft account and Minecraft installed
These may not work if the API is a core mod!
A tutorial to explain how to install an API & Forge so that when reobfuscated the API code does not end up mixed in with the source code files when reobfuscating. This tutorial will not explain how to use the API after it is installed.
Here is some links to wiki pages explaining what an API is and what Obfuscation is.
Minecraft 1.7 and Later
Go to the Forge download page and download here. From this page many forge versions can be downloaded. Pick the needed version and download the src version.
After the download has finished extract the zip to your computer wherever is wanted. The Desktop is an easy and visible place to do so. Do not run it yet if you know how to do so.
Including an API or Dependencies
Both methods work however the Basic method is far simpler to use than the Advanced method. For both methods the API added may not appear in game if not used by the project. If just testing for compatibility between mods and not using an API use the mods folder like when normally installing mods.
Inside the Forge folder create a folder named 'lib'. In this folder place all jars on which your mod depends or wish to include inside the workspace. This can be done before or after running gradle however if done after remember to refresh the project or use the IDE to add the API.
Open the file called 'build.gradle' and scroll down to the section called dependencies. It is not the first one you see at the very top.
Define dependencies like 'compile "some.group:artifact:version:classifier"' or 'compile "some.group:artifact:version"' for example 'compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' ' which adds Buildcraft to the development environment.
Open a Command Window where Forge was extracted to. This can done by opening the file and Shift+Right Clicking in the folder and clicking the option "Open command Window here"
In the Command Window run 'gradlew setupDevWorkspace' and let it run until its finished. This will probably take some time.
Now in order to setup your workspace use 'gradlew eclipse' or 'gradlew idea' depending on your IDE of choice
Mac / Linux
Open a Command Window pointing to the folder where Forge was extracted to.
In the Command Window run './gradlew.sh setupDevWorkspace' and let it run until its finished. This will probably take some time.
Now in order to setup your workspace use './gradlew.sh eclipse' or './gradlew.sh idea' depending on your IDE of choice
Minecraft 1.6 and Earlier
You start by getting a fresh MCP as per usual. I assume you know you need to make a backup of your src or just start over in another folder. This includes fresh .jars!
Get a fresh Forge Source zip, and unzip that inside your MCP folder. Don't run the install script just yet.
Inside the 'forge' folder there is a folder called 'src', that's where you need to put the source of the API. Make sure you put the client stuff in the client folder and the server stuff in the server folder!
If you run the install script now, the API will get installed along with forge, and when you run 'reobfuscate' or 'getchangedsrc' the API won't be included.
--Dries007 12:13, 6 August 2012 (PDT)
You should have already downloaded the APIs you need.
Extract the files.
Copy them into MCP/src/minecraft OR/AND MCP/src/common
Move your mod source files to another folder, such as Desktop.
Go to your MCP folder and run the updatemd5 script. (this is very important!)
Put your source back into MCP/src/minecraft OR/AND MCP/src/common
Develop as usual.
--Luacs1998 05:23, 13 August 2012 (PDT)
Updated by: --Shadowlordalpha 12:36, 11 March 2015 (PDT)