3636 toolchain {
3737 languageVersion = JavaLanguageVersion . of(21 )
3838 }
39+ sourceCompatibility = JavaVersion . VERSION_1_8
40+ targetCompatibility = JavaVersion . VERSION_1_8
3941 if (propertyBool(' generate_sources_jar' )) {
4042 withSourcesJar()
4143 }
@@ -170,6 +172,25 @@ if (!propertyBool('enable_shadow')) {
170172 shadowJar. enabled = false
171173}
172174
175+ // Shared manifest attributes (excluding ModType)
176+ ext. buildManifestAttributes = {
177+ def attribute_map = [:]
178+ if (configurations. contain. size() > 0 ) {
179+ attribute_map[' ContainedDeps' ] = configurations. contain. collect { it. name }. join(' ' )
180+ attribute_map[' NonModDeps' ] = true
181+ }
182+ if (propertyBool(' is_coremod' )) {
183+ attribute_map[' FMLCorePlugin' ] = propertyString(' coremod_plugin_class_name' )
184+ if (propertyBool(' coremod_includes_mod' )) {
185+ attribute_map[' FMLCorePluginContainsFMLMod' ] = true
186+ }
187+ }
188+ if (propertyBool(' use_access_transformer' )) {
189+ attribute_map[' FMLAT' ] = propertyString(' access_transformer_locations' )
190+ }
191+ return attribute_map
192+ }
193+
173194jar {
174195 duplicatesStrategy = DuplicatesStrategy . EXCLUDE
175196 if (configurations. contain. size() > 0 ) {
@@ -179,22 +200,7 @@ jar {
179200 }
180201 doFirst {
181202 manifest {
182- def attribute_map = [:]
183- attribute_map[' ModType' ] = " CRL"
184- if (configurations. contain. size() > 0 ) {
185- attribute_map[' ContainedDeps' ] = configurations. contain. collect { it. name }. join(' ' )
186- attribute_map[' NonModDeps' ] = true
187- }
188- if (propertyBool(' is_coremod' )) {
189- attribute_map[' FMLCorePlugin' ] = propertyString(' coremod_plugin_class_name' )
190- if (propertyBool(' coremod_includes_mod' )) {
191- attribute_map[' FMLCorePluginContainsFMLMod' ] = true
192- }
193- }
194- if (propertyBool(' use_access_transformer' )) {
195- attribute_map[' FMLAT' ] = propertyString(' access_transformer_locations' )
196- }
197- attributes(attribute_map)
203+ attributes(buildManifestAttributes())
198204 }
199205 }
200206 if (propertyBool(' enable_shadow' )) {
@@ -204,6 +210,25 @@ jar {
204210 }
205211}
206212
213+ // Cleanroom variant with ModType: CRL
214+ tasks. register(' cleanroomJar' , Jar ) {
215+ dependsOn ' remapJar'
216+ from(zipTree(tasks. jar. archiveFile)) {
217+ exclude ' META-INF/MANIFEST.MF'
218+ }
219+ archiveClassifier = ' cleanroom'
220+ manifest {
221+ def attrs = buildManifestAttributes()
222+ attrs[' ModType' ] = ' CRL'
223+ attrs[' Fabric-Loom-Mixin-Remap-Type' ] = ' static'
224+ attributes(attrs)
225+ }
226+ }
227+
228+ tasks. named(' build' ) {
229+ dependsOn ' cleanroomJar'
230+ }
231+
207232
208233shadowJar {
209234 configurations = [project. configurations. shadow]
0 commit comments