@@ -3,7 +3,7 @@ plugins {
33 id ' idea'
44 id ' maven-publish'
55 id ' net.minecraftforge.gradle' version ' [6.0,6.2)'
6- // id 'org.parchmentmc.librarian.forgegradle' version '1.+'
6+ id ' org.parchmentmc.librarian.forgegradle' version ' 1.+'
77}
88
99version = mod_version
@@ -13,66 +13,20 @@ base {
1313 archivesName = mod_id
1414}
1515
16- // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
1716java. toolchain. languageVersion = JavaLanguageVersion . of(17 )
1817
1918println " Java: ${ System.getProperty 'java.version'} , JVM: ${ System.getProperty 'java.vm.version'} (${ System.getProperty 'java.vendor'} ), Arch: ${ System.getProperty 'os.arch'} "
2019minecraft {
21- // The mappings can be changed at any time and must be in the following format.
22- // Channel: Version:
23- // official MCVersion Official field/method names from Mojang mapping files
24- // parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official
25- //
26- // You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
27- // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
28- //
29- // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
30- // Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started
31- //
32- // Use non-default mappings at your own risk. They may not always work.
33- // Simply re-run your setup task after changing the mappings to update your workspace.
3420 mappings channel : mapping_channel, version : mapping_version
3521
36- // 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.
37- // In most cases, it is not necessary to enable.
38- // enableEclipsePrepareRuns = true
39- // enableIdeaPrepareRuns = true
40-
41- // This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game.
42- // It is REQUIRED to be set to true for this template to function.
43- // See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
4422 copyIdeResources = true
4523
46- // When true, this property will add the folder name of all declared run configurations to generated IDE run configurations.
47- // The folder name can be set on a run configuration using the "folderName" property.
48- // By default, the folder name of a run configuration is the name of the Gradle project containing it.
49- // generateRunFolders = true
50-
51- // This property enables access transformers for use in development.
52- // They will be applied to the Minecraft artifact.
53- // The access transformer file can be anywhere in the project.
54- // However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge.
55- // This default location is a best practice to automatically put the file in the right place in the final jar.
56- // See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information.
57- // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
58-
59- // Default run configurations.
60- // These can be tweaked, removed, or duplicated as needed.
6124 runs {
62- // applies to all the run configs below
6325 configureEach {
6426 workingDirectory project. file(' run' )
6527
66- // Recommended logging data for a userdev environment
67- // The markers can be added/remove as needed separated by commas.
68- // "SCAN": For mods scan.
69- // "REGISTRIES": For firing of registry events.
70- // "REGISTRYDUMP": For getting the contents of all registries.
7128 property ' forge.logging.markers' , ' REGISTRIES'
7229
73- // Recommended logging level for the console
74- // You can set various levels here.
75- // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
7630 property ' forge.logging.console.level' , ' debug'
7731
7832 mods {
@@ -83,7 +37,6 @@ minecraft {
8337 }
8438
8539 client {
86- // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
8740 property ' forge.enabledGameTestNamespaces' , mod_id
8841 }
8942
@@ -92,24 +45,18 @@ minecraft {
9245 args ' --nogui'
9346 }
9447
95- // This run config launches GameTestServer and runs all registered gametests, then exits.
96- // By default, the server will crash when no gametests are provided.
97- // The gametest system is also enabled by default for other run configs under the /test command.
9848 gameTestServer {
9949 property ' forge.enabledGameTestNamespaces' , mod_id
10050 }
10151
10252 data {
103- // example of overriding the workingDirectory set in configureEach above
10453 workingDirectory project. file(' run-data' )
10554
106- // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
10755 args ' --mod' , mod_id, ' --all' , ' --output' , file(' src/generated/resources/' ), ' --existing' , file(' src/main/resources/' )
10856 }
10957 }
11058}
11159
112- // Include resources generated by data generators.
11360sourceSets. main. resources { srcDir ' src/generated/resources' }
11461
11562repositories {
@@ -124,33 +71,9 @@ repositories {
12471}
12572
12673dependencies {
127- // Specify the version of Minecraft to use.
128- // Any artifact can be supplied so long as it has a "userdev" classifier artifact and is a compatible patcher artifact.
129- // The "userdev" classifier will be requested and setup by ForgeGradle.
130- // If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"],
131- // then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
13274 minecraft " net.minecraftforge:forge:${ minecraft_version} -${ forge_version} "
133-
134- // Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings
135- // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
136- // compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}")
137- // compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}")
138- // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}")
139-
140- // Example mod dependency using a mod jar from ./libs with a flat dir repository
141- // This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
142- // The group id is ignored when searching -- in this case, it is "blank"
143- // implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
144-
145- // For more info:
146- // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
147- // http://www.gradle.org/docs/current/userguide/dependency_management.html
14875}
14976
150- // This block of code expands all declared replace properties in the specified resource targets.
151- // A missing property will result in an error. Properties are expanded using ${} Groovy notation.
152- // When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
153- // See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
15477tasks. named(' processResources' , ProcessResources ). configure {
15578 var replaceProperties = [
15679 minecraft_version : minecraft_version, minecraft_version_range : minecraft_version_range,
@@ -166,21 +89,19 @@ tasks.named('processResources', ProcessResources).configure {
16689 }
16790}
16891
169- // Example for how to get properties into the manifest for reading at runtime.
17092tasks. named(' jar' , Jar ). configure {
17193 manifest {
17294 attributes([
17395 ' Specification-Title' : mod_id,
17496 ' Specification-Vendor' : mod_authors,
175- ' Specification-Version' : ' 1' , // We are version 1 of ourselves
97+ ' Specification-Version' : ' 1' ,
17698 ' Implementation-Title' : project. name,
17799 ' Implementation-Version' : project. jar. archiveVersion,
178100 ' Implementation-Vendor' : mod_authors,
179101 ' Implementation-Timestamp' : new Date (). format(" yyyy-MM-dd'T'HH:mm:ssZ" )
180102 ])
181103 }
182104
183- // This is the preferred method to reobfuscate your jar file
184105 finalizedBy ' reobfJar'
185106}
186107
@@ -189,7 +110,6 @@ tasks.named('jar', Jar).configure {
189110// dependsOn 'reobfJar'
190111// }
191112
192- // Example configuration to allow publishing using the maven-publish plugin
193113publishing {
194114 publications {
195115 register(' mavenJava' , MavenPublication ) {
@@ -204,5 +124,5 @@ publishing {
204124}
205125
206126tasks. withType(JavaCompile ). configureEach {
207- options. encoding = ' UTF-8' // Use the UTF-8 charset for Java compilation
127+ options. encoding = ' UTF-8'
208128}
0 commit comments