@@ -13,6 +13,7 @@ plugins {
1313 id " idea"
1414 id " eclipse"
1515 id " maven-publish"
16+ id ' com.github.johnrengelman.shadow' version ' 7.1.0'
1617}
1718
1819apply plugin : " net.minecraftforge.gradle"
@@ -29,6 +30,12 @@ println("Version: ${version}");
2930
3031java. toolchain. languageVersion = JavaLanguageVersion . of(8 )
3132
33+ configurations {
34+ library
35+ implementation. extendsFrom library
36+ shade. extendsFrom library
37+ }
38+
3239sourceSets {
3340 api {
3441 java {
@@ -48,7 +55,8 @@ sourceSets {
4855 srcDir ' src/generated/resources'
4956 }
5057
51- compileClasspath + = compileClasspath + = sourceSets. api. output
58+ runtimeClasspath + = sourceSets. api. output
59+ compileClasspath + = sourceSets. api. output
5260 }
5361
5462 test {
@@ -64,12 +72,8 @@ sourceSets {
6472}
6573
6674println (' Java: ' + System . getProperty(' java.version' ) + ' JVM: ' + System . getProperty(' java.vm.version' ) + ' (' + System . getProperty(' java.vendor' ) + ' ) Arch: ' + System . getProperty(' os.arch' ))
75+
6776minecraft {
68- // The mappings can be changed at any time, and must be in the following format.
69- // snapshot_YYYYMMDD Snapshot are built nightly.
70- // stable_# Stables are built at the discretion of the MCP team.
71- // Use non-default mappings at your own risk. they may not always work.
72- // Simply re-run your setup task after changing the mappings to update your workspace.
7377 mappings channel : ' official' , version : minecraft_version
7478 // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
7579 def resourcesDir = sourceSets. main. resources. srcDirs. first(). absolutePath
@@ -81,6 +85,9 @@ minecraft {
8185 client {
8286 workingDirectory project. file(' run/client' )
8387
88+ property ' mixin.env.remapRefMap' , ' true'
89+ property ' mixin.env.refMapRemappingFile' , " ${ buildDir} /createSrgToMcp/output.srg"
90+
8491 // Recommended logging data for a userdev environment
8592 property ' forge.logging.markers' , ' ' // 'SCAN,REGISTRIES,REGISTRYDUMP'
8693
@@ -243,9 +250,14 @@ dependencies {
243250
244251 testImplementation fg. deobf(" com.github.alcatrazEscapee:mcjunitlib:${ mcunittest_version} " )
245252
253+ library " io.reactivex.rxjava3:rxjava:3.1.1" ;
254+
246255 // Deobfuscate each dev mod for runtime
247256 dev_mods. each { implementation fg. deobf(it) }
248257
258+ runtimeOnly(fg. deobf(" curse.maven:nicephore-401014:3318114" ))
259+ runtimeOnly(fg. deobf(" curse.maven:sues-407174:3188120" ))
260+
249261 // JEI
250262 compileOnly fg. deobf(" mezz.jei:jei-${ minecraft_version} :${ jei_version} :api" )
251263 runtimeOnly fg. deobf(" mezz.jei:jei-${ minecraft_version} :${ jei_version} " )
@@ -263,12 +275,39 @@ processTestResources {
263275 duplicatesStrategy = DuplicatesStrategy . WARN
264276}
265277
278+ assemble {
279+ dependsOn shadowJar
280+ }
281+
282+ reobf {
283+ shadowJar {}
284+ }
285+
286+ tasks. withType(Jar ). configureEach {
287+ destinationDir = file(" $rootDir /build-out" )
288+ }
289+
290+ shadowJar {
291+ classifier " "
292+ from sourceSets. api. output
293+ from sourceSets. main. output
294+
295+ configurations = [project. configurations. shade]
296+ exclude " LICENSE*"
297+ finalizedBy ' reobfShadowJar'
298+ minimize()
299+ relocate ' io.reactivex' , ' dev.compactmods.crafting.lib.reactivex'
300+ relocate ' org.reactivestreams' , ' dev.compactmods.crafting.lib.reactivestreams'
301+ }
302+
266303jar {
304+ classifier " slim"
305+
267306 from sourceSets. api. output
268307 from sourceSets. main. output
269308
270- destinationDir = file(" $rootDir /build-out" )
271309 finalizedBy(' reobfJar' )
310+
272311 manifest {
273312 attributes([
274313 " Specification-Title" : " compactcrafting" ,
@@ -284,31 +323,28 @@ jar {
284323task apiJar (type : Jar ) {
285324 // Sources included because of MinecraftForge/ForgeGradle#369
286325 from sourceSets. api. output
287- destinationDirectory = file(" $rootDir /build-out" )
288326 classifier(" api" )
289327}
290328
291329task testJar (type : Jar ) {
292330 from sourceSets. api. output
293331 from sourceSets. main. output
294332 from sourceSets. test. output
295- destinationDirectory = file(" $rootDir /build-out" )
296333 classifier(" tests" )
297334}
298335
299336artifacts {
300- archives jar, apiJar, testJar
337+ archives jar, shadowJar, apiJar, testJar
301338}
302339
303340publishing {
304341 publications {
305342 maven(MavenPublication ) {
306343 artifactId = mod_id
307344 artifacts {
308- artifact jar
309- artifact(apiJar) {
310- classifier = " api"
311- }
345+ artifact(jar)
346+ artifact(shadowJar)
347+ artifact(apiJar)
312348 artifact(testJar)
313349 }
314350 }
@@ -317,9 +353,8 @@ publishing {
317353 artifactId = mod_id
318354 artifacts {
319355 artifact(jar)
320- artifact(apiJar) {
321- classifier = " api"
322- }
356+ artifact(shadowJar)
357+ artifact(apiJar)
323358 artifact(testJar)
324359 }
325360 }
0 commit comments