@@ -2,43 +2,68 @@ plugins {
22 id(" java-library" )
33 id(" maven-publish" )
44 id(" net.neoforged.gradle.userdev" ) version " 7.0.189"
5+ kotlin(" jvm" )
56}
67
78val mavenGroup: String by project
89val modId: String by project
910val minecraftVersion: String by project
1011val minecraftVersionRange: String by project
12+ val parchmentVersion: String by project
1113val neoVersion: String by project
1214val neoVersionRange: String by project
1315val modName: String by project
1416val modLicense: String by project
1517val modVersion: String by project
1618val modAuthors: String by project
1719val modDescription: String by project
20+ val kotlinForForgeVersion: String by project
1821
1922repositories {
23+ maven {
24+ name = " Kotlin for Forge"
25+ url = uri(" https://thedarkcolour.github.io/KotlinForForge/" )
26+ content { includeGroup(" thedarkcolour" )}
27+ }
2028 // Add here additional repositories if required by some of the dependencies below.
2129}
2230
2331base {
24- archivesName = modId
32+ archivesName = " $ modId- $minecraftVersion -neoforge- $modVersion "
2533}
2634
2735// Mojang ships Java 21 to end users starting in 1.20.5, so mods should target Java 21.
2836java {
29- sourceCompatibility = JavaVersion .VERSION_21
30- targetCompatibility = JavaVersion .VERSION_21
37+ toolchain {
38+ languageVersion = JavaLanguageVersion .of(21 )
39+ }
40+ }
41+
42+ tasks.withType< org.jetbrains.kotlin.gradle.tasks.KotlinCompile > ().configureEach {
43+ compilerOptions {
44+ jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget .JVM_21 )
45+ }
3146}
3247
48+
3349// minecraft.accessTransformers.file rootProject.file("src/main/resources/META-INF/accesstransformer.cfg")
3450// minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager
3551
52+ // minecraftVersion is also a variable name used by the parchment plugin.
53+ val outerMinecraftVersion = minecraftVersion
54+ subsystems {
55+ parchment {
56+ addRepository(false )
57+ parchmentArtifact(" org.parchmentmc.data:parchment-${outerMinecraftVersion} :${parchmentVersion} " )
58+ }
59+ }
60+
3661// Default run configurations.
3762// These can be tweaked, removed, or duplicated as needed.
3863runs {
3964 // applies to all the run configs below
4065 configureEach {
41- // Recommended logging data for a userdev environment
66+ // Recommended logging data for an userdev environment
4267 // The markers can be added/remove as needed separated by commas.
4368 // "SCAN": For mods scan.
4469 // "REGISTRIES": For firing of registry events.
@@ -123,8 +148,8 @@ dependencies {
123148 // Example mod dependency using a file as dependency
124149 // implementation files("libs/coolmod-${mc_version}-${coolmod_version}.jar")
125150
126- // Example project dependency using a sister or child project:
127- // implementation project(":myproject ")
151+ implementation( project( " :common " ))
152+ implementation( " thedarkcolour:kotlinforforge-neoforge: $kotlinForForgeVersion " )
128153
129154 // For more info:
130155 // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
@@ -149,9 +174,7 @@ tasks.withType<ProcessResources>().configureEach {
149174 " mod_description" to modDescription,
150175 )
151176 inputs.properties(replaceProperties)
152- filesMatching(" META-INF/neoforge.mods.toml" ) {
153- expand(replaceProperties)
154- }
177+ expand(replaceProperties)
155178}
156179
157180// Example configuration to allow publishing using the maven-publish plugin
0 commit comments