MultiLoader-Template/neoforge/build.gradle
3944Realms 768f38fc97 feat: 可使用的构建模板
修改了脚本,使其可以推给Maven仓库
2026-05-03 13:02:19 +08:00

72 lines
2.7 KiB
Groovy

plugins {
id 'multiloader-loader'
id 'net.neoforged.moddev'
}
def commonResources = project(':common').file('src/main/resources/').getAbsolutePath()
def neoforgeResources = file('src/main/resources/').getAbsolutePath()
def neoforgeBuildResources = file('build/resources/main/').getAbsolutePath()
def commonBuildResources = project(':common').file('build/resources/main/').getAbsolutePath()
def generatedOutput = project(':common').file('src/generated/resources/').getAbsolutePath()
neoForge {
version = neoforge_version
// Automatically enable neoforge AccessTransformers if the file exists
def at = project(':common').file('src/main/resources/META-INF/accesstransformer.cfg')
if (at.exists()) {
accessTransformers.from(at.absolutePath)
}
parchment {
minecraftVersion = parchment_minecraft
mappingsVersion = parchment_version
}
runs {
configureEach {
systemProperty('neoforge.enabledGameTestNamespaces', mod_id)
ideName = "NeoForge ${it.name.capitalize()} (${project.path})" // Unify the run config names with fabric
}
client {
client()
programArguments.addAll(
'--mod', project.mod_id,
'--all',
'--existing', neoforgeResources,
'--existing', commonResources,
'--existing', neoforgeBuildResources,
'--existing', commonBuildResources
)
}
data {
data()
// DataGen can be run by - "./gradlew :neoforge:runData" in Terminal.
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
programArguments.addAll(
'--mod', project.mod_id,
'--all',
'--output', generatedOutput,
'--existing', neoforgeResources,
'--existing', commonResources,
'--existing', neoforgeBuildResources,
'--existing', commonBuildResources
)
}
server {
server()
programArguments.addAll(
'--mod', project.mod_id,
'--all',
'--existing', neoforgeResources,
'--existing', commonResources,
'--existing', neoforgeBuildResources,
'--existing', commonBuildResources
)
}
}
mods {
"${mod_id}" {
sourceSet sourceSets.main
}
}
}
sourceSets.main.resources { srcDir 'src/generated/resources' }