mod/toml version != jar version

This commit is contained in:
YuRaNnNzZZ 2023-10-23 00:13:26 +03:00
parent a70e1f30bd
commit 294a402447
Signed by: YuRaNnNzZZ
GPG Key ID: 5F71738C85A6006D
3 changed files with 24 additions and 16 deletions

View File

@ -48,14 +48,12 @@ data class GitInfo(val version: String, val tag: String, val buildNumber: String
} }
val modVersion: String get() { val modVersion: String get() {
if (tag != "") val version = if (buildNumber != "") "$mod_version.$buildNumber" else mod_version
return mod_version
if (version != "") { if (tag != "")
return "$mod_version-SNAPSHOT-$version" return version
} else {
return "$mod_version-SNAPSHOT" return "$version-SNAPSHOT"
}
} }
} }
@ -341,6 +339,19 @@ tasks.jar.configure {
archiveVersion.set(gitVersion.jarName) archiveVersion.set(gitVersion.jarName)
} }
tasks.withType(ProcessResources::class.java) {
val replaceProperties = mapOf(
"mc_version" to mc_version,
"mod_id" to mod_id,
"mod_version" to gitVersion.modVersion
)
inputs.properties(replaceProperties)
filesMatching(arrayListOf("META-INF/mods.toml", "pack.mcmeta")) {
expand(replaceProperties)
}
}
tasks { tasks {
create("sourceJar", org.gradle.jvm.tasks.Jar::class.java) { create("sourceJar", org.gradle.jvm.tasks.Jar::class.java) {
archiveClassifier.set("sources") archiveClassifier.set("sources")

View File

@ -15,11 +15,9 @@ license="2 Clause BSD"
# A list of mods - how many allowed here is determined by the individual mod loader # A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory [[mods]] #mandatory
# The modid of the mod # The modid of the mod
modId="overdrive_that_matters" #mandatory modId="${mod_id}" #mandatory
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it # The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
# ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata version="${mod_version}" #mandatory
# see the associated build.gradle script for how to populate this completely automatically during a build
version="${file.jarVersion}" #mandatory
# A display name for the mod # A display name for the mod
displayName="Overdrive That Matters" #mandatory displayName="Overdrive That Matters" #mandatory
# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/ # A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
@ -37,7 +35,7 @@ description='''
Matter. Energy. Combined. Matter. Energy. Combined.
''' '''
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. # A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies.overdrive_that_matters]] #optional [[dependencies.${mod_id}]] #optional
# the modid of the dependency # the modid of the dependency
modId="forge" #mandatory modId="forge" #mandatory
# Does this dependency have to exist - if not, ordering below must be specified # Does this dependency have to exist - if not, ordering below must be specified
@ -49,7 +47,7 @@ Matter. Energy. Combined.
# Side this dependency is applied on - BOTH, CLIENT or SERVER # Side this dependency is applied on - BOTH, CLIENT or SERVER
side="BOTH" side="BOTH"
# Here's another dependency # Here's another dependency
[[dependencies.overdrive_that_matters]] [[dependencies.${mod_id}]]
modId="minecraft" modId="minecraft"
mandatory=true mandatory=true
# This version range declares a minimum of the current minecraft version up to but not including the next major version # This version range declares a minimum of the current minecraft version up to but not including the next major version

View File

@ -1,7 +1,6 @@
{ {
"pack": { "pack": {
"description": "Overdrive That Matters Resources", "description": "${mod_id} resources",
"pack_format": 6, "pack_format": 18
"_comment": "A pack_format of 6 requires json lang files and some texture changes from 1.16.2. Note: we require v6 pack meta for all mods."
} }
} }