-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle
75 lines (59 loc) · 2.34 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
plugins {
id 'idea'
id 'net.neoforged.gradle.userdev' version '7.0.97'
id 'java-library'
}
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
base {
archivesName = "${mod_name}-neoforge-${minecraft_version}"
}
version = "${version}${buildnumber}"
// 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' }
jarJar.enable()
dependencies {
implementation "net.neoforged:neoforge:${neoforge_version}"
compileOnly project(":common")
implementation "mysticdrew:common-networking-neoforge:${common_networking}-${minecraft_version}"
jarJar group: 'mysticdrew', name: 'common-networking-neoforge', version: '[1.0.1, 5.0.0)'
}
// 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.named("sourcesJar", Jar) {
from(project(":common").sourceSets.main.allSource)
}
tasks.withType(ProcessResources).matching(notNeoTask).configureEach {
from project(":common").sourceSets.main.resources
}
tasks.jarJar.configure {
archiveClassifier.set("")
}
tasks.named("build").configure {
dependsOn("jarJar")
}