Skip to content

Commit

Permalink
kotlinify
Browse files Browse the repository at this point in the history
  • Loading branch information
BluCobalt committed Feb 7, 2024
1 parent a38f97c commit 5ccd33e
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 16 deletions.
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id "fabric-loom" version "1.5-SNAPSHOT"
id "legacy-looming" version "1.5-SNAPSHOT" // Version must be the same as fabric-loom's
id "maven-publish"
id "org.jetbrains.kotlin.jvm"
}

base.archivesName = project.archives_base_name
Expand Down Expand Up @@ -33,6 +34,8 @@ dependencies {

// You can retrieve a specific api module using this notation.
// modImplementation(legacy.apiModule("legacy-fabric-item-groups-v1", project.fabric_version))

modImplementation "net.fabricmc:fabric-language-kotlin:${project.fabric_language_kotlin_version}"
}

processResources {
Expand Down Expand Up @@ -84,3 +87,5 @@ publishing {
// mavenLocal()
}
}

compileKotlin.kotlinOptions.jvmTarget = "1.8"
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ org.gradle.jvmargs=-Xmx1G
# Legacy Fabric API
# Also available for mc 1.7.10, 1.8, 1.9.4, 1.10.2, 1.11.2 and 1.12.2
fabric_version = 1.9.1+1.8.9
fabric_language_kotlin_version = 1.10.17+kotlin.1.9.22
kotlin_version = 1.9.22

# Mod Properties
mod_version = 1.0.0
Expand Down
3 changes: 3 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ pluginManagement {
}
gradlePluginPortal()
}
plugins {
id "org.jetbrains.kotlin.jvm" version kotlin_version
}
}
14 changes: 0 additions & 14 deletions src/main/java/net/fabricmc/example/ExampleMod.java

This file was deleted.

12 changes: 12 additions & 0 deletions src/main/kotlin/net/fabricmc/example/ExampleModKt.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package net.fabricmc.example

import net.fabricmc.api.ModInitializer


// if you wish for a different type of entrypoint, check the documentation here: https://github.com/FabricMC/fabric-language-kotlin?tab=readme-ov-file#entrypoint-samples

class ExampleModKt : ModInitializer {
override fun onInitialize() {
println("Hello Fabric world!")
}
}
8 changes: 6 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
"environment": "*",
"entrypoints": {
"main": [
"net.fabricmc.example.ExampleMod"
{
"adapter": "kotlin",
"value": "net.fabricmc.example.ExampleModKt"
}
]
},
"mixins": [
Expand All @@ -27,6 +30,7 @@
"minecraft": "1.8.9"
},
"suggests": {
"another-mod": "*"
"another-mod": "*",
"fabric-language-kotlin": ">=1.10.17+kotlin.1.9.22"
}
}

0 comments on commit 5ccd33e

Please sign in to comment.