A gradle modding setup with an example mod to be used for modding Rock Bottom
To set up an environment to make a mod, simply do the following:
(Note: This setup was created mainly for IntelliJ IDEA and may not work for Eclipse or other IDEs.)
-
Download this repository as a zip or fork and clone it
-
Import the gradle project into your IDE
- For IntelliJ, simply use
File
Open...
and select thebuild.gradle
file to import the project.
In the window that opens, unselectCreate separate module per source set
. Leave everything else as is.
- For IntelliJ, simply use
-
If you don't see existing run configurations in the project, run the gradle tasks
createIntelliJRuns
orcreateEclipseRuns
for IntelliJ or Eclipse, respectively. This will create a run configuration that you can use to test your mod. -
Put a compiled jar of the game into the
/gamedata
folder (you might have to create it first) that will then be used when launching the run configurations.- You might have to refresh the gradle project in your IDE after doing this step for it to take effect
-
Set your IDE's compile output path to
/build/classes
- For IntelliJ, simply use
File
Project Structure
Project
and set theProject compiler output
option to the above
- For IntelliJ, simply use
To make a jar containing your mod that you can then put into the /mods
folder of your game instance, simple do the following:
-
Run the gradle task
gradlew build
to compile a mod jar -
You can then find the jar in
/build/libs
There are some issues you might run into when setting up or using the modding environment. Here are some solutions:
This might have happened if you ran your game before changing the example mod files to be your mod's files instead. This means that gradle's compile output path still contains the example mod files. To resolve this, simply run the gradle task clean
and it will remove the remaining example mod files from the output path.