My own template. Differs from the official template, uses kotlin gradle dsl.
- Change the root project name in settings.gradle.kts
- Read the comments in both gradle buildscripts (first, second) and perform any required modifications
- Change the package name of the main mod class. For example, if you're using the github-based naming convention,
com.github.mnemotechnician.kmmt
should becomecom.github.YOUR_USER_NAME.YOUR_REPO_OR_MOD_NAME
. You may want to use a different convention, tho. - Change the values in mod.hjson
- After uploading the mod to github, add
mindustry-mod
+mindustry-mod-v6
ormindustry-mod-v7
to the repository topics in order for your mod to appear in the mod browser
- Clone the repository (this requires a GitHub account, of course)
- Perform any necessary changes
- Push a commit
- Go to the "actions" tab and click on the latest run block.
If the build was successful, you will see a green indicator and a ZIPPED artifact that contains a .jar file. You should download this artifact and unzip it. This is a github limitation, you can't just upload a file as artifact.
If the build was unsuccessful (in 99% cases that means you made a mistake in code) you can click on the "building" job to see the log and understand what caused the error.
Note: you can use github actions without any limitations in public repositories, but in private repositories the total execution time is limited to 2000 minutes per account (for free plan users)
If you use this approach, I assume you use linux and have the necessary experience in using the terminal
Before building, you have to prepare the environment:
- Make sure you have
git
andd8
(in case of multiplatform building) installed. - run
git clone --depth 0 https//github.com/Mnemotechnician/kotlin-mindustry-mod-template
(replace the user and repo with your ones) - run
cd kotlin-mindustry-mod-template
(or wherever it was cloned into)
Now, you can compile either for desktop only or for both mobile and desktop
- Run
./gradlew release
If you're using an old sdk, it may warn you that several java.util.
, java.time.
and java.nio.
classes that kotlin sdk depends on are missing but you shouldn't care about that: android sdk < 30 doesn't support them. You shouldn't be using them at all: arc provides alternatives for these classes.
In case of succeful building a jar file named compiled-mod-any-platform.jar
(the name depends on jarName string defined in build.gradle.kts) will appear in mod-src/build/libs/.
This file can be used both on android and on desktop.
- Run
./gradlew jarDesktop
Everything is similar to the previous paragraph, except that the file will be named compiled-mod-desktop.jar
and will only be usable on desktop.
You should never upload this file as a release. At least a public one. There's a lot of mobile users in the community and they won't be able to use your mod at all: it will install but will not load