Skip to content

Latest commit

 

History

History
55 lines (47 loc) · 1.92 KB

README.md

File metadata and controls

55 lines (47 loc) · 1.92 KB

KotlinForForge

Makes Kotlin forge-friendly by doing the following:

  • Provides the Kotlin libraries.
  • Provides KotlinLanguageProvider to allow usage of object declarations as @Mod targets.
  • Provides AutoKotlinEventBusSubscriber to allow usage of object declarations as @Mod.EventBusSubscriber targets.
  • Provides useful utility functions and constants
  • Provides its own implementation of the Forge eventbus to work with KCallables and reified type parameters
  • Provides sided property delegates and object holder property delegates

An example mod is provided at the KotlinModdingSkeleton repository.

As of Kotlin for Forge 1.12.0, you must use Gradle 6.8.1 or newer. To update, go to the file at ./gradle/wrapper/gradle-wrapper.properties and change this line:

# Gradle 6.8.1 or newer. Works fine with ForgeGradle 4.
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-all.zip

If you aren't sure where to start, make a fork of the KotlinModdingSkeleton repository.

git clone https://github.com/thedarkcolour/KotlinModdingSkeleton.git

To implement in an existing project, paste the following into your build.gradle:

buildscript {
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"
    }
}

apply plugin: 'kotlin'

repositories {
    maven {
        name = 'kotlinforforge'
        url = 'https://thedarkcolour.github.io/KotlinForForge/'
    }
}

dependencies {
    // Use the latest version of KotlinForForge
    implementation 'thedarkcolour:kotlinforforge:2.0.1'
}

Then, change the following to your mods.toml file:

modLoader="kotlinforforge"
# Change this if you require a certain version of KotlinForForge
loaderVersion="[2,)"

Use thedarkcolour.kotlinforforge.forge.MOD_CONTEXT
instead of net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext