@@ -14,13 +14,10 @@ group = "${property("mod.group")}"
1414base.archivesName.set(" ${property(" mod_name" )} -mc${property(" deps.minecraft" )} -forge" .lowercase())
1515
1616legacyForge {
17- version = property(" deps.forge" ) as String
1817 validateAccessTransformers = true
19-
20- if (hasProperty(" deps.parchment" )) parchment {
21- val (mc, ver) = (property(" deps.parchment" ) as String ).split(' :' )
22- mappingsVersion = ver
23- minecraftVersion = mc
18+ enable {
19+ forgeVersion = property(" deps.forge" ) as String
20+ isDisableRecompilation = true
2421 }
2522}
2623
@@ -40,7 +37,27 @@ mixin { // Add mixins
4037tasks.getByName<Copy >(" processResources" ) {
4138 doLast { // Add refmap to the mixin config
4239 val mixinConfigFile = File (destinationDir, " automodpack-main.mixins.json" )
43- addRefmapToJsonFile(mixinConfigFile, " automodpack-main.mixins.refmap.json" )
40+
41+ // Inline the refmap addition to avoid configuration cache issues
42+ if (! mixinConfigFile.exists()) {
43+ error(" JSON file not found: ${mixinConfigFile.absolutePath} " )
44+ }
45+
46+ val objectMapper = ObjectMapper ().enable(SerializationFeature .INDENT_OUTPUT )
47+ try {
48+ val jsonNode = objectMapper.readTree(mixinConfigFile)
49+ if (jsonNode.isObject) {
50+ val objectNode = jsonNode as ObjectNode
51+ objectNode.put(" refmap" , " automodpack-main.mixins.refmap.json" )
52+ objectMapper.writeValue(mixinConfigFile, objectNode)
53+ println (" Added refmap (automodpack-main.mixins.refmap.json) to ${mixinConfigFile.name} " )
54+ } else {
55+ error(" JSON file ${mixinConfigFile.name} is not a JSON object, couldn't add refmap." )
56+ }
57+ } catch (e: Exception ) {
58+ println (" Error processing JSON file ${mixinConfigFile.absolutePath} : ${e.message} " )
59+ e.printStackTrace()
60+ }
4461 }
4562}
4663
@@ -55,7 +72,7 @@ tasks {
5572
5673 processResources {
5774 exclude(" **/fabric.mod.json" , " **/automodpack.accesswidener" )
58- if (stonecutter.eval(stonecutter. current.version, " >= 1.21.9" ) ) {
75+ if (sc. current.parsed >= " 1.21.9" ) {
5976 exclude(" **/pack.mcmeta" )
6077 rename(" new-pack.mcmeta" , " pack.mcmeta" )
6178 } else {
@@ -69,7 +86,7 @@ tasks {
6986}
7087
7188java {
72- if (stonecutter.eval(stonecutter. current.version, " >= 1.20.5" ) ) {
89+ if (sc. current.parsed >= " 1.20.5" ) {
7390 sourceCompatibility = JavaVersion .VERSION_21
7491 targetCompatibility = JavaVersion .VERSION_21
7592 toolchain.languageVersion.set(JavaLanguageVersion .of(21 ))
@@ -80,25 +97,3 @@ java {
8097 }
8198 withSourcesJar()
8299}
83-
84- fun addRefmapToJsonFile (jsonFile : File , refmap : String ) {
85- if (! jsonFile.exists()) {
86- error(" JSON file not found: ${jsonFile.absolutePath} " )
87- }
88-
89- val objectMapper = ObjectMapper ().enable(SerializationFeature .INDENT_OUTPUT )
90- try {
91- val jsonNode = objectMapper.readTree(jsonFile)
92- if (jsonNode.isObject) {
93- val objectNode = jsonNode as ObjectNode
94- objectNode.put(" refmap" , refmap)
95- objectMapper.writeValue(jsonFile, objectNode)
96- println (" Added refmap ($refmap ) to ${jsonFile.name} " )
97- } else {
98- error(" JSON file ${jsonFile.name} is not a JSON object, couldn't add refmap." )
99- }
100- } catch (e: Exception ) {
101- println (" Error processing JSON file ${jsonFile.absolutePath} : ${e.message} " )
102- e.printStackTrace()
103- }
104- }
0 commit comments