diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c399503 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,2 @@ +## 1.1.1-beta.1 +- Full support for 1.21.1-26.1.2 \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index fae1ba8..8e1a947 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,15 +9,18 @@ plugins { id("dev.kikugie.loom-back-compat") id("org.jetbrains.kotlin.jvm") version "2.3.0" id("dev.deftu.gradle.bloom") version "0.2.0" + id("me.modmuss50.mod-publish-plugin") version "1.1.0" } -val modid = property("mod.id") -val modname = property("mod.name") -val modversion = property("mod.version") -val mcversion = property("minecraft_version") +val modid = property("mod.id") as String +val modname = property("mod.name") as String +val modversion = property("mod.version") as String +val mcversion = property("minecraft_version") as String +val versionrange = property("minecraft_version_range") +val loaderversion = property("loader_version") base { - archivesName.set(property("mod.id") as String) + archivesName.set("$modid-$modversion+$mcversion") } repositories { @@ -94,8 +97,8 @@ tasks.processResources { "mod_id" to modid, "mod_name" to modname, "mod_version" to modversion, - "mc_version" to mcversion, - "loader_version" to providers.gradleProperty("loader_version").get() + "minecraft_version_range" to versionrange, + "loader_version" to loaderversion ) inputs.properties(props) @@ -143,3 +146,57 @@ tasks.jar { fun optionalProp(property: String, block: (String) -> T?): T? = findProperty(property)?.toString()?.takeUnless { it.isBlank() }?.let(block) +val modrinthMinecraftVersionOverride = mapOf( + "26.1" to listOf("26.1", "26.1.1", "26.1.2"), + "26.1.1" to listOf("26.1", "26.1.1", "26.1.2"), + "26.1.2" to listOf("26.1", "26.1.1", "26.1.2") +) + +val modrinthId = listOf("oneconfig.publish.modrinth", "publish.modrinth").firstNotNullOfOrNull { findProperty(it) }?.toString()?.takeIf { it.isNotBlank() } +val modrinthToken = listOf("oneconfig.publish.modrinth.token", "publish.modrinth.token", "modrinth.token").firstNotNullOfOrNull { findProperty(it) }?.toString()?.takeIf { it.isNotBlank() } +val minecraftVersion = modrinthMinecraftVersionOverride[mcversion] ?: listOf(mcversion) +val publishJarTaskName = if ("remapJar" in tasks.names) "remapJar" else "jar" +val changelogs = rootProject.file("CHANGELOG.md").takeIf { it.exists() }?.readText() ?: "No changelog provided." + +val validateChangelog by tasks.registering { + description = "Validates that the changelog is written for the current version." + if (!changelogs.contains(modversion)) { + throw GradleException("Changelog for version $modversion not found.") + } +} + +tasks.publishMods.configure { + dependsOn(validateChangelog) +} +tasks.matching { it.name == "publishModrinth" }.configureEach { + dependsOn(validateChangelog) +} + +publishMods { + file = tasks.named(publishJarTaskName).flatMap { it.archiveFile } + + displayName = modversion + version = "v$modversion" + changelog = changelogs + type = BETA + + modLoaders.add("fabric") + + dryRun = modrinthId == null || modrinthToken == null + + if (modrinthId != null) { + modrinth { + projectId = modrinthId + accessToken = modrinthToken.orEmpty() + + minecraftVersions.addAll(minecraftVersion) + + requires("oneconfig") + requires("fabric-language-kotlin") + findProperty("publish.modrinth.compose-bundle") + ?.toString() + ?.takeIf { it.isNotBlank() } + ?.let { requires(it) } + } + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 99b24f5..8b81f11 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,10 @@ mod.name=PolyTime mod.id=polytime -mod.version=1.1.0-alpha.3 +mod.version=1.1.1-beta.1 mod.group=org.polyfrost +publish.modrinth=m3kNp1iP + loomx.loom_version=1.16-SNAPSHOT loader_version=0.19.2 @@ -13,4 +15,4 @@ org.gradle.parallel.threads=4 org.gradle.jvmargs=-Xmx4G # Fix YALMM -fabric.loom.dropNonIntermediateRootMethods=true +fabric.loom.dropNonIntermediateRootMethods=true \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index c8c7281..e42181d 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -24,5 +24,10 @@ "mixins.${mod_id}.json" ], "license": "GPL 3.0", - "environment": "client" + "environment": "client", + "depends": { + "minecraft": "${minecraft_version_range}", + "fabricloader": ">=${loader_version}", + "fabric-language-kotlin": "*" + } } \ No newline at end of file diff --git a/versions/1.21.1/gradle.properties b/versions/1.21.1/gradle.properties index 6c6de24..3d61419 100644 --- a/versions/1.21.1/gradle.properties +++ b/versions/1.21.1/gradle.properties @@ -1,3 +1,4 @@ parchment_version=2024.11.17 yalmm_version=3 minecraft_version=1.21.1 +minecraft_version_range=1.21.1 diff --git a/versions/1.21.10/gradle.properties b/versions/1.21.10/gradle.properties index 09c98a5..8ca8654 100644 --- a/versions/1.21.10/gradle.properties +++ b/versions/1.21.10/gradle.properties @@ -1,3 +1,4 @@ parchment_version=2025.10.12 yalmm_version=3 minecraft_version=1.21.10 +minecraft_version_range=>=1.21.9 <=1.21.10 \ No newline at end of file diff --git a/versions/1.21.11/gradle.properties b/versions/1.21.11/gradle.properties index 2b66964..f227b41 100644 --- a/versions/1.21.11/gradle.properties +++ b/versions/1.21.11/gradle.properties @@ -1,3 +1,4 @@ parchment_version=2025.12.20 yalmm_version=3 -minecraft_version=1.21.11 \ No newline at end of file +minecraft_version=1.21.11 +minecraft_version_range=1.21.11 \ No newline at end of file diff --git a/versions/1.21.4/gradle.properties b/versions/1.21.4/gradle.properties index 2dee9c5..d481494 100644 --- a/versions/1.21.4/gradle.properties +++ b/versions/1.21.4/gradle.properties @@ -1,3 +1,4 @@ parchment_version=2025.03.23 yalmm_version=3 minecraft_version=1.21.4 +minecraft_version_range=1.21.4 diff --git a/versions/1.21.5/gradle.properties b/versions/1.21.5/gradle.properties index cda4312..4ab5b77 100644 --- a/versions/1.21.5/gradle.properties +++ b/versions/1.21.5/gradle.properties @@ -1,3 +1,4 @@ parchment_version=2025.06.15 yalmm_version=3 -minecraft_version=1.21.5 \ No newline at end of file +minecraft_version=1.21.5 +minecraft_version_range=1.21.5 \ No newline at end of file diff --git a/versions/1.21.8/gradle.properties b/versions/1.21.8/gradle.properties index 89bd790..8209a8b 100644 --- a/versions/1.21.8/gradle.properties +++ b/versions/1.21.8/gradle.properties @@ -1,3 +1,4 @@ parchment_version=2025.09.14 yalmm_version=3 minecraft_version=1.21.8 +minecraft_version_range=>=1.21.7 <=1.21.8 \ No newline at end of file diff --git a/versions/26.1/gradle.properties b/versions/26.1/gradle.properties index bb4b398..a187a0a 100644 --- a/versions/26.1/gradle.properties +++ b/versions/26.1/gradle.properties @@ -1,4 +1,5 @@ yalmm_version=3 minecraft_version=26.1 has_official_mappings=false -java_version=25 \ No newline at end of file +java_version=25 +minecraft_version_range=~26.1 \ No newline at end of file