GithubHelp home page GithubHelp logo

mnemotechnician / kotlin-mindustry-mod-template Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 2.0 179 KB

My own mindustry mod template. Uses kotlin, gradle 7.4.2, kotlin gradle dsl and semi-incremental dexing.

Kotlin 100.00%
mindustry-mod mindustry-mod-v7 mindustry

kotlin-mindustry-mod-template's Introduction

Kotlin mindustry mod template

My own template. Differs from the official template, uses kotlin gradle dsl.

If you're going to use this template, make sure you follow these steps:

  • 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 become com.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 to the repository topics in order for your mod to appear in the mod browser

Building

Via github actions (this is the best variant for beginners)

  1. Clone the repository (this requires a GitHub account, of course)
  2. Perform any necessary changes
  3. Push a commit
  4. 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)

Building locally

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:

  1. Make sure you have git and d8 (in case of multiplatform building) installed.
  2. run git clone --depth 0 https//github.com/Mnemotechnician/kotlin-mindustry-mod-template (replace the user and repo with your ones)
  3. 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

Building a multiplatform jar

  • 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 successful 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.

Building a desktop-only jar

  • 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.