JsonEM/forge/build.gradle
3944Realms 409573cd4e 1. 添加了远程Maven仓库,如何使用见 README.MD
2. 修复了Forge Server端加载本模组会导致非法的类加载错误
3. 更改了版本命名,现在是 jsonem-模组加载器端-mc版本-模组版本
2025-11-22 15:32:52 +08:00

85 lines
2.0 KiB
Groovy

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()
}
}