For testing in the dev env, you can use the gradle runLoader
task
For building, the usual gradle buildBundleJar
task can be used. The output will be in the build/libs/
folder
This Puzzle-Loader module add Kotlin Language Support
Step 1: Add Jitpack in your build.gradle at the end of your repositories tag.
Here is an example repositories
section
repositories {
maven { url 'https://jitpack.io' }
mavenCentral()
}
Step 2: Add PuzzleLanguageKotlin to your dependencies using the text below
mod "com.github:PuzzleLoader:puzzle-language-kotlin:1.0.0"
or
implementation "com.github:PuzzleLoader:puzzle-language-kotlin:1.0.0"
Use the kotlin
adapter for your mod by setting the adapter
property in the puzzle.mod.json
file.
Remember to the add a dependency entry to your puzzle.mod.json
file:
{
"entrypoints": {
"main": [
{
"adapter": "kotlin",
"value": "package.ClassName"
}
]
},
"depends": {
"puzzle-language-kotlin": ">=1.0.0"
}
}
Kind | Class reference | Function reference | Field reference |
---|---|---|---|
class |
{
"adapter": "kotlin",
"value": "mymod.MyMod"
} package mymod
class MyMod : ModInitializer {
override fun onInitialize() {
TODO()
}
} |
||
object |
{
"adapter": "kotlin",
"value": "mymod.MyMod"
} package mymod
object MyMod : ModInitializer {
override fun onInitialize() {
TODO()
}
} |
{
"adapter": "kotlin",
"value": "mymod.MyMod::init"
} package mymod
object MyMod {
fun init() {
TODO()
}
} |
{
"adapter": "kotlin",
"value": "mymod.MyMod::initializer"
} package mymod
object MyMod {
val initializer = ModInitializer {
TODO()
}
} |
companion object |
{
"adapter": "kotlin",
"value": "mymod.MyMod$Companion"
} package mymod
class MyMod {
companion object : ModInitializer {
override fun onInitialize() {
TODO()
}
}
} |
{
"adapter": "kotlin",
"value": "mymod.MyMod$Companion::init"
} package mymod
class MyMod {
companion object {
fun init() {
TODO()
}
}
} |
{
"adapter": "kotlin",
"value": "mymod.MyMod$Companion::initializer"
} package mymod
class MyMod {
companion object {
val initializer = ModInitializer {
TODO()
}
}
} |
top level |
{
"adapter": "kotlin",
"value": "mymod.MyModKt::init"
} File: package mymod
fun init() {
TODO()
} |
Companion objects can be used by appending $Companion
to the class.
Take care of processResources
there, it might try to expand it, in that case escape it.
org.jetbrains.kotlin
namespace:
org.jetbrains.kotlinx
namespace: