1
1
plugins {
2
+ id ' java-library'
2
3
id ' eclipse'
3
4
id ' idea'
4
5
id ' maven-publish'
5
- id ' net.minecraftforge .gradle' version ' [6.0,6.2) '
6
+ id ' net.neoforged .gradle.userdev ' version ' 7.0.80 '
6
7
}
7
8
8
9
version = mod_version
9
- if (System . getenv(' CI_PIPELINE_NUMBER' ) != null ) {
10
- version + = " ." + System . getenv(' CI_PIPELINE_NUMBER' )
11
- }
12
-
13
10
group = mod_group_id
14
11
12
+ repositories {
13
+ mavenLocal()
14
+
15
+ maven {
16
+ url = " https://maven.blamejared.com"
17
+ }
18
+ maven {
19
+ url = " https://maven.theillusivec4.top/"
20
+ }
21
+ }
22
+
15
23
base {
16
24
archivesName = mod_name
17
25
}
@@ -20,147 +28,72 @@ base {
20
28
java. toolchain. languageVersion = JavaLanguageVersion . of(17 )
21
29
22
30
println " Java: ${ System.getProperty 'java.version'} , JVM: ${ System.getProperty 'java.vm.version'} (${ System.getProperty 'java.vendor'} ), Arch: ${ System.getProperty 'os.arch'} "
23
- minecraft {
24
- // The mappings can be changed at any time and must be in the following format.
25
- // Channel: Version:
26
- // official MCVersion Official field/method names from Mojang mapping files
27
- // parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official
28
- //
29
- // You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
30
- // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
31
- //
32
- // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
33
- // Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started
34
- //
35
- // Use non-default mappings at your own risk. They may not always work.
36
- // Simply re-run your setup task after changing the mappings to update your workspace.
37
- mappings channel : mapping_channel, version : mapping_version
38
-
39
- // When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game.
40
- // In most cases, it is not necessary to enable.
41
- // enableEclipsePrepareRuns = true
42
- // enableIdeaPrepareRuns = true
43
-
44
- // This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game.
45
- // It is REQUIRED to be set to true for this template to function.
46
- // See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
47
- copyIdeResources = true
48
-
49
- // When true, this property will add the folder name of all declared run configurations to generated IDE run configurations.
50
- // The folder name can be set on a run configuration using the "folderName" property.
51
- // By default, the folder name of a run configuration is the name of the Gradle project containing it.
52
- // generateRunFolders = true
53
-
54
- // This property enables access transformers for use in development.
55
- // They will be applied to the Minecraft artifact.
56
- // The access transformer file can be anywhere in the project.
57
- // However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge.
58
- // This default location is a best practice to automatically put the file in the right place in the final jar.
59
- // See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information.
60
- // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
61
-
62
- // Default run configurations.
63
- // These can be tweaked, removed, or duplicated as needed.
64
- runs {
65
- // applies to all the run configs below
66
- configureEach {
67
- workingDirectory project. file(' run' )
68
-
69
- // Recommended logging data for a userdev environment
70
- // The markers can be added/remove as needed separated by commas.
71
- // "SCAN": For mods scan.
72
- // "REGISTRIES": For firing of registry events.
73
- // "REGISTRYDUMP": For getting the contents of all registries.
74
- property ' forge.logging.markers' , ' REGISTRIES'
75
-
76
- // Recommended logging level for the console
77
- // You can set various levels here.
78
- // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
79
- property ' forge.logging.console.level' , ' info'
80
-
81
- mods {
82
- " ${ mod_id} " {
83
- source sourceSets. main
84
- }
85
- }
86
-
87
- property ' mixin.env.remapRefMap' , ' true'
88
- property ' mixin.env.refMapRemappingFile' , " ${ projectDir} /build/createSrgToMcp/output.srg"
89
- }
31
+ runs {
32
+ // applies to all the run configs below
33
+ configureEach {
34
+ // Recommended logging data for a userdev environment
35
+ // The markers can be added/remove as needed separated by commas.
36
+ // "SCAN": For mods scan.
37
+ // "REGISTRIES": For firing of registry events.
38
+ // "REGISTRYDUMP": For getting the contents of all registries.
39
+ systemProperty ' forge.logging.markers' , ' REGISTRIES'
40
+
41
+ // Recommended logging level for the console
42
+ // You can set various levels here.
43
+ // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
44
+ systemProperty ' forge.logging.console.level' , ' info'
45
+
46
+ modSource project. sourceSets. main
47
+ }
90
48
91
- client {
92
- // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
93
- property ' forge.enabledGameTestNamespaces' , mod_id
94
- }
49
+ client {
50
+ // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
51
+ systemProperty ' forge.enabledGameTestNamespaces' , project . mod_id
52
+ }
95
53
96
- server {
97
- property ' forge.enabledGameTestNamespaces' , mod_id
98
- args ' --nogui'
99
- }
54
+ server {
55
+ systemProperty ' forge.enabledGameTestNamespaces' , project . mod_id
56
+ programArgument ' --nogui'
57
+ }
100
58
101
- // This run config launches GameTestServer and runs all registered gametests, then exits.
102
- // By default, the server will crash when no gametests are provided.
103
- // The gametest system is also enabled by default for other run configs under the /test command.
104
- gameTestServer {
105
- property ' forge.enabledGameTestNamespaces' , mod_id
106
- }
59
+ // This run config launches GameTestServer and runs all registered gametests, then exits.
60
+ // By default, the server will crash when no gametests are provided.
61
+ // The gametest system is also enabled by default for other run configs under the /test command.
62
+ gameTestServer {
63
+ systemProperty ' forge.enabledGameTestNamespaces' , project . mod_id
64
+ }
107
65
108
- data {
109
- // example of overriding the workingDirectory set in configureEach above
110
- workingDirectory project. file(' run-data' )
66
+ data {
67
+ // example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
68
+ // workingDirectory project.file('run-data')
111
69
112
- // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
113
- args ' --mod' , mod_id, ' --all' , ' --output' , file(' src/generated/resources/' ), ' --existing' , file(' src/main/resources/' )
114
- }
70
+ // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
71
+ programArguments. addAll ' --mod' , project. mod_id, ' --all' , ' --output' , file(' src/generated/resources/' ). getAbsolutePath(), ' --existing' , file(' src/main/resources/' ). getAbsolutePath()
115
72
}
116
73
}
117
74
118
75
// Include resources generated by data generators.
119
76
sourceSets. main. resources { srcDir ' src/generated/resources' }
120
77
121
- repositories {
122
- // Put repositories for dependencies here
123
- // ForgeGradle automatically adds the Forge maven and Maven Central for you
124
-
125
- // If you have mod jar dependencies in ./libs, you can declare them as a repository like so.
126
- // See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver
127
- // flatDir {
128
- // dir 'libs'
129
- // }
130
-
131
- // it says this gets included automatically but apparently it doesn't
132
- mavenCentral()
133
-
134
- maven {
135
- url = " https://maven.blamejared.com"
136
- }
137
- maven {
138
- url = " https://maven.theillusivec4.top/"
139
- }
140
- maven {
141
- url = " https://maven.ellpeck.de"
142
- }
143
- }
144
-
145
78
dependencies {
146
79
// Specify the version of Minecraft to use.
147
80
// Any artifact can be supplied so long as it has a "userdev" classifier artifact and is a compatible patcher artifact.
148
81
// The "userdev" classifier will be requested and setup by ForgeGradle.
149
82
// If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"],
150
83
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
151
- minecraft " net.minecraftforge:forge :${ minecraft_version } - ${ forge_version } "
84
+ implementation " net.neoforged:neoforge :${ neo_version } "
152
85
153
86
// Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings
154
87
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
155
- compileOnly fg . deobf( " mezz.jei:jei-${ minecraft_version} -common-api:${ jei_version} " )
156
- compileOnly fg . deobf( " mezz.jei:jei-${ minecraft_version} -forge -api:${ jei_version} " )
157
- runtimeOnly fg . deobf( " mezz.jei:jei-${ minecraft_version} -forge :${ jei_version} " )
88
+ compileOnly " mezz.jei:jei-${ minecraft_version} -common-api:${ jei_version} "
89
+ compileOnly " mezz.jei:jei-${ minecraft_version} -neoforge -api:${ jei_version} "
90
+ runtimeOnly " mezz.jei:jei-${ minecraft_version} -neoforge :${ jei_version} "
158
91
159
- runtimeOnly fg . deobf( " top.theillusivec4.curios:curios-forge :${ curios_version} " )
160
- compileOnly fg . deobf( " top.theillusivec4.curios:curios-forge :${ curios_version} :api" )
92
+ runtimeOnly " top.theillusivec4.curios:curios-neoforge :${ curios_version} "
93
+ compileOnly " top.theillusivec4.curios:curios-neoforge :${ curios_version} :api"
161
94
162
- compileOnly fg . deobf( " vazkii.patchouli:Patchouli:${ patchouli_version} :api" )
163
- runtimeOnly fg . deobf( " vazkii.patchouli:Patchouli:${ patchouli_version} " )
95
+ compileOnly " vazkii.patchouli:Patchouli:${ patchouli_version} :api"
96
+ runtimeOnly " vazkii.patchouli:Patchouli:${ patchouli_version} "
164
97
165
98
// Example mod dependency using a mod jar from ./libs with a flat dir repository
166
99
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
@@ -176,38 +109,21 @@ dependencies {
176
109
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
177
110
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
178
111
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
179
- tasks. named( ' processResources ' , ProcessResources ). configure {
112
+ tasks. withType( ProcessResources ). configureEach {
180
113
var replaceProperties = [
181
114
minecraft_version : minecraft_version, minecraft_version_range : minecraft_version_range,
182
- forge_version : forge_version, forge_version_range : forge_version_range ,
115
+ neo_version : neo_version, neo_version_range : neo_version_range ,
183
116
loader_version_range : loader_version_range,
184
- mod_id : mod_id, mod_name : mod_name, mod_license : mod_license, mod_version : version ,
117
+ mod_id : mod_id, mod_name : mod_name, mod_license : mod_license, mod_version : mod_version ,
185
118
mod_authors : mod_authors, mod_description : mod_description,
186
119
]
187
120
inputs. properties replaceProperties
188
121
189
- filesMatching([' META-INF/mods.toml' , ' pack.mcmeta ' ]) {
122
+ filesMatching([' META-INF/mods.toml' ]) {
190
123
expand replaceProperties + [project : project]
191
124
}
192
125
}
193
126
194
- // Example for how to get properties into the manifest for reading at runtime.
195
- tasks. named(' jar' , Jar ). configure {
196
- manifest {
197
- attributes([
198
- ' Specification-Title' : mod_id,
199
- ' Specification-Vendor' : mod_authors,
200
- ' Specification-Version' : ' 1' , // We are version 1 of ourselves
201
- ' Implementation-Title' : project. name,
202
- ' Implementation-Version' : project. jar. archiveVersion,
203
- ' Implementation-Vendor' : mod_authors,
204
- ' Implementation-Timestamp' : new Date (). format(" yyyy-MM-dd'T'HH:mm:ssZ" )
205
- ])
206
- }
207
- // This is the preferred method to reobfuscate your jar file
208
- finalizedBy ' reobfJar'
209
- }
210
-
211
127
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing:
212
128
// tasks.named('publish').configure {
213
129
// dependsOn 'reobfJar'
@@ -217,23 +133,16 @@ tasks.named('jar', Jar).configure {
217
133
publishing {
218
134
publications {
219
135
register(' mavenJava' , MavenPublication ) {
220
- groupId mod_group_id
221
- artifactId mod_name
222
- artifact jar
223
- pom. withXml {
224
- def node = asNode()
225
- if (node. dependencies. size() > 0 )
226
- node. remove(node. dependencies)
227
- }
136
+ from components. java
228
137
}
229
138
}
230
139
repositories {
231
140
maven {
232
- url " file://" + System . getenv( " LOCAL_MAVEN " )
141
+ url " file://${ project.projectDir } /repo "
233
142
}
234
143
}
235
144
}
236
145
237
146
tasks. withType(JavaCompile ). configureEach {
238
147
options. encoding = ' UTF-8' // Use the UTF-8 charset for Java compilation
239
- }
148
+ }
0 commit comments