77 lines
2.3 KiB
Groovy
77 lines
2.3 KiB
Groovy
plugins {
|
|
id 'idea'
|
|
id 'maven-publish'
|
|
id 'net.neoforged.gradle.userdev' version '7.0.107'
|
|
id 'java-library'
|
|
}
|
|
base {
|
|
archivesName = "${mod_name}-neoforge-${minecraft_version}"
|
|
}
|
|
|
|
// Automatically enable neoforge AccessTransformers if the file exists
|
|
// This location is hardcoded in FML and can not be changed.
|
|
// https://github.com/neoforged/FancyModLoader/blob/a952595eaaddd571fbc53f43847680b00894e0c1/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModFile.java#L118
|
|
if (file('src/main/resources/META-INF/accesstransformer.cfg').exists()) {
|
|
minecraft.accessTransformers.file file('src/main/resources/META-INF/accesstransformer.cfg')
|
|
}
|
|
runs {
|
|
configureEach {
|
|
modSource project.sourceSets.main
|
|
}
|
|
client {
|
|
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
|
|
}
|
|
server {
|
|
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
|
|
programArgument '--nogui'
|
|
}
|
|
|
|
gameTestServer {
|
|
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
|
|
}
|
|
|
|
data {
|
|
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
|
|
}
|
|
}
|
|
|
|
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
|
|
|
dependencies {
|
|
implementation "net.neoforged:neoforge:${neoforge_version}"
|
|
compileOnly project(":common")
|
|
}
|
|
|
|
// NeoGradle compiles the game, but we don't want to add our common code to the game's code
|
|
Spec<Task> notNeoTask = { Task it -> !it.name.startsWith("neo") } as Spec<Task>
|
|
|
|
tasks.withType(JavaCompile).matching(notNeoTask).configureEach {
|
|
source(project(":common").sourceSets.main.allSource)
|
|
}
|
|
|
|
tasks.withType(Javadoc).matching(notNeoTask).configureEach {
|
|
source(project(":common").sourceSets.main.allJava)
|
|
}
|
|
|
|
tasks.named("sourcesJar", Jar) {
|
|
from(project(":common").sourceSets.main.allSource)
|
|
}
|
|
|
|
tasks.withType(ProcessResources).matching(notNeoTask).configureEach {
|
|
from project(":common").sourceSets.main.resources
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
artifactId base.archivesName.get()
|
|
from components.java
|
|
}
|
|
}
|
|
repositories {
|
|
maven {
|
|
url System.getenv("local_maven_url")
|
|
}
|
|
}
|
|
}
|