Skip to content

Commit

Permalink
Make neoforge.mods.toml a generated resource, making it compatible wi…
Browse files Browse the repository at this point in the history
…th running from IDE
  • Loading branch information
shartte committed Jul 9, 2024
1 parent 52f8c94 commit 09ff5f3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.neoforged.moddev' version '0.1.126'
id 'net.neoforged.moddev' version '0.1.128'
}

tasks.named('wrapper', Wrapper).configure {
Expand Down Expand Up @@ -139,9 +139,7 @@ dependencies {

// This block of code expands all declared replace properties in the specified resource targets.
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
tasks.withType(ProcessResources).configureEach {
var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
var replaceProperties = [
minecraft_version : minecraft_version,
minecraft_version_range: minecraft_version_range,
Expand All @@ -156,10 +154,13 @@ tasks.withType(ProcessResources).configureEach {
mod_description : mod_description
]
inputs.properties replaceProperties

filesMatching(['META-INF/neoforge.mods.toml']) {
expand replaceProperties
}
expand replaceProperties
from("src/main/templates")
into("build/generated/sources/modMetadata")
}
sourceSets.main.resources.srcDir(generateModMetadata)
tasks.named("neoForgeIdeSync").configure {
dependsOn generateModMetadata
}

// Example configuration to allow publishing using the maven-publish plugin
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ minecraft_version=1.21
# as they do not follow standard versioning conventions.
minecraft_version_range=[1.21,1.21.1)
# The Neo version must agree with the Minecraft version to get a valid artifact
neo_version=21.0.0-beta
neo_version=21.0.78-beta
# The Neo version range can use any version of Neo as bounds
neo_version_range=[21.0.0-beta,)
# The loader version range can only use the major version of FML as bounds
Expand Down

0 comments on commit 09ff5f3

Please sign in to comment.