11import dev.ithundxr.silk.ChangelogText
22
33plugins {
4- id " idea"
5- id " eclipse"
6- id " maven-publish"
7- id " net.neoforged.moddev.legacyforge " version " 2.0.74 "
8- id " me.modmuss50.mod-publish-plugin " version " 0.8.3 "
9- id " dev.ithundxr.silk " version " 0.11.15 "
10- id " net.kyori.blossom " version " 2.1.0 " // https://github.com/KyoriPowered/blossom
11- id " org.jetbrains.gradle.plugin.idea-ext" version " 1.1.8" // https://github.com/JetBrains/gradle-idea-ext-plugin
4+ id( " idea" )
5+ id( " eclipse" )
6+ id( " maven-publish" )
7+ id( " net.kyori.blossom " ) version " 2.1.0 " // https://github.com/KyoriPowered/blossom
8+ id( " dev.ithundxr.silk " ) version " 0.11.15 " // https://github.com/ithundxr/silk
9+ id( " me.modmuss50.mod-publish-plugin " ) version " 0.8.4 " // https://github.com/modmuss50/mod-publish-plugin
10+ id( " net.neoforged.moddev.legacyforge " ) version " 2.0.107 " // https://projects.neoforged.net/neoforged/ModDevGradle
11+ id( " org.jetbrains.gradle.plugin.idea-ext" ) version " 1.1.8" // https://github.com/JetBrains/gradle-idea-ext-plugin
1212}
1313
14- apply from : " ./gradle/java.gradle"
15- apply from : " gradle/property_loader.gradle"
14+ apply( from : " ./gradle/java.gradle" )
15+ apply( from : " gradle/property_loader.gradle" )
1616
17- boolean dev = System . getenv(' RELEASE' ) == null || System . getenv(' RELEASE' ) . equals( ' false' )
18- ext. buildNumber = System . getenv(' BUILD_NUMBER' )
19- String gitHash = " ${ calculateGitHash() + (hasUnstaged() ? "-modified" : "")} "
17+ boolean dev = System . getenv(" RELEASE" ) == null || System . getenv(" RELEASE" ) == " false"
18+ ext. buildNumber = System . getenv(" BUILD_NUMBER" )
19+ String gitHash = calculateGitHash() + (hasUnstaged() ? " -modified" : " " )
2020
2121base {
2222 archivesName = " create-${ artifact_minecraft_version} "
23- group = ' com.simibubi.create'
24- version = mod_version + (dev && buildNumber != null ? " -${ buildNumber} " : ' ' )
23+ group = " com.simibubi.create"
24+ version = mod_version + (dev && buildNumber != null ? " -${ buildNumber} " : " " )
2525}
2626
27- boolean inMultiModWorkspace = rootProject. hasProperty(' multiModWorkspace.enabled' )
28- boolean ponderInWorkspace = rootProject. hasProperty(' multiModWorkspace.ponder' )
27+ boolean inMultiModWorkspace = rootProject. hasProperty(" multiModWorkspace.enabled" )
28+ boolean ponderInWorkspace = rootProject. hasProperty(" multiModWorkspace.ponder" )
2929
3030if (ponderInWorkspace) {
3131 evaluationDependsOn(" :ponder:Forge" )
3232}
3333
34- project. logger. lifecycle(" MultiModWorkspace ${ inMultiModWorkspace ? ' enabled' : ' disabled' } for project ${ project.name} ." )
34+ project. logger. lifecycle(" MultiModWorkspace ${ inMultiModWorkspace ? " enabled" : " disabled" } for project ${ project.name} ." )
3535project. logger. lifecycle(" Dependencies included in Workspace: [Ponder: ${ ponderInWorkspace} ]" )
3636
37- def refmap
37+ Provider< RegularFile > refmap
3838mixin {
39- refmap = add sourceSets. main, ' create.refmap.json'
40- config ' create.mixins.json'
39+ refmap = add( sourceSets. main, " create.refmap.json" )
40+ config " create.mixins.json"
4141}
4242
43- println " Java: ${ System.getProperty ' java.version' } , JVM: ${ System.getProperty ' java.vm.version' } (${ System.getProperty ' java.vendor' } ), Arch: ${ System.getProperty ' os.arch' } "
43+ println ( " Java: ${ System.getProperty(" java.version") } , JVM: ${ System.getProperty(" java.vm.version") } (${ System.getProperty(" java.vendor") } ), Arch: ${ System.getProperty(" os.arch") } " )
4444
4545idea {
4646 module {
@@ -55,7 +55,7 @@ legacyForge {
5555 // TODO - Try turning this on later
5656 validateAccessTransformers = false
5757
58- if (file(' src/main/resources/META-INF/accesstransformer.cfg' ). exists()) {
58+ if (file(" src/main/resources/META-INF/accesstransformer.cfg" ). exists()) {
5959 accessTransformers. from " src/main/resources/META-INF/accesstransformer.cfg"
6060 }
6161
@@ -66,59 +66,63 @@ legacyForge {
6666
6767 mods {
6868 create {
69- sourceSet sourceSets. main
69+ sourceSet( sourceSets. main)
7070 }
7171
7272 if (ponderInWorkspace) {
7373 ponder {
74- sourceSet project(" :ponder:Common" ). sourceSets. main
75- sourceSet project(" :ponder:Forge" ). sourceSets. main
74+ sourceSet( project(" :ponder:Common" ). sourceSets. main)
75+ sourceSet( project(" :ponder:Forge" ). sourceSets. main)
7676 }
7777 }
7878 }
7979
8080 runs {
8181 // applies to all the run configs below
8282 configureEach {
83- systemProperty ' forge.logging.markers' , ' '
84- systemProperty ' forge.logging.console.level' , ' info'
83+ systemProperty( " forge.logging.markers" , " " )
84+ systemProperty( " forge.logging.console.level" , " info" )
8585 jvmArguments = [" -XX:+IgnoreUnrecognizedVMOptions" , " -XX:+AllowEnhancedClassRedefinition" ]
8686 // jvmArgs("-XX:-OmitStackTraceInFastThrow") // uncomment when you get exceptions with null messages etc
87- // jvmArgs ' -XX:+UnlockCommercialFeatures' // uncomment for profiling
87+ // jvmArgs " -XX:+UnlockCommercialFeatures" // uncomment for profiling
8888
89- systemProperty ' mixin.debug.export' , ' true'
90- systemProperty ' mixin.debug.verbose' , ' true'
89+ systemProperty( " mixin.debug.export" , " true" )
90+ systemProperty( " mixin.debug.verbose" , " true" )
9191
92- programArgument ' -mixin.config=create.mixins.json'
93- programArgument ' -mixin.config=ponder.mixins.json'
92+ programArgument( " -mixin.config=create.mixins.json" )
93+ programArgument( " -mixin.config=ponder.mixins.json" )
9494 }
9595
9696 client {
9797 client()
9898
99- gameDirectory = project. file(' run' )
99+ gameDirectory = project. file(" run" )
100100 }
101101
102102 server {
103103 server()
104104
105- gameDirectory = project. file(' run/server' )
105+ gameDirectory = project. file(" run/server" )
106106 }
107107
108108 data {
109109 data()
110110
111- gameDirectory = project. file(' run' )
112- systemProperty ' forge.logging.markers' , ' REGISTRIES,REGISTRYDUMP'
113- systemProperty ' forge.logging.console.level' , ' debug'
114- programArguments. addAll(" --mod" , mod_id as String , " --all" , " --output" , file(" src/generated/resources/" ). getAbsolutePath(), " --existing" , file(" src/main/resources" ). getAbsolutePath())
111+ gameDirectory = project. file(" run" )
112+ systemProperty(" forge.logging.markers" , " REGISTRIES,REGISTRYDUMP" )
113+ systemProperty(" forge.logging.console.level" , " debug" )
114+ programArguments. addAll(
115+ " --mod" , mod_id as String ,
116+ " --all" ,
117+ " --output" , file(" src/generated/resources/" ). getAbsolutePath(),
118+ " --existing" , file(" src/main/resources" ). getAbsolutePath()
119+ )
115120 }
116121
117122 gameTestServer {
118123 type = " gameTestServer"
119124
120- gameDirectory = project. file(' run/gametest' )
121- // setForceExit false <- FIXME 1.20
125+ gameDirectory = project. file(" run/gametest" )
122126 }
123127 }
124128}
@@ -151,9 +155,6 @@ repositories {
151155
152156dependencies {
153157 modImplementation(jarJar(" com.tterrag.registrate:Registrate:${ registrate_version} " ))
154- jarJar(" net.createmod.ponder:Ponder-Forge-${ minecraft_version} :${ ponder_version} " )
155-
156- implementation(jarJar(" io.github.llamalad7:mixinextras-forge:${ mixin_extras_version} " ))
157158
158159 modCompileOnly(" dev.engine-room.flywheel:flywheel-forge-api-${ flywheel_minecraft_version} :${ flywheel_version} " )
159160 modRuntimeOnly(jarJar(" dev.engine-room.flywheel:flywheel-forge-${ flywheel_minecraft_version} :${ flywheel_version} " ) {
@@ -165,12 +166,13 @@ dependencies {
165166 modRuntimeOnly(" dev.engine-room.vanillin:vanillin-forge-${ flywheel_minecraft_version} :${ vanillin_version} " )
166167
167168 if (ponderInWorkspace) {
168- implementation project(" :ponder:Common" )
169- implementation project(" :ponder:Forge" )
169+ jarJar( implementation( project(" :ponder:Common" )) )
170+ jarJar( implementation( project(" :ponder:Forge" )) )
170171 } else {
171- modImplementation(" net.createmod.ponder:Ponder-Forge-${ minecraft_version} :${ ponder_version} " )
172+ jarJar( modImplementation(" net.createmod.ponder:Ponder-Forge-${ minecraft_version} :${ ponder_version} " ) )
172173 }
173174
175+ implementation(jarJar(" io.github.llamalad7:mixinextras-forge:${ mixin_extras_version} " ))
174176 compileOnly(annotationProcessor(" io.github.llamalad7:mixinextras-common:${ mixin_extras_version} " ))
175177
176178 // modCompileOnly("mezz.jei:jei-${jei_minecraft_version}-common-api:${jei_version}")
@@ -196,11 +198,13 @@ dependencies {
196198
197199 // Compile only because architectury breaks packets
198200 modCompileOnly(" dev.architectury:architectury-forge:9.1.12" )
199- modCompileOnly(" dev.ftb.mods:ftb-chunks-forge:2001.3.1 " )
200- modCompileOnly(" dev.ftb.mods:ftb-teams-forge:2001.3.0 " )
201- modCompileOnly(" dev.ftb.mods:ftb-library-forge:2001.2 .4" )
201+ modCompileOnly(" dev.ftb.mods:ftb-chunks-forge:2001.1.4 " )
202+ modCompileOnly(" dev.ftb.mods:ftb-teams-forge:2001.1.4 " )
203+ modCompileOnly(" dev.ftb.mods:ftb-library-forge:2001.1 .4" )
202204
203205 modImplementation(" curse.maven:journeymap-32274:5457831" )
206+ // Compile only to prevent there from being multiple map mods in the dev env
207+ modCompileOnly(" curse.maven:xaeros-world-map-317780:6212636" )
204208 // modImplementation("ignored:journeymap-1.20.1-5.10.1-forge")
205209
206210 // modRuntimeOnly("curse.maven:framedblocks-441647:5399211")
@@ -241,21 +245,22 @@ dependencies {
241245 // https://discord.com/channels/313125603924639766/725850371834118214/910619168821354497
242246 // Prevent Mixin annotation processor from getting into IntelliJ's annotation processor settings
243247 // This allows 'Settings > Build, Execution, and Deployment > Build Tools > Gradle > Build and run using' set to IntelliJ to work correctly
244- if (! Boolean . getBoolean(' idea.sync.active' )) {
248+ if (! Boolean . getBoolean(" idea.sync.active" )) {
245249 annotationProcessor " org.spongepowered:mixin:0.8.5:processor"
246250 }
247251}
248252
249253sourceSets. main {
250254 java {
251255 if (! cc_tweaked_enable. toBoolean()) {
252- exclude ' com/simibubi/create/compat/computercraft/implementation/**'
256+ exclude " com/simibubi/create/compat/computercraft/implementation/**"
253257 }
254258 }
255259
256260 resources {
257- srcDir ' src/generated/resources'
258- exclude ' .cache/'
261+ srcDir(" src/generated/resources" )
262+ exclude(" .cache/" )
263+ exclude(" data/create/.wiki" )
259264 }
260265
261266 blossom. javaSources {
@@ -265,23 +270,27 @@ sourceSets.main {
265270}
266271
267272processResources {
268- def buildProps = project. properties. clone()
273+ var replaceProperties = [
274+ mod_id : mod_id,
275+ mod_name : mod_name,
276+ mod_author : mod_author,
277+ mod_description : mod_description,
278+ mod_license : mod_license,
279+ ]
269280
270281 // Replaces FML's magic file.jarVersion string with the correct version at build time.
271- buildProps . put(' file' , [jarVersion : project. version])
282+ replaceProperties . put(" file" , [jarVersion : project. version])
272283
273- filesMatching([' META-INF/mods.toml' , ' pack.mcmeta ' ]) {
274- expand buildProps
284+ filesMatching([" META-INF/mods.toml" ]) {
285+ expand(replaceProperties)
275286 }
276287}
277288
278- compileJava {
279- options. compilerArgs = [' -Xdiags:verbose' ]
280- }
281-
282289jar {
283- from(' LICENSE' ) {
284- rename { " ${ it} _${ archivesBaseName} " }
290+ String name = base. archivesName. get()
291+
292+ from(" LICENSE" ) {
293+ rename { " ${ it} _${ name} " }
285294 }
286295
287296 manifest. attributes([
@@ -332,7 +341,7 @@ project.publishing {
332341 }
333342 }
334343
335- if (project. hasProperty(' mavendir' )) {
344+ if (project. hasProperty(" mavendir" )) {
336345 maven { url mavendir }
337346 }
338347 }
@@ -342,7 +351,7 @@ publishMods {
342351 file = reobfJar. archiveFile
343352 changelog = ChangelogText . getChangelogText(project). toString()
344353 type = STABLE
345- version = " $minecraft_version -$mod_version "
354+ version = " mc $minecraft_version -$mod_version "
346355 displayName = " $mod_name $mod_version for mc$minecraft_version "
347356 modLoaders. add(" forge" )
348357 modLoaders. add(" neoforge" )
@@ -358,11 +367,22 @@ publishMods {
358367 projectId = " LNytGWDc"
359368 minecraftVersions. add(minecraft_version)
360369 }
370+
371+ github {
372+ accessToken = providers. environmentVariable(" GITHUB_TOKEN" )
373+ repository = " Creators-of-Create/Create"
374+ commitish = gitHash
375+ tagName = " mc$minecraft_version -$mod_version "
376+ file. unset()
377+ file. unsetConvention()
378+
379+ allowEmptyFiles = true
380+ }
361381}
362382
363383String calculateGitHash () {
364384 try {
365- def output = providers. exec {
385+ ExecOutput output = providers. exec {
366386 commandLine(" git" , " rev-parse" , " HEAD" )
367387 }
368388 return output. standardOutput. asText. get(). trim()
@@ -373,7 +393,7 @@ String calculateGitHash() {
373393
374394boolean hasUnstaged () {
375395 try {
376- def output = providers. exec {
396+ ExecOutput output = providers. exec {
377397 commandLine(" git" , " status" , " --porcelain" )
378398 }
379399 String result = output. standardOutput. asText. get(). replace(" /M gradlew(\\ .bat)?/" , " " ). trim()
0 commit comments