1- import dev.kikugie.stonecutter.build.StonecutterBuildExtension
2- import me.modmuss50.mpp.ReleaseType
1+ import gg.meza.stonecraft.mod
32
43val kotlinVersion: String by rootProject
5- val modId = project.properties[" mod_id" ].toString()
6- val modName = project.properties[" mod_name" ].toString()
7- val modVersion = project.properties[" mod_version" ].toString()
8- val license = project.properties[" mod_license" ].toString()
9-
10- val publishType = project.properties[" publish.type" ]?.toString()
11- val isBeta = publishType != null && publishType == " beta"
12- val isAlpha = publishType != null && publishType == " alpha"
134
145plugins {
6+ id(" gg.meza.stonecraft" )
157 kotlin(" jvm" )
168 kotlin(" plugin.serialization" )
17-
18- id(" dev.isxander.modstitch.base" )
19- id(" me.modmuss50.mod-publish-plugin" )
20- }
21-
22- base.archivesName = " ${modName} -${stonecutter.modPlatform} "
23- version = " ${stonecutter.minecraftVersion} -${project.properties[" mod_version" ].toString()}${when {
24- isBeta -> " -B"
25- isAlpha -> " -A"
26- else -> " "
27- }} "
28-
29- val StonecutterBuildExtension .modPlatform get() = current.project.substringAfterLast(' -' )
30- val StonecutterBuildExtension .minecraftVersion get() = project.properties[" minecraft_version" ]?.toString() ? : current.project.substringBeforeLast(' -' )
31-
32- val modLoaderVersions = mutableMapOf (
33- " fabric" to mutableMapOf (" loader" to " 0.19.2" , // or can use {mc-ver}-loader
34- " 1.19.2-api" to " 0.77.0+1.19.2" , " 1.20.1-api" to " 0.92.2+1.20.1" , " 1.21-api" to " 0.102.0+1.21" ,
35- " 1.21.1-api" to " 0.116.4+1.21.1" , " 1.21.2-api" to " 0.106.1+1.21.2" , " 1.21.3-api" to " 0.114.1+1.21.3" ,
36- " 1.21.4-api" to " 0.119.4+1.21.4" , " 1.21.5-api" to " 0.128.2+1.21.5" , " 1.21.6-api" to " 0.128.2+1.21.6" ,
37- " 1.21.7-api" to " 0.129.0+1.21.7" , " 1.21.8-api" to " 0.136.1+1.21.8" , " 1.21.9-api" to " 0.134.1+1.21.9" ,
38- " 1.21.10-api" to " 0.138.4+1.21.10" , " 1.21.11-api" to " 0.141.1+1.21.11" , " 26.1-api" to " 0.145.1+26.1"
39- ),
40- // forge is dead lol. no more versions need
41- " forge" to mutableMapOf (" 1.19.2" to " 1.19.2-43.4.2" , " 1.20.1" to " 1.20.1-47.4.3" , " 1.21" to " 1.21-51.0.8" ,),
42- " neoforge" to mutableMapOf (" 1.21" to " 21.0.167" , " 1.21.1" to " 21.1.197" , " 1.21.2" to " 21.2.1-beta" ,
43- " 1.21.3" to " 21.3.95" , " 1.21.4" to " 21.4.156" , " 1.21.5" to " 21.5.96" , " 1.21.6" to " 21.6.20-beta" ,
44- " 1.21.7" to " 21.7.25-beta" , " 1.21.8" to " 21.8.52" , " 1.21.9" to " 21.9.16-beta" , " 1.21.10" to " 21.10.64" ,
45- " 1.21.11" to " 21.11.36-beta" , " 26.1" to " 26.1.0.19-beta"
46- )
47- )
48-
49- val parchmentVersion = mutableMapOf (
50- " 1.19.2" to " 2022.11.27" , " 1.20.1" to " 2023.09.03" , " 1.21" to " 2024.07.28" , " 1.21.1" to " 2024.11.17" ,
51- " 1.21.3" to " 2024.12.07" , " 1.21.4" to " 2025.03.23" , " 1.21.5" to " 2025.06.15" , " 1.21.6" to " 2025.06.29" ,
52- " 1.21.7" to " 2025.07.18" , " 1.21.8" to " 2025.09.14" , " 1.21.9" to " 2025.10.05" , " 1.21.10" to " 2025.10.12"
53- )
54-
55- java.toolchain.languageVersion = JavaLanguageVersion .of(when {
56- stonecutter.eval(stonecutter.minecraftVersion, " >1.21.11" ) -> 25
57- stonecutter.eval(stonecutter.minecraftVersion, " <=1.21.11" ) && stonecutter.eval(stonecutter.minecraftVersion, " >1.19.4" ) -> 21
58- else -> 17
59- })
60-
61- modstitch {
62- minecraftVersion = stonecutter.minecraftVersion
63-
64- loom {
65- val verArr = modLoaderVersions[" fabric" ]!!
66- fabricLoaderVersion = verArr[" ${stonecutter.minecraftVersion} -loader" ]
67- ? : verArr[" loader" ]
68- ? : error(" Failed to find loader version for ${stonecutter.minecraftVersion} on fabric" )
69-
70- configureLoom {
71- mixin.useLegacyMixinAp = false
72- }
73- }
74-
75- moddevgradle {
76- val verArr = modLoaderVersions[" neoforge" ]!!
77- neoForgeVersion = verArr[stonecutter.minecraftVersion] ? : error(" Failed to find loader version for ${stonecutter.minecraftVersion} on neoforge" )
78- }
79-
80- parchmentVersion[stonecutter.minecraftVersion]?.let { ver ->
81- parchment {
82- version = ver
83- }
84- }
85-
86- metadata {
87- modId = project.properties[" mod_id" ].toString()
88- modVersion = project.properties[" mod_version" ].toString()
89- modName = project.properties[" mod_name" ].toString()
90- modGroup = " com.algorithmlx"
91- modLicense = project.properties[" mod_license" ].toString()
92- modDescription = project.properties[" mod_description" ].toString()
93- modCredits = project.properties[" mod_credits" ].toString()
94- modAuthor = project.properties[" mod_authors" ].toString()
95-
96- replacementProperties.put(" mc_version" , stonecutter.minecraftVersion)
97- if (modstitch.isLoom) {
98- val fabricLoader = modLoaderVersions[" fabric" ]!! [" ${stonecutter.minecraftVersion} -loader" ]
99- ? : modLoaderVersions[" fabric" ]!! [" loader" ]
100- ? : error(" Failed to find loader version for ${stonecutter.minecraftVersion} on fabric" )
101- val flkVersion = project.properties[" flk_version" ].toString()
102-
103- replacementProperties.put(" fabric_loader" , fabricLoader)
104- replacementProperties.put(" java_version" , project.java.toolchain.languageVersion.toString())
105- replacementProperties.put(" fabric_api" , modLoaderVersions[" fabric" ]!! [" ${stonecutter.minecraftVersion} -api" ]!! )
106- replacementProperties.put(" flk_version" , " $flkVersion +kotlin.$kotlinVersion " )
107- } else {
108- val klfVersion = project.properties[" klf_version" ].toString()
109- replacementProperties.put(" neoforge_version" , modLoaderVersions[" neoforge" ]!! [stonecutter.minecraftVersion]!! )
110- replacementProperties.put(" klf_version" , klfVersion)
111- }
112- }
113-
114- mixin {
115- addMixinsToModManifest = true
116- configs.register(modId)
117- }
1189}
11910
12011repositories {
@@ -123,83 +14,22 @@ repositories {
12314}
12415
12516dependencies {
126- if (modstitch.isLoom ) {
17+ if (mod.isFabric ) {
12718 val flkVersion = project.properties[" flk_version" ].toString()
128- if (stonecutter.eval(stonecutter.minecraftVersion, " <=1.21.11" )) {
129- " modImplementation" (" net.fabricmc.fabric-api:fabric-api:${modLoaderVersions[" fabric" ]!! [" ${stonecutter.minecraftVersion} -api" ]} " )
130- " modImplementation" (" net.fabricmc:fabric-language-kotlin:$flkVersion +kotlin.$kotlinVersion " )
131- } else {
132- implementation(" net.fabricmc.fabric-api:fabric-api:${modLoaderVersions[" fabric" ]!! [" ${stonecutter.minecraftVersion} -api" ]} " )
133- implementation(" net.fabricmc:fabric-language-kotlin:$flkVersion +kotlin.$kotlinVersion " )
134- }
19+ modCompileClasspath(" net.fabricmc:fabric-language-kotlin:$flkVersion +kotlin.$kotlinVersion " )
13520 } else {
13621 val klfVersion = project.properties[" klf_version" ].toString()
13722 val klfLoaderVersion = project.properties[" klf_loader_version" ].toString()
13823 implementation(" dev.nyon:KotlinLangForge:$klfVersion -k$kotlinVersion -$klfLoaderVersion +neoforge" )
13924 }
14025}
14126
142- stonecutter {
143- constants {
144- put(" fabric" , modstitch.isLoom)
145- put(" neoforge" , modstitch.isModDevGradleRegular)
146- put(" forge" , modstitch.isModDevGradleLegacy)
147- put(" forgelike" , modstitch.isModDevGradle)
148- }
27+ tasks.processResources {
28+ if (mod.isFabric) expand(
29+ " fabric_loader" to mod.prop(" loader_version" ),
30+ " java_version" to java.toolchain.languageVersion.toString(),
31+ " fabric_api" to mod.prop(" fabric_version" ), " flk_version" to " ${mod.prop(" flk_version" )} +kotlin.$kotlinVersion "
32+ )
14933}
15034
151- publishMods {
152- dryRun = false
153-
154- if (project.file(" nopub" ).exists()) {
155- println (" No publish file exists (${project.name} /nopub). Skipping" )
156- return @publishMods
157- }
158- file = modstitch.finalJarTask.flatMap { it.archiveFile }
159-
160- changelog = rootProject.file(" CHANGELOG.md" ).readText()
161-
162- type = when {
163- isBeta -> ReleaseType .BETA
164- isAlpha -> ReleaseType .ALPHA
165- else -> ReleaseType .STABLE
166- }
167-
168- displayName = " [${stonecutter.modPlatform} -${stonecutter.minecraftVersion} ] ${modstitch.metadata.modName.get()} (v.${project.properties[" mod_version" ].toString()} )"
169- modLoaders.add(stonecutter.modPlatform)
17035
171- val modrinthProject: String? = rootProject.properties[" modrinth_project" ]?.toString()
172- val modrinthToken = System .getenv(" MODRINTH_TOKEN" )
173-
174- val curseProject: String? = rootProject.properties[" curseforge_project" ]?.toString()
175- val curseToken = System .getenv(" CURSE_TOKEN" )
176-
177- if (modrinthToken != null && modrinthProject != null ) modrinth {
178- projectId = modrinthProject
179- accessToken = modrinthToken
180-
181- if (modstitch.isLoom)
182- requires(" fabric-api" , " fabric-language-kotlin" )
183- else requires(" kotlin-lang-forge" )
184-
185- minecraftVersions.add(stonecutter.minecraftVersion)
186- }
187-
188- if (curseToken != null && curseProject != null ) curseforge {
189- projectId = curseProject
190- accessToken = curseToken
191-
192- if (modstitch.isLoom)
193- requires(" fabric-api" , " fabric-language-kotlin" )
194- else requires(" kotlinlangforge" )
195-
196- if (stonecutter.minecraftVersion.contains(" snapshot" )) {
197- val modifiedVersion = buildString {
198- val oldVersion = stonecutter.minecraftVersion
199- val splitted = oldVersion.split(" -" )
200- append(splitted[0 ] + " -snapshot" )
201- }
202- minecraftVersions.add(modifiedVersion)
203- } else minecraftVersions.add(stonecutter.minecraftVersion)
204- }
205- }
0 commit comments