diff --git a/build.gradle.kts b/build.gradle.kts index e6337f1..77e14ad 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,42 +1,52 @@ +var loaderName: String = "fabric" + +var javaVersion: String = property("java_version").toString() +var minecraftVersion: String = property("minecraft_version").toString() +var loaderVersion: String = property("${loaderName}_version").toString() + +var modId: String = property("mod_id").toString() +var modVersion: String = property("mod_version").toString() + +fun getVersionType(version: String): String { + return when { + version.contains("alpha") -> "alpha" + version.contains("beta") -> "beta" + else -> "release" + } +} + plugins { id("java") id("fabric-loom") version "1.6.11" + id("com.modrinth.minotaur") version "2.+" id("idea") } base { - archivesName = "${properties["mod_id"]}-fabric" - version = "${properties["mod_version"]}+mc${properties["minecraft_version"]}" + archivesName = "${modId}-${loaderName}" + version = "${modVersion}+mc${minecraftVersion}" +} + +dependencies { + minecraft("com.mojang:minecraft:${minecraftVersion}") + mappings(loom.officialMojangMappings()) + modImplementation("net.fabricmc:fabric-loader:${loaderVersion}") } java { withSourcesJar() - sourceCompatibility = JavaVersion.valueOf("VERSION_${properties["java_version"]}") - targetCompatibility = JavaVersion.valueOf("VERSION_${properties["java_version"]}") + sourceCompatibility = JavaVersion.valueOf("VERSION_${javaVersion}") + targetCompatibility = JavaVersion.valueOf("VERSION_${javaVersion}") } -dependencies { - minecraft("com.mojang:minecraft:${properties["minecraft_version"]}") - mappings(loom.officialMojangMappings()) - modImplementation("net.fabricmc:fabric-loader:${properties["fabric_version"]}") -} - -tasks { - processResources { - filesMatching("fabric.mod.json") { - expand(project.properties) - } - } - - compileJava { - options.encoding = "UTF-8" - } - - jar { - from("LICENSE") { - rename { "${it}_${project.properties["mod_id"]}" } - } - } +modrinth { + token = System.getenv("MODRINTH_TOKEN") ?: properties["modrinth_token"]?.toString() + projectId = modId + versionName = "${loaderName}@${version}" + versionType = getVersionType(modVersion) + versionNumber = modVersion + uploadFile = tasks.remapJar as Any + additionalFiles = listOf(tasks.remapSourcesJar) } idea { @@ -45,3 +55,21 @@ idea { isDownloadJavadoc = true } } + +tasks { + compileJava { + options.encoding = "UTF-8" + } + + processResources { + filesMatching("*.json") { + expand(project.properties) + } + } + + jar { + from("LICENSE") { + rename { "${it}_${modId}" } + } + } +} diff --git a/src/main/resources/skintypefix.mixins.json b/src/main/resources/skintypefix.mixins.json index e85c430..4b2779c 100644 --- a/src/main/resources/skintypefix.mixins.json +++ b/src/main/resources/skintypefix.mixins.json @@ -4,7 +4,7 @@ "HttpTextureMixin", "SkinManagerMixin" ], - "compatibilityLevel": "JAVA_21", + "compatibilityLevel": "JAVA_${java_version}", "injectors": { "defaultRequire": 1 },