diff --git a/build.gradle b/build.gradle index bcdd491..e1ec009 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,5 @@ plugins { id 'java-library' - id 'eclipse' - id 'idea' id 'maven-publish' id 'net.neoforged.moddev' version '1.0.14' } @@ -139,9 +137,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, @@ -156,11 +152,15 @@ 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" } +// Include the output of "generateModMetadata" as an input directory for the build +// this works with both building through Gradle and the IDE. +sourceSets.main.resources.srcDir generateModMetadata +// To avoid having to run "generateModMetadata" manually, make it run on every project reload +neoForge.ideSyncTask generateModMetadata // Example configuration to allow publishing using the maven-publish plugin publishing { diff --git a/src/main/resources/META-INF/neoforge.mods.toml b/src/main/templates/META-INF/neoforge.mods.toml similarity index 100% rename from src/main/resources/META-INF/neoforge.mods.toml rename to src/main/templates/META-INF/neoforge.mods.toml