blob: 5286523b42fa76c36d1e8a3140c36c01630fcee9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# 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](https://github.com/thedarkcolour/KotlinModdingSkeleton).
As of Kotlin for Forge 1.4.0, you must use Gradle 5.3 or newer. To update,
go to the file at `./gradle/wrapper/gradle-wrapper.properties` and change this line:
```properties
# Gradle 5.3 or newer. Works fine with ForgeGradle.
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3-all.zip
```
If you aren't sure where to start, make a fork of the KotlinModdingSkeleton repository.
```git
git clone https://github.com/thedarkcolour/KotlinModdingSkeleton.git
```
To implement in an existing project, paste the following into your build.gradle:
```groovy
buildscript {
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10"
}
}
apply plugin: 'kotlin'
repositories {
maven {
name = 'kotlinforforge'
url = 'https://thedarkcolour.github.io/KotlinForForge/'
}
}
dependencies {
// Use the latest version of KotlinForForge
implementation 'thedarkcolour:kotlinforforge:1.6.2'
}
compileKotlin {
kotlinOptions {
jvmTarget = '1.8'
}
}
```
Then, change the following to your mods.toml file:
```toml
modLoader="kotlinforforge"
# Change this if you require a certain version of KotlinForForge
loaderVersion="[1,)"
```
Use
```thedarkcolour.kotlinforforge.forge.MOD_CONTEXT```
instead of ```net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext```
|