@@ -3,100 +3,63 @@ import net.darkhax.curseforgegradle.TaskPublishCurseForge
33plugins {
44 id ' multiloader-loader'
55 alias libs. plugins. forgeGradle
6- alias libs. plugins. mixin
76 alias libs. plugins. curseForgeGradle
87 alias libs. plugins. modrinthMinotaur
98}
109
11- mixin {
12- config(" ${ mod_id} .mixins.json" )
13- config(" ${ mod_id} .forge.mixins.json" )
14- }
15-
16- jar {
17- manifest {
18- attributes[" MixinConfigs" ] = " ${ mod_id} .mixins.json,${ mod_id} .forge.mixins.json"
19- }
20- }
10+ java. toolchain. languageVersion = JavaLanguageVersion . of(21 )
2111
2212minecraft {
2313 mappings channel : ' official' , version : libs. minecraft. get(). version
2414
25- copyIdeResources = true // Calls processResources when in dev
26-
27- reobf = false // Forge 1.20.6+ uses official mappings at runtime, so we shouldn't reobf from official to SRG
28-
29- // Automatically enable forge AccessTransformers if the file exists
30- def at = file(' src/main/resources/META-INF/accesstransformer.cfg' )
31- if (at. exists()) {
32- accessTransformer = at
33- }
34-
3515 runs {
36- client {
37- workingDirectory file(' runs/client' )
38- ideaModule " ${ rootProject.name} .${ project.name} .main"
39- taskName " Client"
40-
41- property ' forge.enabledGameTestNamespaces' , mod_id
42-
43- mods {
44- modClientRun {
45- source sourceSets. main
46- }
47- }
48- }
49-
50- server {
51- workingDirectory file(' runs/server' )
52- ideaModule " ${ rootProject.name} .${ project.name} .main"
53- taskName " Server"
54-
55- property ' forge.enabledGameTestNamespaces' , mod_id
56-
57- mods {
58- modServerRun {
59- source sourceSets. main
60- }
61- }
16+ configureEach {
17+ workingDir. convention layout. projectDirectory. dir(' run' )
18+ // Mixin requires either specifying the config via command line, or in the Manifest
19+ args " --mixin.config=${ mod_id} .mixins.json,${ mod_id} -api.mixins.json,${ mod_id} -forge.mixins.json"
6220 }
6321
64- data {
65- workingDirectory file(' runs/data' )
66- ideaModule " ${ rootProject.name} .${ project.name} .main"
67- args ' --mod' , mod_id, ' --all' , ' --output' , file(' src/generated/resources/' ), ' --existing' , file(' src/main/resources/' )
68- taskName " Data"
69-
70- mods {
71- modDataRun {
72- source sourceSets. main
73- }
74- }
22+ register(' client' ) {
23+ systemProperty ' forge.enabledGameTestNamespaces' , mod_id
7524 }
7625 }
7726}
7827
79- sourceSets. main. resources. srcDir ' src/generated/resources'
28+ repositories {
29+ maven minecraft. mavenizer
30+ maven fg. forgeMaven
31+ maven fg. minecraftLibsMaven
32+ mavenCentral()
33+ }
8034
8135dependencies {
8236 def mcVersion = libs. minecraft. get(). version
8337 def forgeVersion = libs. forge. get(). version
84- minecraft " net.minecraftforge:forge:${ mcVersion} -${ forgeVersion} "
85- def mixinVersion = libs. mixin. get(). version
86- annotationProcessor " org.spongepowered:mixin:${ mixinVersion} :processor"
38+ implementation minecraft. dependency(" net.minecraftforge:forge:$mcVersion -$forgeVersion " )
39+ annotationProcessor ' net.minecraftforge:eventbus-validator:7.0-beta.10'
8740}
8841
89- apply from : rootProject. file(' repositories.gradle' )
90- apply from : ' dependencies.gradle'
42+ tasks. withType(JavaCompile ). configureEach {
43+ options. encoding = ' UTF-8' // Use the UTF-8 charset for Java compilation
44+ }
9145
92- publishing {
93- publications {
94- mavenJava(MavenPublication ) {
95- fg. component(it)
96- }
46+ tasks. named(' jar' , Jar ) {
47+ manifest {
48+ attributes[" MixinConfigs" ] = " ${ mod_id} .mixins.json,${ mod_id} .forge.mixins.json"
49+ }
50+ }
51+
52+ fgtools {
53+ configure(' mavenizer' ) {
54+ classpath = configurations. detachedConfiguration(dependencies. create(' net.minecraftforge:minecraft-mavenizer:0.4.19' ))
9755 }
9856}
9957
58+ sourceSets. main. resources. srcDir ' src/generated/resources'
59+
60+ apply from : rootProject. file(' repositories.gradle' )
61+ apply from : ' dependencies.gradle'
62+
10063tasks. register(' curseforge' , TaskPublishCurseForge ) {
10164 dependsOn(' build' )
10265 description = ' Publishes the Forge build to CurseForge.'
@@ -132,10 +95,3 @@ modrinth {
13295 required. project " balm"
13396 }
13497}
135-
136- sourceSets. each {
137- def dir = layout. buildDirectory. dir(" sourcesSets/$it . name " )
138- it. output. resourcesDir = dir
139- it. java. destinationDirectory = dir
140- }
141-
0 commit comments