plugins { id 'com.github.johnrengelman.shadow' } architectury { platformSetupLoomIde() forge() } loom { forge { mixinConfig "${mod_id}-common.mixins.json" mixinConfig "${mod_id}-forge.mixins.json" mixin { defaultRefmapName = "${mod_id}-forge.refmap.json" } } runs { client { ideConfigGenerated = true runDir = "run" // 添加对 common 的依赖 source sourceSets.main } } } configurations { common { canBeResolved = true canBeConsumed = false } shadowCommon compileClasspath.extendsFrom common runtimeClasspath.extendsFrom common developmentForge.extendsFrom common // Files in this configuration will be bundled into your mod using the Shadow plugin. // Don't use the `shadow` configuration from the plugin itself as it's meant for excluding files. shadowBundle { canBeResolved = true canBeConsumed = false } } dependencies { forge "net.minecraftforge:forge:$rootProject.forge_version" // modImplementation "dev.architectury:architectury-forge:$rootProject.architectury_api_version" common(project(path: ':common', configuration: 'namedElements')) { transitive false } shadowBundle(project(path: ':common', configuration: 'transformProductionForge')) { transitive = false } } shadowJar { configurations = [project.configurations.shadowBundle] archiveClassifier = 'dev-shadow' } remapJar { input.set shadowJar.archiveFile dependsOn shadowJar archiveBaseName.set "${rootProject.archives_base_name}-${project.name}" archiveClassifier.set null } jar { archiveClassifier.set("dev") } sourcesJar { def commonSources = project(":common").sourcesJar duplicatesStrategy = DuplicatesStrategy.EXCLUDE dependsOn commonSources from commonSources.archiveFile.map { zipTree(it) } } components.java { withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { skip() } }