Skip to content

Commit 97670bb

Browse files
committed
Modrinth Versioning Support
1 parent 44874e7 commit 97670bb

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

build.gradle

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ def niceWurstRaw =
1717
def niceWurstEnabled = !["0", "false", "off", "no", ""]
1818
.contains(niceWurstRaw.toLowerCase(Locale.ROOT))
1919

20-
def effectiveVersion = project.mod_version
20+
def forkReleaseVersion =
21+
(project.findProperty("fork_release_version") ?: "0.0").toString()
22+
def effectiveVersion = niceWurstEnabled ? forkReleaseVersion
23+
: project.mod_version + "-r" + forkReleaseVersion
2124
def effectiveArchiveName =
2225
niceWurstEnabled ? "NiceWurst" : project.archives_base_name
2326
def modId = niceWurstEnabled ? "nicewurst" : "wurst"
@@ -34,8 +37,6 @@ def issuesUrl =
3437

3538
version = effectiveVersion
3639
group = project.maven_group
37-
def forkReleaseVersion =
38-
(project.findProperty("fork_release_version") ?: "0.0").toString()
3940

4041
def mainModId = niceWurstEnabled ? "nicewurst" : "wurst"
4142

@@ -185,14 +186,18 @@ tasks.named("runClientGameTestWithMods") {
185186
}
186187

187188
processResources {
188-
def modVersion = project.version.substring(1)
189+
def rawVersion = project.version.toString()
190+
def modVersion = rawVersion.startsWith("v") ? rawVersion.substring(1)
191+
: rawVersion
189192
inputs.property("version", modVersion)
190193
inputs.property("modName", modName)
191194
inputs.property("modDescription", modDescription)
192195
inputs.property("homepageUrl", homepageUrl)
193196
inputs.property("sourcesUrl", sourcesUrl)
194197
inputs.property("issuesUrl", issuesUrl)
195198
inputs.property("modId", modId)
199+
def modrinthProjectId = niceWurstEnabled ? "V5aiZX0p" : ""
200+
inputs.property("modrinthProjectId", modrinthProjectId)
196201

197202
filesMatching("fabric.mod.json") {
198203
expand([
@@ -202,7 +207,8 @@ processResources {
202207
modDescription: modDescription,
203208
homepage: homepageUrl,
204209
sources: sourcesUrl,
205-
issues: issuesUrl
210+
issues: issuesUrl,
211+
modrinthProjectId: modrinthProjectId
206212
])
207213
}
208214
}

src/main/resources/fabric.mod.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
"vulkanmod": "*"
4747
},
4848
"custom": {
49+
"modrinth": {
50+
"project-id": "${modrinthProjectId}"
51+
},
4952
"badoptimizations:cache_hooks": {
5053
"lightmap": "net.wurstclient.hacks.fullbright.BadOptimizationsLightmapHook"
5154
},

0 commit comments

Comments
 (0)