Skip to content

Commit

Permalink
Add property for KFF version
Browse files Browse the repository at this point in the history
  • Loading branch information
Deftu committed Jun 27, 2024
1 parent 9f9765e commit 0c91e5e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ abstract class LoomHelperExtension(

@JvmOverloads
fun useMixinRefMap(namespace: String, file: Boolean = false) {
val mcData = MCData.from(project)
val value = if (file) namespace else "mixins.$namespace.refmap.json"
project.withLoom {
mixin.defaultRefmapName.set(value)
Expand Down Expand Up @@ -139,7 +140,6 @@ abstract class LoomHelperExtension(
val mcData = MCData.from(project)
if (mcData.isPresent) {
val notation = "thedarkcolour:kotlinforforge"
val version = MinecraftInfo.ForgeLike.getKotlinForForgeVersion(mcData.version)

project.repositories {
maven("https://thedarkcolour.github.io/KotlinForForge/")
Expand All @@ -151,7 +151,7 @@ abstract class LoomHelperExtension(
if (mcData.isNeoForge) append("-neoforge")
}

add("implementation", "$finalNotation:$version")
add("implementation", "$finalNotation:${mcData.dependencies.forgeLike.kotlinForForgeVersion}")
}

usingKotlinForForge = true
Expand Down
12 changes: 12 additions & 0 deletions src/main/kotlin/dev/deftu/gradle/utils/MCData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@ class MCDependencies(

}

inner class ForgeLike {

val kotlinForForgeVersion: String
get() {
if (!mcData.isForgeLike) throw LoaderSpecificException(ModLoader.FORGE)

return MinecraftInfo.ForgeLike.getKotlinForForgeVersion(mcData.version)
}

}

inner class Forge {

val forgeVersion: String
Expand Down Expand Up @@ -85,6 +96,7 @@ class MCDependencies(
}

val fabric = Fabric()
val forgeLike = ForgeLike()
val forge = Forge()
val neoForged = NeoForged()

Expand Down

0 comments on commit 0c91e5e

Please sign in to comment.