@@ -5,7 +5,7 @@ plugins {
5
5
id ' eclipse'
6
6
id ' idea'
7
7
id ' maven-publish'
8
- id ' net.neoforged.gradle.userdev ' version ' 7 .0.165 '
8
+ id ' net.neoforged.moddev ' version ' 2 .0.47-beta '
9
9
id " me.modmuss50.mod-publish-plugin" version " 0.5.1"
10
10
}
11
11
@@ -14,15 +14,10 @@ ext.isAlpha = ext.releaseTag.contains("alpha")
14
14
ext. isBeta = ext. releaseTag. contains(" beta" )
15
15
def relType = ext. isAlpha ? " alpha" : (ext. isBeta ? " beta" : " release" )
16
16
17
- // All jar files from this folder will be added automatically as runtime-only mod dependencies
18
- def extraModsDir = " extra-mods-${ minecraft_version} "
17
+ version = mod_version
19
18
20
19
repositories {
21
20
mavenLocal()
22
- flatDir {
23
- name " extra-mods"
24
- dir file(extraModsDir)
25
- }
26
21
maven {
27
22
name " K-4u Mod maven"
28
23
url " https://modmaven.dev/"
@@ -54,11 +49,7 @@ repositories {
54
49
}
55
50
56
51
sourceSets {
57
- test {
58
- runs {
59
- modIdentifier ' modularrouterstest'
60
- }
61
- }
52
+ test
62
53
}
63
54
64
55
group = project. mod_group_id
@@ -77,62 +68,86 @@ java {
77
68
}
78
69
}
79
70
80
- minecraft {
81
- accessTransformers. file(project. file(' src/main/resources/META-INF/accesstransformer.cfg' ))
82
- }
71
+ neoForge {
72
+ version = " ${ neo_version} "
83
73
84
- runs {
85
- // applies to all the run configs below
86
- configureEach {
87
- // Recommended logging data for a userdev environment
88
- // The markers can be added/remove as needed separated by commas.
89
- // "SCAN": For mods scan.
90
- // "REGISTRIES": For firing of registry events.
91
- // "REGISTRYDUMP": For getting the contents of all registries.
92
- systemProperty ' forge.logging.markers' , ' REGISTRIES'
93
-
94
- // Recommended logging level for the console
95
- // You can set various levels here.
96
- // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
97
- systemProperty ' forge.logging.console.level' , ' debug'
98
-
99
- jvmArguments. addAll ' -Xmx4G'
100
-
101
- modSource project. sourceSets. test
102
- modSource project. sourceSets. main
74
+ parchment {
75
+ mappingsVersion = project. parchment_mappings_version
76
+ minecraftVersion = project. parchment_minecraft_version
103
77
}
104
78
105
- client {
106
- systemProperty ' neoforge.enableGameTest' , ' true'
107
- // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
108
- systemProperty ' forge.enabledGameTestNamespaces' , project. mod_id
109
- }
79
+ addModdingDependenciesTo(sourceSets. test)
110
80
111
- server {
112
- systemProperty ' forge.enabledGameTestNamespaces' , project. mod_id
113
- argument ' --nogui'
114
- }
81
+ validateAccessTransformers = true
82
+
83
+ runs {
84
+ // applies to all the run configs below
85
+ configureEach {
86
+ // Recommended logging data for a userdev environment
87
+ // The markers can be added/remove as needed separated by commas.
88
+ // "SCAN": For mods scan.
89
+ // "REGISTRIES": For firing of registry events.
90
+ // "REGISTRYDUMP": For getting the contents of all registries.
91
+ systemProperty ' forge.logging.markers' , ' REGISTRIES'
92
+
93
+ // Recommended logging level for the console
94
+ // You can set various levels here.
95
+ // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
96
+ systemProperty ' forge.logging.console.level' , ' debug'
97
+
98
+ jvmArguments. addAll ' -Xmx4G'
99
+ }
100
+
101
+ client {
102
+ client()
103
+ systemProperty ' neoforge.enableGameTest' , ' true'
104
+ // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
105
+ systemProperty ' neoforge.enabledGameTestNamespaces' , project. mod_id
106
+ loadedMods = [mods. modularrouters, mods. modularrouterstest]
107
+ }
108
+
109
+ server {
110
+ server()
111
+ systemProperty ' neoforge.enabledGameTestNamespaces' , project. mod_id
112
+ programArgument ' --nogui'
113
+ }
115
114
116
- // This run config launches GameTestServer and runs all registered gametests, then exits.
117
- // By default, the server will crash when no gametests are provided.
118
- // The gametest system is also enabled by default for other run configs under the /test command.
119
- gameTestServer {
120
- systemProperty ' forge.enabledGameTestNamespaces' , project. mod_id
115
+ // This run config launches GameTestServer and runs all registered gametests, then exits.
116
+ // By default, the server will crash when no gametests are provided.
117
+ // The gametest system is also enabled by default for other run configs under the /test command.
118
+ gameTestServer {
119
+ type = " gameTestServer"
120
+ systemProperty ' neoforge.enabledGameTestNamespaces' , project. mod_id
121
+ }
122
+
123
+ data {
124
+ data()
125
+ // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
126
+ programArguments. addAll ' --mod' , project. mod_id, ' --all' , ' --output' , file(' src/generated/resources/' ). getAbsolutePath(), ' --existing' , file(' src/main/resources/' ). getAbsolutePath()
127
+ }
121
128
}
122
129
123
- data {
124
- // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
125
- arguments. addAll ' --mod' , project. mod_id, ' --all' , ' --output' , file(' src/generated/resources/' ). getAbsolutePath(), ' --existing' , file(' src/main/resources/' ). getAbsolutePath()
130
+ mods {
131
+ " ${ mod_id} " {
132
+ sourceSet sourceSets. main
133
+ sourceSet sourceSets. test
134
+ }
126
135
}
127
136
}
128
137
129
138
// Include resources generated by data generators.
130
139
sourceSets. main. resources { srcDir ' src/generated/resources' }
131
140
141
+ configurations {
142
+ runtimeClasspath. extendsFrom localRuntime
143
+ }
144
+
132
145
dependencies {
133
- implementation " net.neoforged:neoforge:${ neo_version} "
146
+ // implementation "net.neoforged:neoforge:${neo_version}"
134
147
localRuntime(testImplementation(" net.neoforged:testframework:${ neo_version} " ))
135
148
149
+ // implementation sourceSets.test.output
150
+
136
151
compileOnly(" mcjty.theoneprobe:theoneprobe:${ top_version} " ) {
137
152
transitive = false
138
153
}
@@ -150,14 +165,14 @@ dependencies {
150
165
// runtimeOnly "mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}"
151
166
152
167
// Locally sourced extra mods for runtime (i.e. testing) - thanks AE2 for this idea
153
- for (extraModJar in fileTree(dir : extraModsDir, include : ' *.jar' )) {
154
- def basename = extraModJar. name. substring(0 , extraModJar. name. length() - " .jar" . length())
155
- def versionSep = basename. lastIndexOf(' -' )
156
- assert versionSep != -1
157
- def artifactId = basename. substring(0 , versionSep)
158
- def version = basename. substring(versionSep + 1 )
159
- runtimeOnly " extra-mods:$artifactId :$version "
160
- }
168
+ // for (extraModJar in fileTree(dir: extraModsDir, include: '*.jar')) {
169
+ // def basename = extraModJar.name.substring(0, extraModJar.name.length() - ".jar".length())
170
+ // def versionSep = basename.lastIndexOf('-')
171
+ // assert versionSep != -1
172
+ // def artifactId = basename.substring(0, versionSep)
173
+ // def version = basename.substring(versionSep + 1)
174
+ // runtimeOnly "extra-mods:$artifactId:$version"
175
+ // }
161
176
}
162
177
163
178
tasks. withType(ProcessResources ). configureEach {
0 commit comments