I am a first time minecraft mod maker, but an intermediate programmer (thankfully, Java is my first language not counting English lmao) so while I can understand what the error is trying to tell me, I don't know how to fix it.
My mod id is testmod, I am going through the forge documentation here. I am at part 1 of "building and testing your mod" at the bottom.
I am running .\gradlew build
inside windows terminal, here's the error:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\[my username]\Documents\Minecraft Mods\testMod\build.gradle' line: 154
* What went wrong:
Could not determine the dependencies of task ':classes'.
> Could not create task ':processResources'.
> Could not get unknown property 'testmod' for task ':processResources' of type org.gradle.language.jvm.tasks.ProcessResources.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 7s
I looked at line 154 of build.gradle, here's that line as well as context:
tasks.named('processResources', ProcessResources).configure {
var replaceProperties = [
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
forge_version: forge_version, forge_version_range: forge_version_range,
loader_version_range: loader_version_range,
testmod: testmod, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
mod_authors: mod_authors, mod_description: mod_description,
]
inputs.properties replaceProperties
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
expand replaceProperties + [project: project]
}
}
var replaceProperties
is defining a Groovy map, which is being used to expand template variables in your mods.toml
.
Specifically, when you write "testmod: testmod", you are mapping the key "testmod" to the variable "testmod". However, that variable is not defined in scope, which is causing the error.
You should probably put parentheses around "testmod", i.e. testmod: "testmod", mod_name:
However, it doesn't really make sense to have a variable with the same name as your mod id. You probably should do mod_name: "testmod"
instead or something like that.