@@ -5,16 +5,17 @@ plugins {
55 id(" net.fabricmc.fabric-loom-remap" ) version " 1.14-SNAPSHOT"
66 id(" org.jetbrains.kotlin.jvm" ) version " 2.3.0"
77 id(" dev.deftu.gradle.bloom" ) version " 0.2.0"
8+ id(" me.modmuss50.mod-publish-plugin" ) version " 1.1.0"
89}
910
1011val modid = property(" mod.id" )
1112val modname = property(" mod.name" )
1213val modversion = property(" mod.version" )
13- val mcversion = property(" minecraft_version" )
14+ val mcversion = stonecutter.current.version
15+ val oneconfigversion = property(" oneconfig_version" )
1416
15- base {
16- archivesName.set(property(" mod.id" ) as String )
17- }
17+ version = " $modversion +$mcversion "
18+ base.archivesName = modname.toString()
1819
1920repositories {
2021 maven(" https://maven.parchmentmc.org" )
@@ -33,27 +34,22 @@ loom {
3334}
3435
3536dependencies {
36- minecraft(" com.mojang:minecraft:${property( " minecraft_version " )} " )
37+ minecraft(" com.mojang:minecraft:$mcversion " )
3738 @Suppress(" UnstableApiUsage" )
3839 mappings(loom.layered {
3940 officialMojangMappings()
4041 optionalProp(" ${property(" parchment_version" )} " ) {
41- parchment(" org.parchmentmc.data:parchment-${property( " minecraft_version " )} :$it @zip" )
42+ parchment(" org.parchmentmc.data:parchment-$mcversion :$it @zip" )
4243 }
4344 optionalProp(" ${property(" yalmm_version" )} " ) {
44- mappings(" dev.lambdaurora:yalmm-mojbackward:${property( " minecraft_version " )} +build.$it " )
45+ mappings(" dev.lambdaurora:yalmm-mojbackward:$mcversion +build.$it " )
4546 }
4647 })
4748 modImplementation(" net.fabricmc:fabric-loader:${property(" loader_version" )} " )
48- modImplementation(" org.polyfrost.oneconfig:${property(" minecraft_version" )} -fabric:1.0.0-alpha.181" )
49- modImplementation(" org.polyfrost.oneconfig:commands:1.0.0-alpha.181" )
50- modImplementation(" org.polyfrost.oneconfig:config:1.0.0-alpha.181" )
51- modImplementation(" org.polyfrost.oneconfig:config-impl:1.0.0-alpha.181" )
52- modImplementation(" org.polyfrost.oneconfig:events:1.0.0-alpha.181" )
53- modImplementation(" org.polyfrost.oneconfig:internal:1.0.0-alpha.181" )
54- modImplementation(" org.polyfrost.oneconfig:ui:1.0.0-alpha.181" )
55- modImplementation(" org.polyfrost.oneconfig:utils:1.0.0-alpha.181" )
56- modImplementation(" org.polyfrost.oneconfig:hud:1.0.0-alpha.181" )
49+ modImplementation(" org.polyfrost.oneconfig:$mcversion -fabric:$oneconfigversion " )
50+ for (module in arrayOf(" config" , " config-impl" , " internal" , " ui" )) {
51+ implementation(" org.polyfrost.oneconfig:$module :$oneconfigversion " )
52+ }
5753}
5854
5955bloom {
@@ -101,4 +97,31 @@ tasks.jar {
10197}
10298
10399fun <T > optionalProp (property : String , block : (String ) -> T ? ): T ? =
104- findProperty(property)?.toString()?.takeUnless { it.isBlank() }?.let (block)
100+ findProperty(property)?.toString()?.takeUnless { it.isBlank() }?.let (block)
101+
102+ val modrinthId = findProperty(" publish.modrinth" )?.toString()?.takeIf { it.isNotBlank() }
103+
104+ // make sure modrinth.token is set in your user gradle properties
105+ publishMods {
106+ file = project.tasks.remapJar.get().archiveFile
107+
108+ displayName = modversion.toString()
109+ version = " v$modversion "
110+ changelog = project.rootProject.file(" CHANGELOG.md" ).takeIf { it.exists() }?.readText() ? : " No changelog provided."
111+ type = ALPHA
112+
113+ modLoaders.add(" fabric" )
114+
115+ dryRun = modrinthId == null
116+
117+ if (modrinthId != null ) {
118+ modrinth {
119+ projectId = property(" publish.modrinth" ).toString()
120+ accessToken = findProperty(" modrinth.token" ).toString()
121+
122+ minecraftVersions.add(mcversion)
123+
124+ requires(" oneconfig" )
125+ }
126+ }
127+ }
0 commit comments