1- plugins {
2- id " com.gradleup.shadow " version " 9.4.2 "
3- id " me.shedaniel.unified-publishing "
4- }
1+ import org.gradle.jvm.tasks.Jar
2+
3+ apply plugin : " com.gradleup.shadow "
4+ apply plugin : " me.shedaniel.unified-publishing "
55
66loom {
77 accessWidenerPath = project(" :common" ). loom. accessWidenerPath
8+
9+ neoForge {
10+ convertAccessWideners(tasks. named(" shadowJar" , Jar ), " architectury.accessWidener" )
11+ }
812}
913
1014architectury {
@@ -16,7 +20,7 @@ architectury {
1620
1721configurations {
1822 common
19- shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
23+ shadowCommon
2024 compileClasspath. extendsFrom common
2125 runtimeClasspath. extendsFrom common
2226 developmentNeoForge. extendsFrom common
@@ -30,39 +34,39 @@ dependencies {
3034}
3135
3236processResources {
37+ inputs. property " version" , project. version
3338 filesMatching(" META-INF/neoforge.mods.toml" ) {
3439 expand " version" : project. version
3540 }
36- inputs. property " META-INF/neoforge.mods.toml" , project. version
41+ }
42+
43+ jar {
44+ archiveClassifier = " raw"
3745}
3846
3947shadowJar {
4048 exclude " fabric.mod.json"
41- exclude " architectury-common.accessWidener"
4249 exclude " architectury.common.json"
4350
4451 dependsOn jar
4552 mainSpec. sourcePaths. clear()
4653 from(zipTree(jar. archiveFile))
4754 configurations = [project. configurations. shadowCommon]
4855 archiveClassifier = null
56+ zip64 = true
4957 from rootProject. file(" LICENSE.md" )
5058
51- // Replace classes with forge's version
59+ // Replace the common stubs with the NeoForge-native implementations via relocation.
5260 exclude " dev/architectury/core/block/ArchitecturyLiquidBlock.class"
5361 exclude " dev/architectury/core/fluid/ArchitecturyFlowingFluid.class"
54- exclude ' dev/architectury/core/fluid/ArchitecturyFlowingFluid$Source.class'
55- exclude ' dev/architectury/core/fluid/ArchitecturyFlowingFluid$Flowing.class'
56- exclude ' dev/architectury/core/item/ArchitecturyBucketItem.class'
62+ exclude " dev/architectury/core/fluid/ArchitecturyFlowingFluid\ $ Source.class"
63+ exclude " dev/architectury/core/fluid/ArchitecturyFlowingFluid\ $ Flowing.class"
64+ exclude " dev/architectury/core/item/ArchitecturyBucketItem.class"
5765 relocate " dev.architectury.core.block.forge.imitator" , " dev.architectury.core.block"
5866 relocate " dev.architectury.core.fluid.forge.imitator" , " dev.architectury.core.fluid"
5967 relocate " dev.architectury.core.item.forge.imitator" , " dev.architectury.core.item"
6068}
6169
62- jar {
63- archiveClassifier = " raw"
64- }
65-
6670assemble. dependsOn shadowJar
6771
6872configurations {
@@ -78,12 +82,10 @@ configurations {
7882
7983sourcesJar {
8084 afterEvaluate {
81- [" :common" ]. forEach {
82- def depSources = project(it). sourcesJar
83- dependsOn depSources
84- from(depSources. archiveFile. map { zipTree(it) }) {
85- exclude " architectury.accessWidener"
86- }
85+ def depSources = project(" :common" ). sourcesJar
86+ dependsOn depSources
87+ from(depSources. archiveFile. map { zipTree(it) }) {
88+ exclude " architectury.accessWidener"
8789 }
8890 }
8991}
@@ -117,7 +119,7 @@ publishing {
117119}
118120
119121unifiedPublishing {
120- if (rootProject. neoforge_pr != " " ) return // Don't publish PRs
122+ if (rootProject. neoforge_pr != " " ) return
121123 project {
122124 displayName = " [NeoForge $rootProject . supported_version ] v$project . version "
123125 releaseType = " $rootProject . artifact_type "
@@ -145,4 +147,3 @@ unifiedPublishing {
145147 }
146148 }
147149}
148-
0 commit comments