Skip to content

Commit

Permalink
loader: exclude service file on ml9 and only add mixin config on ml9
Browse files Browse the repository at this point in the history
  • Loading branch information
Sychic committed Jun 19, 2024
1 parent 45c0d40 commit 8115193
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/main/kotlin/gg/essential/essential-loader.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ when {

//FIXME: Fix loader not working on ml
platform.isModLauncher -> {
val isML8 = platform.mcVersion < 11700
val relocatedPackage = findProperty("essential.loader.package")?.toString() ?: throw GradleException("""
A package for the Essential loader to be relocated to has not been set.
You need to set `essential.loader.package` in the project's `gradle.properties` file to a package where Essential's loader will be relocated to.
Expand All @@ -49,7 +50,7 @@ when {
essentialLoader.attributes {
attribute(relocationAttribute, true)
}
if (platform.mcVersion < 11700) {
if (isML8) {
"forgeRuntimeLibrary"(essentialLoader("gg.essential:loader-modlauncher8:1.2.2")!!)
} else {
"forgeRuntimeLibrary"(essentialLoader("gg.essential:loader-modlauncher9:1.2.2")!!)
Expand All @@ -58,7 +59,11 @@ when {
tasks {
named<Jar>("jar") {
dependsOn(essentialLoader)
from({ zipTree(essentialLoader.singleFile) })
from({ zipTree(essentialLoader.singleFile) }) {
if (!isML8) {
exclude("**/META-INF/services/**")
}
}
}
register("generateEssentialLoaderMixinConfig") {
val outputFile = file("${layout.buildDirectory}/generated-resources/mixin.stage0.essential-loader.json")
Expand All @@ -75,8 +80,10 @@ when {
}
}
named<ProcessResources>("processResources") {
dependsOn(named("generateEssentialLoaderMixinConfig"))
from(file("${layout.buildDirectory}/generated-resources"))
if (!isML8) {
dependsOn(named("generateEssentialLoaderMixinConfig"))
from(file("${layout.buildDirectory}/generated-resources"))
}
}
}
}
Expand Down

0 comments on commit 8115193

Please sign in to comment.