javagradleminecraftminecraft-forge

Why does my Architectury Mod project keep crashing without writing code?


I've just started working on a Minecraft Mod using the Architectury framework, and for the first couple of days everything was fine, but recently my project started having various problems, such as Gson errors (it was working fine before), javafml errors, not starting due to missing dependencies, etc. Some of these problems were fine to fix, and some forced me to delete the entire project and the . gradle folder, but today my NeoForge module is reporting errors and it is still reporting errors after I deleted the entire .gradle folder and project and rebuilt it, whereas the project that was reporting errors was working fine a few days ago. My Minecraft version: 1.20.4 My JDK: 21 (same JDK as Gradle JDK and JAVA_HOME) My Gradle version: 8.6

I've been searching the internet for a long time and changed a lot of things, but they don't seem to work.

I'd love to know how I can fix this, and I hope someone else can answer this for me, thank you very much!

You can see more code in my attachment.

This is the log (with error reporting):

"C:\Program Files\Java\jdk-21\bin\java.exe" -Dfabric.dli.config=C:\Users\stars\Documents\Learn\Code\App\Kotlin\Gradle\Minecraft@@0020Mod\OwOMod\neoforge\.gradle\loom-cache\launch.cfg -Dfabric.dli.env=client -p C:\Users\stars\.gradle\caches\modules-2\files-2.1\cpw.mods\securejarhandler\2.1.24\21e16217c30688d99200796f5d828ad5b671141c\securejarhandler-2.1.24.jar;C:\Users\stars\.gradle\caches\modules-2\files-2.1\org.ow2.asm\asm-commons\9.5\19ab5b5800a3910d30d3a3e64fdb00fd0cb42de0\asm-commons-9.5.jar;C:\Users\stars\.gradle\caches\modules-2\files-2.1\org.ow2.asm\asm-util\9.5\64b5a1fc8c1b15ed2efd6a063e976bc8d3dc5ffe\asm-util-9.5.jar;C:\Users\stars\.gradle\caches\modules-2\files-2.1\net.neoforged\JarJarFileSystems\0.4.0\ef7e5716525bbe50c784a362f9393457a33e6daf\JarJarFileSystems-0.4.0.jar;C:\Users\stars\.gradle\caches\modules-2\files-2.1\org.ow2.asm\asm\9.5\dc6ea1875f4d64fbc85e1691c95b96a3d8569c90\asm-9.5.jar;C:\Users\stars\.gradle\caches\modules-2\files-2.1\org.ow2.asm\asm-tree\9.5\fd33c8b6373abaa675be407082fdfda35021254a\asm-tree-9.5.jar;C:\Users\stars\.gradle\caches\modules-2\files-2.1\org.ow2.asm\asm-analysis\9.5\490bacc77de7cbc0be1a30bb3471072d705be4a4\asm-analysis-9.5.jar --add-modules ALL-MODULE-PATH --add-opens java.base/java.util.jar=cpw.mods.securejarhandler --add-opens java.base/java.lang.invoke=cpw.mods.securejarhandler --add-exports java.base/sun.security.util=cpw.mods.securejarhandler --add-exports jdk.naming.dns/com.sun.jndi.dns=java.naming -Dfabric.dli.main=cpw.mods.bootstraplauncher.BootstrapLauncher "-Darchitectury.main.class=C:\Users\stars\Documents\Learn\Code\App\Kotlin\Gradle\Minecraft Mod\OwOMod\neoforge\.gradle\architectury\.main_class" "-Darchitectury.runtime.transformer=C:\Users\stars\Documents\Learn\Code\App\Kotlin\Gradle\Minecraft Mod\OwOMod\neoforge\.gradle\architectury\.transforms" "-Darchitectury.properties=C:\Users\stars\Documents\Learn\Code\App\Kotlin\Gradle\Minecraft Mod\OwOMod\neoforge\.gradle\architectury\.properties" -Djdk.attach.allowAttachSelf=true "-javaagent:C:\Users\stars\Documents\Learn\Code\App\Kotlin\Gradle\Minecraft Mod\OwOMod\.gradle\architectury\architectury-transformer-agent.jar" "-javaagent:C:\Users\stars\AppData\Local\Programs\IntelliJ IDEA Community Edition\lib\idea_rt.jar=10007:C:\Users\stars\AppData\Local\Programs\IntelliJ IDEA Community Edition\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 @C:\Users\stars\AppData\Local\Temp\idea_arg_file2128017985 dev.architectury.transformer.TransformerRuntime
[Architectury Transformer] Architectury Runtime 5.2.83
[Architectury Transformer] Read classpath in 1.349 s
[Architectury Transformer] Listening at C:\Users\stars\Documents\Learn\Code\App\Kotlin\Gradle\Minecraft Mod\OwOMod\common\build\devlibs\OwOMod-1.0-dev.jar
[20:07:43] [main/INFO] (Launcher) ModLauncher running: args [--launchTarget, forgeclientuserdev, --version, 20.4.225, --assetIndex, 1.20.4-12, --assetsDir, C:\Users\stars\.gradle\caches\fabric-loom\assets, --gameDir, ., --fml.neoForgeVersion, 20.4.225, --fml.fmlVersion, 2.0.17, --fml.mcVersion, 1.20.4, --fml.neoFormVersion, 20231207.154220]
[20:07:43] [main/INFO] (Launcher) ModLauncher 10.0.9+10.0.9+main.dcd20f30 starting: java version 21.0.2 by Oracle Corporation; OS Windows 11 arch amd64 version 10.0
[20:07:43] [main/INFO] (ImmediateWindowHandler) Loading ImmediateWindowProvider fmlearlywindow
[LWJGL] [ThreadLocalUtil] Unsupported JNI version detected, this may result in a crash. Please inform LWJGL developers.
[20:07:43] [main/INFO] (EARLYDISPLAY) Trying GL version 4.6
[20:07:44] [main/INFO] (EARLYDISPLAY) Requested GL version 4.6 got version 4.6
[20:07:44] [main/INFO] (mixin) SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/C:/Users/stars/.gradle/caches/modules-2/files-2.1/net.fabricmc/sponge-mixin/0.13.1+mixin.0.8.5/618f4dff860cf2d6b5196073b1a5f5e0a8591acb/sponge-mixin-0.13.1+mixin.0.8.5.jar%23102!/ Service=ModLauncher Env=CLIENT
[20:07:44] [pool-5-thread-1/INFO] (EARLYDISPLAY) GL info: AMD Radeon(TM) Graphics GL version 4.6.0 Core Profile Context 24.3.1.240216, ATI Technologies Inc.
[20:07:44] [main/ERROR] (ModInfo) Mod 'owomod' uses deprecated 'mandatory' field in the dependency declaration for 'neoforge'. Use the 'type' field and 'required'/'optional' instead
[20:07:44] [main/ERROR] (ModDiscoverer) Locator net.neoforged.fml.loading.moddiscovery.MinecraftLocator@500e995b found an invalid mod file net.neoforged.fml.loading.moddiscovery.ModFileInfo@36c763cd
 net.neoforged.fml.loading.moddiscovery.InvalidModFileException: Deprecated 'mandatory' field is used in dependency (main)
    at net.neoforged.fml.loading.moddiscovery.ModInfo$ModVersion.lambda$new$2(ModInfo.java:228) ~[loader-2.0.17.jar%23120!/:2.0]
    at java.util.Optional.orElseGet(Optional.java:364) ~[?:?]
    at net.neoforged.fml.loading.moddiscovery.ModInfo$ModVersion.<init>(ModInfo.java:221) ~[loader-2.0.17.jar%23120!/:2.0]
    at net.neoforged.fml.loading.moddiscovery.ModInfo.lambda$new$8(ModInfo.java:102) ~[loader-2.0.17.jar%23120!/:2.0]
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708) ~[?:?]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) ~[?:?]
    at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) ~[?:?]
    at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616) ~[?:?]
    at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622) ~[?:?]
    at java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627) ~[?:?]
    at net.neoforged.fml.loading.moddiscovery.ModInfo.<init>(ModInfo.java:103) ~[loader-2.0.17.jar%23120!/:2.0]
    at net.neoforged.fml.loading.moddiscovery.ModFileInfo.lambda$new$2(ModFileInfo.java:88) ~[loader-2.0.17.jar%23120!/:2.0]
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708) ~[?:?]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) ~[?:?]
    at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) ~[?:?]
    at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616) ~[?:?]
    at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622) ~[?:?]
    at java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627) ~[?:?]
    at net.neoforged.fml.loading.moddiscovery.ModFileInfo.<init>(ModFileInfo.java:89) ~[loader-2.0.17.jar%23120!/:2.0]
    at net.neoforged.fml.loading.moddiscovery.ModFileParser.modsTomlParser(ModFileParser.java:47) ~[loader-2.0.17.jar%23120!/:2.0]
    at net.neoforged.fml.loading.moddiscovery.ModFileParser.readModList(ModFileParser.java:31) ~[loader-2.0.17.jar%23120!/:2.0]
    at net.neoforged.fml.loading.moddiscovery.ModFile.<init>(ModFile.java:72) ~[loader-2.0.17.jar%23120!/:2.0]
    at net.neoforged.fml.loading.moddiscovery.ModFile.<init>(ModFile.java:61) ~[loader-2.0.17.jar%23120!/:2.0]
    at net.neoforged.fml.loading.moddiscovery.AbstractModProvider.createMod(AbstractModProvider.java:48) ~[loader-2.0.17.jar%23120!/:2.0]
    at net.neoforged.fml.loading.moddiscovery.MinecraftLocator.lambda$scanMods$4(MinecraftLocator.java:51) ~[loader-2.0.17.jar%23120!/:2.0]
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]
    at java.util.AbstractList$RandomAccessSpliterator.forEachRemaining(AbstractList.java:722) ~[?:?]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
    at java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:310) ~[?:?]
    at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:735) ~[?:?]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) ~[?:?]
    at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) ~[?:?]
    at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616) ~[?:?]
    at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622) ~[?:?]
    at java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627) ~[?:?]
    at net.neoforged.fml.loading.moddiscovery.MinecraftLocator.scanMods(MinecraftLocator.java:55) ~[loader-2.0.17.jar%23120!/:2.0]
    at net.neoforged.fml.loading.moddiscovery.ModDiscoverer.discoverMods(ModDiscoverer.java:75) ~[loader-2.0.17.jar%23120!/:2.0]
    at net.neoforged.fml.loading.FMLLoader.beginModScan(FMLLoader.java:155) ~[loader-2.0.17.jar%23120!/:2.0]
    at net.neoforged.fml.loading.FMLServiceProvider.beginScanning(FMLServiceProvider.java:88) ~[loader-2.0.17.jar%23120!/:2.0]
    at cpw.mods.modlauncher.TransformationServiceDecorator.runScan(TransformationServiceDecorator.java:112) ~[modlauncher-10.0.9.jar%23108!/:?]
    at cpw.mods.modlauncher.TransformationServicesHandler.lambda$runScanningTransformationServices$8(TransformationServicesHandler.java:100) ~[modlauncher-10.0.9.jar%23108!/:?]
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]
    at java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1787) ~[?:?]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) ~[?:?]
    at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) ~[?:?]
    at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616) ~[?:?]
    at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622) ~[?:?]
    at java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627) ~[?:?]
    at cpw.mods.modlauncher.TransformationServicesHandler.runScanningTransformationServices(TransformationServicesHandler.java:102) ~[modlauncher-10.0.9.jar%23108!/:?]
    at cpw.mods.modlauncher.TransformationServicesHandler.initializeTransformationServices(TransformationServicesHandler.java:55) ~[modlauncher-10.0.9.jar%23108!/:?]
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:88) ~[modlauncher-10.0.9.jar%23108!/:?]
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:78) ~[modlauncher-10.0.9.jar%23108!/:?]
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) ~[modlauncher-10.0.9.jar%23108!/:?]
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) ~[modlauncher-10.0.9.jar%23108!/:?]
    at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) ~[?:?]
    at net.fabricmc.devlaunchinjector.Main.main(Main.java:86) ~[dev-launch-injector-0.2.1+build.8.jar%23185!/:?]
    at dev.architectury.transformer.TransformerRuntime.main(TransformerRuntime.java:219) ~[?:?]
[20:07:44] [main/INFO] (ModDiscoverer) Found mod file "architectury-neoforge-11.1.17.jar" of type MOD with provider net.neoforged.fml.loading.moddiscovery.ClasspathLocator@140e003e
[20:07:44] [main/INFO] (ModDiscoverer) Found mod file "12064720311035780716.jar" of type MOD with provider net.neoforged.fml.loading.moddiscovery.ClasspathLocator@140e003e
[20:07:44] [main/INFO] (ModDiscoverer) Found mod file "architectury-neoforge-11.1.17.jar" of type MOD with provider net.neoforged.fml.loading.moddiscovery.ClasspathLocator@140e003e
[20:07:44] [main/INFO] (ModDiscoverer) Found mod file "12064720311035780716.jar" of type MOD with provider net.neoforged.fml.loading.moddiscovery.ClasspathLocator@140e003e
[20:07:44] [main/INFO] (JarInJarDependencyLocator) No dependencies to load found. Skipping!
Exception in thread "main" java.lang.IllegalStateException: Failed to find system mod: minecraft
    at MC-BOOTSTRAP/fml_loader@2.0.17/net.neoforged.fml.loading.ModSorter.detectSystemMods(ModSorter.java:192)
    at MC-BOOTSTRAP/fml_loader@2.0.17/net.neoforged.fml.loading.ModSorter.buildUniqueList(ModSorter.java:156)
    at MC-BOOTSTRAP/fml_loader@2.0.17/net.neoforged.fml.loading.ModSorter.sort(ModSorter.java:50)
    at MC-BOOTSTRAP/fml_loader@2.0.17/net.neoforged.fml.loading.moddiscovery.ModValidator.stage2Validation(ModValidator.java:104)
    at MC-BOOTSTRAP/fml_loader@2.0.17/net.neoforged.fml.loading.FMLLoader.completeScan(FMLLoader.java:163)
    at MC-BOOTSTRAP/fml_loader@2.0.17/net.neoforged.fml.loading.FMLServiceProvider.completeScan(FMLServiceProvider.java:93)
    at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.TransformationServiceDecorator.onCompleteScan(TransformationServiceDecorator.java:174)
    at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.TransformationServicesHandler.lambda$triggerScanCompletion$24(TransformationServicesHandler.java:145)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
    at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1787)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
    at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
    at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
    at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622)
    at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627)
    at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.TransformationServicesHandler.triggerScanCompletion(TransformationServicesHandler.java:147)
    at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.Launcher.run(Launcher.java:95)
    at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.Launcher.main(Launcher.java:78)
    at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26)
    at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23)
    at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141)
    at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)
    at dev.architectury.transformer.TransformerRuntime.main(TransformerRuntime.java:219)

This is what's in the gradle.properties file:

org.gradle.jvmargs=-Xmx2048M

minecraft_version=1.20.4
enabled_platforms=fabric,forge

archives_base_name=OwOMod
mod_version=1.0
maven_group=org.starcloudsea.owomod

architectury_version=11.1.17

fabric_loader_version=0.15.9
fabric_api_version=0.96.11+1.20.4

neoforge_version=20.4.225

This is what's in the neoforge/src/main/resources/META-INF/mods.toml file:

modLoader="javafml"
loaderVersion="[2,)"
license="Apache 2.0"
issueTrackerURL="https://github.com/Starcloudsea/OwOMod/issues"
[[mods]] #mandatory
modId="owomod"
version="${version}"
displayName="OwOMod"
displayURL="https://starcloudsea.gitlab.io/StarseaDB/zhCN/"
logoFile="icon.png"
authors="Starcloudsea"
description='''
9
'''

[[dependencies.owomod]]
   modId="neoforge" #mandatory
   mandatory=true #mandatory
   versionRange="[20.4.225,)" #mandatory
   ordering="NONE"
   side="BOTH"

[[dependencies.owomod]]
   modId="minecraft"
   mandatory=true
   versionRange="[1.20.4,1.21)"
   ordering="NONE"
   side="BOTH"
[[mixins]]
config = "owomod.mixins.json"
[[mixins]]
config = "owomod-common.mixins.json"

By the way, OwOMod is not an official mod name, this is just a mod I made to use to learn mod creation, this mod will not be released.

I really need a solution, thanks!

This is how I created the project:

  1. Use IntelliJ IDEA plugin Minecraft Development Kit to create an Architectury project, Minecraft version is 1.20.4, JDK version is 21 (and Gradle runtime and JAVA_HOME variable are the same JDK), using Mixin. All other loaders are up to date.
  2. update Architectury Loom to 1.5-SNAPSHOT, and replace Gradle with 8.7.
  3. Remove (not delete) the Forge module and create a new NeoForge module, copy the build.gradle, gradle.properties and src folders from the Forge module to the NeoForge module.
  4. add Kotlin support to all modules (but I didn't add Kotlin support because of this error today)

It seems that if you run the NeoForge client after step 2, it will trigger an error.

The error occurs like this:

It seems that if the project is successfully built, this error occurs whether the Forge client is run or the NeoForge client is run after the replacement, even if the entire Gradle is deleted and the project is recreated.

My expected behavior: even with Kotlin configured, the Mod loads normally when launching the NeoForge client and the game starts normally.


Solution

  • The mandatory field in the dependency declarations part of mods.toml has been deprecated in favor of a new field type.

    Instead of being a true/false field, it takes required, optional, incompatible or discouraged.
    required makes the dependency required or your mod won't run (equivalent to mandatory = true) optional means the mod isn't required but compatibility exists (equivalent to mandatory = false) incompatible makes your mod not run if the dependency is loaded discouraged will warn the user when this dependency is loaded

    There is also a reason declaration which can be used to say why a dependency is needed, or why it's incompatible, or whatnot.