Skip to content

Commit 678586a

Browse files
committed
loader/ml9: create mod name marker txt
1 parent e5b2c4c commit 678586a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/main/kotlin/gg/essential/essential-loader.gradle.kts

+16
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,26 @@ when {
9494
""".trimIndent())
9595
}
9696
}
97+
register("generateModNameMarker") {
98+
val modName = findProperty("essential.loader.modName")?.toString() ?: throw GradleException("""
99+
A mod name has not been set.
100+
You need to set `essential.loader.modName` in the project's `gradle.properties` file to the name of your mod.
101+
For example: `essential.loader.modName=Cool Mod`
102+
""".trimIndent())
103+
val outputFile = file("${layout.buildDirectory}/generated-resources/essential-loader-mod-name.txt")
104+
outputs.file(outputFile)
105+
doLast {
106+
outputFile.writeText(modName)
107+
}
108+
}
97109
named<ProcessResources>("processResources") {
98110
if (!isML8) {
99111
dependsOn(named("generateEssentialLoaderMixinConfig"))
100112
from(file("${layout.buildDirectory}/generated-resources/mixin.stage0.essential-loader.json"))
113+
dependsOn(named("generateModNameMarker"))
114+
from(file("${layout.buildDirectory}/generated-resources/essential-loader-mod-name.txt")) {
115+
into("META-INF")
116+
}
101117
}
102118
}
103119
}

0 commit comments

Comments
 (0)