Skip to content

Commit

Permalink
Gradle fixes for Forge
Browse files Browse the repository at this point in the history
  • Loading branch information
Adubbz committed Dec 7, 2023
1 parent 8fe1e37 commit 7372f96
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
28 changes: 10 additions & 18 deletions Forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,20 @@ 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 {
workingDirectory project.file('run')
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 {
workingDirectory project.file('run')
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
}
}
}
}
}
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7372f96

Please sign in to comment.