1
- // version: 1665425597
1
+ // version: 1667597057
2
2
/*
3
3
DO NOT CHANGE THIS FILE!
4
4
Also, you may replace this file at any time if there is an update available.
5
- Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main /build.gradle for updates.
5
+ Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/master /build.gradle for updates.
6
6
*/
7
7
8
8
@@ -147,17 +147,21 @@ String javaSourceDir = "src/main/java/"
147
147
String scalaSourceDir = " src/main/scala/"
148
148
String kotlinSourceDir = " src/main/kotlin/"
149
149
150
- String targetPackageJava = javaSourceDir + modGroup. toString(). replaceAll(" \\ ." , " /" )
151
- String targetPackageScala = scalaSourceDir + modGroup. toString(). replaceAll(" \\ ." , " /" )
152
- String targetPackageKotlin = kotlinSourceDir + modGroup. toString(). replaceAll(" \\ ." , " /" )
150
+
151
+ final String modGroupPath = modGroup. toString(). replaceAll(" \\ ." , " /" )
152
+ final String apiPackagePath = apiPackage. toString(). replaceAll(" \\ ." , " /" )
153
+
154
+ String targetPackageJava = javaSourceDir + modGroupPath
155
+ String targetPackageScala = scalaSourceDir + modGroupPath
156
+ String targetPackageKotlin = kotlinSourceDir + modGroupPath
153
157
if (! (getFile(targetPackageJava). exists() || getFile(targetPackageScala). exists() || getFile(targetPackageKotlin). exists())) {
154
158
throw new GradleException (" Could not resolve \" modGroup\" ! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
155
159
}
156
160
157
161
if (apiPackage) {
158
- targetPackageJava = javaSourceDir + modGroup . toString() . replaceAll( " \\ . " , " / " ) + " /" + apiPackage . toString() . replaceAll( " \\ . " , " / " )
159
- targetPackageScala = scalaSourceDir + modGroup . toString() . replaceAll( " \\ . " , " / " ) + " /" + apiPackage . toString() . replaceAll( " \\ . " , " / " )
160
- targetPackageKotlin = kotlinSourceDir + modGroup . toString() . replaceAll( " \\ . " , " / " ) + " /" + apiPackage . toString() . replaceAll( " \\ . " , " / " )
162
+ targetPackageJava = javaSourceDir + modGroupPath + " /" + apiPackagePath
163
+ targetPackageScala = scalaSourceDir + modGroupPath + " /" + apiPackagePath
164
+ targetPackageKotlin = kotlinSourceDir + modGroupPath + " /" + apiPackagePath
161
165
if (! (getFile(targetPackageJava). exists() || getFile(targetPackageScala). exists() || getFile(targetPackageKotlin). exists())) {
162
166
throw new GradleException (" Could not resolve \" apiPackage\" ! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
163
167
}
@@ -171,31 +175,36 @@ if (accessTransformersFile) {
171
175
}
172
176
173
177
if (usesMixins. toBoolean()) {
174
- if (mixinsPackage. isEmpty() || mixinPlugin . isEmpty() ) {
175
- throw new GradleException (" \" mixinPlugin \" requires \" mixinsPackage\" and \" mixinPlugin \" to be set!" )
178
+ if (mixinsPackage. isEmpty()) {
179
+ throw new GradleException (" \" usesMixins \" requires \" mixinsPackage\" to be set!" )
176
180
}
181
+ final String mixinPackagePath = mixinsPackage. toString(). replaceAll(" \\ ." , " /" )
182
+ final String mixinPluginPath = mixinPlugin. toString(). replaceAll(" \\ ." , " /" )
177
183
178
- targetPackageJava = javaSourceDir + modGroup . toString() . replaceAll( " \\ . " , " / " ) + " /" + mixinsPackage . toString() . replaceAll( " \\ . " , " / " )
179
- targetPackageScala = scalaSourceDir + modGroup . toString() . replaceAll( " \\ . " , " / " ) + " /" + mixinsPackage . toString() . replaceAll( " \\ . " , " / " )
180
- targetPackageKotlin = kotlinSourceDir + modGroup . toString() . replaceAll( " \\ . " , " / " ) + " /" + mixinsPackage . toString() . replaceAll( " \\ . " , " / " )
184
+ targetPackageJava = javaSourceDir + modGroupPath + " /" + mixinPackagePath
185
+ targetPackageScala = scalaSourceDir + modGroupPath + " /" + mixinPackagePath
186
+ targetPackageKotlin = kotlinSourceDir + modGroupPath + " /" + mixinPackagePath
181
187
if (! (getFile(targetPackageJava). exists() || getFile(targetPackageScala). exists() || getFile(targetPackageKotlin). exists())) {
182
188
throw new GradleException (" Could not resolve \" mixinsPackage\" ! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
183
189
}
184
190
185
- String targetFileJava = javaSourceDir + modGroup. toString(). replaceAll(" \\ ." , " /" ) + " /" + mixinPlugin. toString(). replaceAll(" \\ ." , " /" ) + " .java"
186
- String targetFileScala = scalaSourceDir + modGroup. toString(). replaceAll(" \\ ." , " /" ) + " /" + mixinPlugin. toString(). replaceAll(" \\ ." , " /" ) + " .scala"
187
- String targetFileScalaJava = scalaSourceDir + modGroup. toString(). replaceAll(" \\ ." , " /" ) + " /" + mixinPlugin. toString(). replaceAll(" \\ ." , " /" ) + " .java"
188
- String targetFileKotlin = kotlinSourceDir + modGroup. toString(). replaceAll(" \\ ." , " /" ) + " /" + mixinPlugin. toString(). replaceAll(" \\ ." , " /" ) + " .kt"
189
- if (! (getFile(targetFileJava). exists() || getFile(targetFileScala). exists() || getFile(targetFileScalaJava). exists() || getFile(targetFileKotlin). exists())) {
190
- throw new GradleException (" Could not resolve \" mixinPlugin\" ! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
191
+ if (! mixinPlugin. isEmpty()) {
192
+ String targetFileJava = javaSourceDir + modGroupPath + " /" + mixinPluginPath + " .java"
193
+ String targetFileScala = scalaSourceDir + modGroupPath + " /" + mixinPluginPath + " .scala"
194
+ String targetFileScalaJava = scalaSourceDir + modGroupPath + " /" + mixinPluginPath + " .java"
195
+ String targetFileKotlin = kotlinSourceDir + modGroupPath + " /" + mixinPluginPath + " .kt"
196
+ if (! (getFile(targetFileJava). exists() || getFile(targetFileScala). exists() || getFile(targetFileScalaJava). exists() || getFile(targetFileKotlin). exists())) {
197
+ throw new GradleException (" Could not resolve \" mixinPlugin\" ! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
198
+ }
191
199
}
192
200
}
193
201
194
202
if (coreModClass) {
195
- String targetFileJava = javaSourceDir + modGroup. toString(). replaceAll(" \\ ." , " /" ) + " /" + coreModClass. toString(). replaceAll(" \\ ." , " /" ) + " .java"
196
- String targetFileScala = scalaSourceDir + modGroup. toString(). replaceAll(" \\ ." , " /" ) + " /" + coreModClass. toString(). replaceAll(" \\ ." , " /" ) + " .scala"
197
- String targetFileScalaJava = scalaSourceDir + modGroup. toString(). replaceAll(" \\ ." , " /" ) + " /" + coreModClass. toString(). replaceAll(" \\ ." , " /" ) + " .java"
198
- String targetFileKotlin = kotlinSourceDir + modGroup. toString(). replaceAll(" \\ ." , " /" ) + " /" + coreModClass. toString(). replaceAll(" \\ ." , " /" ) + " .kt"
203
+ final String coreModPath = coreModClass. toString(). replaceAll(" \\ ." , " /" )
204
+ String targetFileJava = javaSourceDir + modGroupPath + " /" + coreModPath + " .java"
205
+ String targetFileScala = scalaSourceDir + modGroupPath + " /" + coreModPath + " .scala"
206
+ String targetFileScalaJava = scalaSourceDir + modGroupPath + " /" + coreModPath + " .java"
207
+ String targetFileKotlin = kotlinSourceDir + modGroupPath + " /" + coreModPath + " .kt"
199
208
if (! (getFile(targetFileJava). exists() || getFile(targetFileScala). exists() || getFile(targetFileScalaJava). exists() || getFile(targetFileKotlin). exists())) {
200
209
throw new GradleException (" Could not resolve \" coreModClass\" ! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
201
210
}
@@ -251,7 +260,7 @@ if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
251
260
def arguments = []
252
261
def jvmArguments = []
253
262
254
- if (usesMixins. toBoolean() || forceEnableMixins) {
263
+ if (usesMixins. toBoolean() || forceEnableMixins. toBoolean() ) {
255
264
arguments + = [
256
265
" --tweakClass org.spongepowered.asm.launch.MixinTweaker"
257
266
]
@@ -316,13 +325,10 @@ repositories {
316
325
name ' Overmind forge repo mirror'
317
326
url ' https://gregtech.overminddl1.com/'
318
327
}
319
- if (usesMixins. toBoolean() || forceEnableMixins) {
328
+ if (usesMixins. toBoolean() || forceEnableMixins. toBoolean() ) {
320
329
maven {
321
- name ' sponge'
322
- url ' https://repo.spongepowered.org/repository/maven-public'
323
- }
324
- maven {
325
- url ' https://jitpack.io'
330
+ name = " GTNH Maven"
331
+ url = " http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
326
332
}
327
333
}
328
334
}
@@ -332,19 +338,10 @@ dependencies {
332
338
annotationProcessor(' org.ow2.asm:asm-debug-all:5.0.3' )
333
339
annotationProcessor(' com.google.guava:guava:24.1.1-jre' )
334
340
annotationProcessor(' com.google.code.gson:gson:2.8.6' )
335
- annotationProcessor(' org.spongepowered:mixin:0.8-SNAPSHOT' )
336
- }
337
- if (usesMixins. toBoolean() || forceEnableMixins) {
338
- // using 0.8 to workaround a issue in 0.7 which fails mixin application
339
- compile(' com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH' ) {
340
- // Mixin includes a lot of dependencies that are too up-to-date
341
- exclude module : ' launchwrapper'
342
- exclude module : ' guava'
343
- exclude module : ' gson'
344
- exclude module : ' commons-io'
345
- exclude module : ' log4j-core'
346
- }
347
- compile(' com.github.GTNewHorizons:SpongeMixins:1.5.0' )
341
+ annotationProcessor(' org.spongepowered:mixin:0.8.5-GTNH:processor' )
342
+ }
343
+ if (usesMixins. toBoolean() || forceEnableMixins. toBoolean()) {
344
+ compile(' com.gtnewhorizon:gtnhmixins:2.0.2' )
348
345
}
349
346
}
350
347
@@ -356,13 +353,18 @@ def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg"
356
353
357
354
task generateAssets {
358
355
if (usesMixins. toBoolean()) {
359
- def mixinConfigFile = getFile(" /src/main/resources/mixins." + modId + " .json" );
356
+ def mixinConfigFile = getFile(" /src/main/resources/mixins." + modId + " .json" )
360
357
if (! mixinConfigFile. exists()) {
358
+ def mixinPluginLine = " "
359
+ if (! mixinPlugin. isEmpty()) {
360
+ // We might not have a mixin plugin if we're using early/late mixins
361
+ mixinPluginLine + = """ \n "plugin": "${ modGroup} .${ mixinPlugin} ", """
362
+ }
363
+
361
364
mixinConfigFile. text = """ {
362
365
"required": true,
363
- "minVersion": "0.7.11",
364
- "package": "${ modGroup} .${ mixinsPackage} ",
365
- "plugin": "${ modGroup} .${ mixinPlugin} ",
366
+ "minVersion": "0.8.5-GTNH",
367
+ "package": "${ modGroup} .${ mixinsPackage} ",${ mixinPluginLine}
366
368
"refmap": "${ mixingConfigRefMap} ",
367
369
"target": "@env(DEFAULT)",
368
370
"compatibilityLevel": "JAVA_8",
@@ -574,11 +576,11 @@ task devJar(type: Jar) {
574
576
575
577
task apiJar (type : Jar ) {
576
578
from(sourceSets. main. allSource) {
577
- include modGroup . toString() . replaceAll( " \\ . " , " / " ) + " /" + apiPackage . toString() . replaceAll( " \\ . " , " / " ) + ' /**'
579
+ include modGroupPath + " /" + apiPackagePath + ' /**'
578
580
}
579
581
580
582
from(sourceSets. main. output) {
581
- include modGroup . toString() . replaceAll( " \\ . " , " / " ) + " /" + apiPackage . toString() . replaceAll( " \\ . " , " / " ) + ' /**'
583
+ include modGroupPath + " /" + apiPackagePath + ' /**'
582
584
}
583
585
584
586
from(sourceSets. main. resources. srcDirs) {
@@ -691,6 +693,9 @@ if (modrinthProjectId.size() != 0 && System.getenv("MODRINTH_TOKEN") != null) {
691
693
addModrinthDep(qual[0 ], qual[1 ], parts[1 ])
692
694
}
693
695
}
696
+ if (usesMixins. toBoolean()) {
697
+ addModrinthDep(" required" , " version" , " gtnhmixins" )
698
+ }
694
699
tasks. modrinth. dependsOn(build)
695
700
tasks. publish. dependsOn(tasks. modrinth)
696
701
}
@@ -732,6 +737,9 @@ if (curseForgeProjectId.size() != 0 && System.getenv("CURSEFORGE_TOKEN") != null
732
737
addCurseForgeRelation(parts[0 ], parts[1 ])
733
738
}
734
739
}
740
+ if (usesMixins. toBoolean()) {
741
+ addCurseForgeRelation(" requiredDependency" , " gtnhmixins" )
742
+ }
735
743
tasks. curseforge. dependsOn(build)
736
744
tasks. publish. dependsOn(tasks. curseforge)
737
745
}
0 commit comments