lilmods / kotlin-minecraft-mod-template

A Kotlin Minecraft mod template. Supports both forge & fabric. Includes github CI & CD. Includes cloth config / mod menu. Uses gradle kts and is multi module
The Unlicense
3 stars 0 forks source link

How this template can save you a lot of time

Read the documentation below to know how to initialize your mod from this template. It's fast as you just have to search and replace text.

Don't lose time setting up your project, everything is ready is this template, including:

Versions:

How to use this template for your mods

1. Open project with intelliJ

It should work with other IDE, it only depends on gradle, I did not test it

Load gradle project, it may crash because of SDK errors, in that case:

2. Search & remplace:

Now you can reload gradle project. You should be able to build and run clients. If it's not the case, you renamed something wrong. You can see an example here: https://github.com/lilmods/aim-assistance/commit/44743e66f04cde44ad8ccb9490b680069f874c1d.

Troubleshooting:

If the build below says "passing" and it does not work in your environment, it means that you did something wrong because the CI built the project properly.

If you have an issue, it could be because of:

3. Updating versions

All the versions of libraries are stored in Versions.kt. The file is documented for you to know how to bump versions.

4. Releasing new versions

Put a tag on any branch following this format:

The CD workflows are defined in .github/workflows folder. The release will then be "deployed" on github. In the releases tab, you will see your new version with a changelog that contains everything you did put on CHANGELOG-forge.md (for forge) and CHANGELOG-fabric.md (for fabric).

You can see example of releases published from this repo here https://github.com/lilmods/kotlin-minecraft-mod-template/releases

5. Put the common code in the common module!

If you have common code between forge and fabric, you can put it in the common module (you can rename it if you want). The code will then be packaged in the .jar produced by fabric and forge.

6. The project has a linter

It forced you to follow some conventions. In the root build.gradle.kts, ktlint is imported. You can remove it if you want, in that case, you have to remove the step in the CI workflows .github/workflows. There is an IntelliJ plugin to help you. You also can customize the ktlint configuration by looking on their official documentation.

7. The project automatically builds .jar

Everytime the CI runs and succeed, produced artefacts are stored in the workflow run summary. For example, as you can see in https://github.com/lilmods/kotlin-minecraft-mod-template/actions/runs/5111050925, there is an "Artifacts" block. You can click on it to download the produced .jar files.

8. Fabric specific stuff to know

This project uses Kotlin. However, mixins does not work with Kotlin for now, so it's written in Java. There are some examples. The template uses modmenu & cloth-config to manage the mod settings. Everything is ready.

Run client: execute runClient gradle task.

9. Forge specific stuff to know

The template uses cloth-config to manage the mod settings. Everything is ready.

Run client: execute runClient gradle task

10. Done !

You can delete everything in the readme from this line, you are ready to go, have fun :)

ModName

build fabric build forge release fabric release forge