@@ -11,82 +11,146 @@ buildscript {
1111}
1212
1313plugins {
14- id ' java'
15- id ' net.minecraftforge.gradle ' version ' 6 .0.+ '
16- id ' org.parchmentmc.librarian.forgegradle ' version ' 1.+ '
14+ id ' java-library '
15+ id ' net.neoforged.moddev ' version ' 2 .0.78 '
16+ id ' idea '
1717}
1818
19- apply plugin : ' idea'
19+ tasks. named(' wrapper' , Wrapper ). configure {
20+ // Define wrapper values here so as to not have to always do so when updating gradlew.properties.
21+ // Switching this to Wrapper.DistributionType.ALL will download the full gradle sources that comes with
22+ // documentation attached on cursor hover of gradle classes and methods. However, this comes with increased
23+ // file size for Gradle. If you do switch this to ALL, run the Gradle wrapper task twice afterwards.
24+ // (Verify by checking gradle/wrapper/gradle-wrapper.properties to see if distributionUrl now points to `-all`)
25+ distributionType = Wrapper.DistributionType . BIN
26+ }
27+
28+ base {
29+ archivesName = mod_id
30+ }
31+
32+ group = mod_group_id
33+ version = " ${ mod_version} -${ minecraft_version} "
2034
21- group = ' com.zengyj.exposer'
22- version = " ${ mod_version} -${ mc_version} "
2335
24- minecraft {
25- // the mappings can be changed at any time, and must be in the following format.
26- // snapshot_YYYYMMDD snapshot are built nightly.
27- // stable_# stables are built at the discretion of the MCP team.
28- // Use non-default mappings at your own risk. they may not always work.
29- // simply re-run your setup task after changing the mappings to update your workspace.
30- mappings channel : " ${ mapping_channel} " , version : " ${ mc_version} "
31- // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
36+ java. toolchain. languageVersion = JavaLanguageVersion . of(21 )
37+
38+ repositories {
39+ gradlePluginPortal()
40+ maven { url ' https://cursemaven.com/' }
41+ }
42+
43+ neoForge {
44+ // Specify the version of NeoForge to use.
45+ version = project. neo_version
3246
47+ parchment {
48+ mappingsVersion = project. parchment_mappings_version
49+ minecraftVersion = project. parchment_minecraft_version
50+ }
3351
34- // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
52+ // This line is optional. Access Transformers are automatically detected
53+ // accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')
3554
3655 // Default run configurations.
3756 // These can be tweaked, removed, or duplicated as needed.
3857 runs {
3958 client {
40- workingDirectory project . file( ' run ' )
59+ client( )
4160
42- // Recommended logging data for a userdev environment
43- property ' forge.logging.markers' , ' SCAN,REGISTRIES,REGISTRYDUMP'
61+ // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
62+ systemProperty ' neoforge.enabledGameTestNamespaces' , project. mod_id
63+ }
4464
45- // Recommended logging level for the console
46- property ' forge.logging.console.level' , ' debug'
65+ server {
66+ server()
67+ programArgument ' --nogui'
68+ systemProperty ' neoforge.enabledGameTestNamespaces' , project. mod_id
69+ }
4770
48- // JvmArgs += "-Dfml.coreMods.load=com.github.vfyjxf.nee.asm.NEELoadingPlugin"
71+ // This run config launches GameTestServer and runs all registered gametests, then exits.
72+ // By default, the server will crash when no gametests are provided.
73+ // The gametest system is also enabled by default for other run configs under the /test command.
74+ gameTestServer {
75+ type = " gameTestServer"
76+ systemProperty ' neoforge.enabledGameTestNamespaces' , project. mod_id
4977 }
5078
51- server {
52- workingDirectory project. file(' run' )
79+ data {
80+ data()
81+
82+ // example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
83+ // gameDirectory = project.file('run-data')
84+
85+ // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
86+ programArguments. addAll ' --mod' , project. mod_id, ' --all' , ' --output' , file(' src/generated/resources/' ). getAbsolutePath(), ' --existing' , file(' src/main/resources/' ). getAbsolutePath()
87+ }
5388
89+ // applies to all the run configs above
90+ configureEach {
5491 // Recommended logging data for a userdev environment
55- property ' forge.logging.markers' , ' SCAN,REGISTRIES,REGISTRYDUMP'
92+ // The markers can be added/remove as needed separated by commas.
93+ // "SCAN": For mods scan.
94+ // "REGISTRIES": For firing of registry events.
95+ // "REGISTRYDUMP": For getting the contents of all registries.
96+ systemProperty ' forge.logging.markers' , ' REGISTRIES'
5697
5798 // Recommended logging level for the console
58- property ' forge.logging.console.level' , ' debug'
99+ // You can set various levels here.
100+ // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
101+ logLevel = org.slf4j.event.Level . DEBUG
102+ }
103+ }
59104
60- // JvmArgs += "-Dfml.coreMods.load=com.github.vfyjxf.nee.asm.NEELoadingPlugin"
105+ mods {
106+ // define mod <-> source bindings
107+ // these are used to tell the game which sources are for which mod
108+ // mostly optional in a single mod project
109+ // but multi mod projects should define one per mod
110+ " ${ mod_id} " {
111+ sourceSet(sourceSets. main)
61112 }
62113 }
63114}
64115
65- repositories {
66- gradlePluginPortal()
67- maven { url ' https://cursemaven.com/' }
116+ // Include resources generated by data generators.
117+ sourceSets. main. resources { srcDir ' src/generated/resources' }
118+
119+ // Sets up a dependency configuration called 'localRuntime'.
120+ // This configuration should be used instead of 'runtimeOnly' to declare
121+ // a dependency that will be present for runtime testing but that is
122+ // "optional", meaning it will not be pulled by dependents of this mod.
123+ configurations {
124+ runtimeClasspath. extendsFrom localRuntime
68125}
69126
70127dependencies {
71- minecraft " net.minecraftforge:forge :${ mc_version } - ${ forge_version } "
72- implementation fg . deobf( " curse.maven:refined-storage-243076:4844585 " )
128+ implementation " net.neoforged:neoforge :${ neo_version } "
129+ implementation " curse.maven:refined-storage-243076:6391989 "
73130
74131}
75132
76- processResources {
77- duplicatesStrategy = DuplicatesStrategy . INCLUDE
78-
79- inputs. property " version" , " ${ mod_version} "
80- inputs. property " mcversion" , " ${ mc_version} "
81-
82- from(sourceSets. main. resources. srcDirs) {
83- include ' META-INF/mods.toml'
84- filesMatching([' META-INF/mods.toml' ]){
85- expand ' version' : " ${ mod_version} "
86- }
87- }
133+ var generateModMetadata = tasks. register(" generateModMetadata" , ProcessResources ) {
134+ var replaceProperties = [
135+ minecraft_version : minecraft_version,
136+ minecraft_version_range : minecraft_version_range,
137+ neo_version : neo_version,
138+ neo_version_range : neo_version_range,
139+ loader_version_range : loader_version_range,
140+ mod_id : mod_id,
141+ mod_name : mod_name,
142+ mod_license : mod_license,
143+ mod_version : mod_version,
144+ mod_authors : mod_authors,
145+ mod_description : mod_description
146+ ]
147+ inputs. properties replaceProperties
148+ expand replaceProperties
149+ from " src/main/templates"
150+ into " build/generated/sources/modMetadata"
88151}
89-
90- test {
91-
92- }
152+ // Include the output of "generateModMetadata" as an input directory for the build
153+ // this works with both building through Gradle and the IDE.
154+ sourceSets. main. resources. srcDir generateModMetadata
155+ // To avoid having to run "generateModMetadata" manually, make it run on every project reload
156+ neoForge. ideSyncTask generateModMetadata
0 commit comments