11plugins {
2+ id ' idea'
23 id ' java-library'
34 id ' maven-publish'
4- id ' idea'
5- id ' net.neoforged.moddev' version ' 2.0.140'
5+ id ' net.neoforged.moddev.legacyforge' version ' 2.0.91'
6+ }
7+
8+ tasks. named(' wrapper' , Wrapper ). configure {
9+ // Define wrapper values here so as to not have to always do so when updating gradlew.properties.
10+ // Switching this to Wrapper.DistributionType.ALL will download the full gradle sources that comes with
11+ // documentation attached on cursor hover of gradle classes and methods. However, this comes with increased
12+ // file size for Gradle. If you do switch this to ALL, run the Gradle wrapper task twice afterwards.
13+ // (Verify by checking gradle/wrapper/gradle-wrapper.properties to see if distributionUrl now points to `-all`)
14+ distributionType = Wrapper.DistributionType . BIN
615}
716
817version = mod_version
@@ -11,52 +20,57 @@ group = mod_group_id
1120repositories {
1221 mavenLocal()
1322 mavenCentral()
23+ gradlePluginPortal()
1424 maven {
1525 name = " TerraformersMC"
1626 url = " https://maven.terraformersmc.com/"
1727 }
28+ maven {
29+ name = " Modmaven"
30+ url = " https://modmaven.dev/"
31+ }
1832}
1933
2034base {
2135 archivesName = mod_id
2236}
2337
24- java. toolchain. languageVersion = JavaLanguageVersion . of(21 )
38+ // Mojang ships Java 17 to end users in 1.20.1, so mods should target Java 17.
39+ java. toolchain. languageVersion = JavaLanguageVersion . of(17 )
2540
26- neoForge {
27- // Specify the version of NeoForge to use.
28- version = project. neo_version
41+ legacyForge {
42+ // Specify the version of MinecraftForge to use.
43+ version = project. minecraft_version + ' - ' + project . forge_version
2944
3045 parchment {
3146 mappingsVersion = project. parchment_mappings_version
3247 minecraftVersion = project. parchment_minecraft_version
3348 }
3449
3550 // This line is optional. Access Transformers are automatically detected
36- // accessTransformers.add ('src/main/resources/META-INF/accesstransformer.cfg')
51+ // accessTransformers = project.files ('src/main/resources/META-INF/accesstransformer.cfg')
3752
3853 // Default run configurations.
3954 // These can be tweaked, removed, or duplicated as needed.
4055 runs {
4156 client {
4257 client()
43-
4458 // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
45- systemProperty ' neoforge .enabledGameTestNamespaces' , project. mod_id
59+ systemProperty ' forge .enabledGameTestNamespaces' , project. mod_id
4660 }
4761
4862 server {
4963 server()
5064 programArgument ' --nogui'
51- systemProperty ' neoforge .enabledGameTestNamespaces' , project. mod_id
65+ systemProperty ' forge .enabledGameTestNamespaces' , project. mod_id
5266 }
5367
5468 // This run config launches GameTestServer and runs all registered gametests, then exits.
5569 // By default, the server will crash when no gametests are provided.
5670 // The gametest system is also enabled by default for other run configs under the /test command.
5771 gameTestServer {
5872 type = " gameTestServer"
59- systemProperty ' neoforge .enabledGameTestNamespaces' , project. mod_id
73+ systemProperty ' forge .enabledGameTestNamespaces' , project. mod_id
6074 }
6175
6276 data {
@@ -99,40 +113,71 @@ neoForge {
99113// Include resources generated by data generators.
100114sourceSets. main. resources { srcDir ' src/generated/resources' }
101115
116+ // Sets up a dependency configuration called 'localRuntime' and a deobfuscating one called 'modLocalRuntime'
117+ // These configurations should be used instead of 'runtimeOnly' to declare
118+ // a dependency that will be present for runtime testing but that is
119+ // "optional", meaning it will not be pulled by dependents of this mod.
120+ configurations {
121+ runtimeClasspath. extendsFrom localRuntime
122+ }
123+ obfuscation {
124+ createRemappingConfiguration(configurations. localRuntime)
125+ }
102126
103127dependencies {
104- implementation " org.appliedenergistics:appliedenergistics2:${ ae2_version} "
105- implementation " dev.emi:emi-neoforge:${ emi_version} "
128+ modCompileOnly " appeng:appliedenergistics2-forge:15.4.10"
129+ // modImplementation "org.appliedenergistics:guideme:20.1.14"
130+ modCompileOnly " dev.emi:emi-forge:1.1.22+1.20.1"
131+ // compileOnly "io.github.llamalad7:mixinextras-common:0.3.5"
132+ //
133+ // implementation "io.github.llamalad7:mixinextras-forge:0.3.5"
106134}
107135
136+ // Uncomment the lines below if you wish to configure mixin. The mixin file should be named modid.mixins.json.
137+
138+ mixin {
139+ add sourceSets. main, " ${ mod_id} .refmap.json"
140+ config " ${ mod_id} .mixins.json"
141+ }
142+
143+ dependencies {
144+ annotationProcessor ' org.spongepowered:mixin:0.8.5:processor'
145+ // annotationProcessor "io.github.llamalad7:mixinextras-common:0.3.5"
146+ }
147+
148+ jar {
149+ manifest. attributes([
150+ " MixinConfigs" : " ${ mod_id} .mixins.json"
151+ ])
152+ }
153+
154+
108155// This block of code expands all declared replace properties in the specified resource targets.
109156// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
110157var generateModMetadata = tasks. register(" generateModMetadata" , ProcessResources ) {
111- var replaceProperties = [minecraft_version : minecraft_version,
112- minecraft_version_range : minecraft_version_range,
113- neo_version : neo_version,
114- neo_version_range : neo_version_range,
115- loader_version_range : loader_version_range,
116- mod_id : mod_id,
117- mod_name : mod_name,
118- mod_license : mod_license,
119- mod_version : mod_version,
120- mod_authors : mod_authors,
121- mod_description : mod_description,
122- ae2_version : ae2_version,
123- emi_version : emi_version,
158+ var replaceProperties = [
159+ minecraft_version : minecraft_version,
160+ minecraft_version_range : minecraft_version_range,
161+ forge_version : forge_version,
162+ forge_version_range : forge_version_range,
163+ loader_version_range : loader_version_range,
164+ mod_id : mod_id,
165+ mod_name : mod_name,
166+ mod_license : mod_license,
167+ mod_version : mod_version,
168+ mod_authors : mod_authors,
169+ mod_description : mod_description
124170 ]
125171 inputs. properties replaceProperties
126172 expand replaceProperties
127173 from " src/main/templates"
128174 into " build/generated/sources/modMetadata"
129175}
130-
131176// Include the output of "generateModMetadata" as an input directory for the build
132177// this works with both building through Gradle and the IDE.
133178sourceSets. main. resources. srcDir generateModMetadata
134179// To avoid having to run "generateModMetadata" manually, make it run on every project reload
135- neoForge . ideSyncTask generateModMetadata
180+ legacyForge . ideSyncTask generateModMetadata
136181
137182// Example configuration to allow publishing using the maven-publish plugin
138183publishing {
@@ -148,6 +193,10 @@ publishing {
148193 }
149194}
150195
196+ tasks. withType(JavaCompile ). configureEach {
197+ options. encoding = ' UTF-8' // Use the UTF-8 charset for Java compilation
198+ }
199+
151200// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
152201idea {
153202 module {
0 commit comments