From 7372f96a52abc04b5844044a874be988d79cf751 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Thu, 7 Dec 2023 14:56:54 +1100 Subject: [PATCH] Gradle fixes for Forge --- Forge/build.gradle | 28 ++++++++++------------------ gradle.properties | 2 +- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/Forge/build.gradle b/Forge/build.gradle index 16e6fa5..64d7a26 100644 --- a/Forge/build.gradle +++ b/Forge/build.gradle @@ -17,12 +17,6 @@ minecraft { args "-mixin.config=${mod_id}.mixins.json", "-mixin.config=${mod_id}_forge.mixins.json" ideaModule "${rootProject.name}.${project.name}.main" taskName 'Client' - mods { - modClientRun { - source sourceSets.main - source project(":Common").sourceSets.main - } - } } server { @@ -30,12 +24,6 @@ minecraft { args "-mixin.config=${mod_id}.mixins.json", "-mixin.config=${mod_id}_forge.mixins.json" ideaModule "${rootProject.name}.${project.name}.main" taskName 'Server' - mods { - modServerRun { - source sourceSets.main - source project(":Common").sourceSets.main - } - } } data { @@ -43,12 +31,6 @@ minecraft { ideaModule "${rootProject.name}.${project.name}.main" args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/'), "-mixin.config=${mod_id}.mixins.json", "-mixin.config=${mod_id}_forge.mixins.json" taskName 'Data' - mods { - modDataRun { - source sourceSets.main - source project(":Common").sourceSets.main - } - } } } } @@ -77,6 +59,16 @@ tasks.withType(JavaCompile) { source(project(":Common").sourceSets.main.allSource) } +// Merge the resources and classes into the same directory. +// This is done because java expects modules to be in a single directory. +// And if we have it in multiple we have to do performance intensive hacks like having the UnionFileSystem +// This will eventually be migrated to ForgeGradle so modders don't need to manually do it. But that is later. +sourceSets.each { + def dir = layout.buildDirectory.dir("sourcesSets/$it.name") + it.output.resourcesDir = dir + it.java.destinationDirectory = dir +} + processResources { from project(":Common").sourceSets.main.resources diff --git a/gradle.properties b/gradle.properties index 4b65da1..03c853d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ common_client_run_name=Common Client common_server_run_name=Common Server # Forge -forge_version=49.0.1 +forge_version=49.0.2 # NeoForge neoforge_version=20.3.6-beta