Posted November 10, 20222 yr I'm currently trying to modify an already existing mod, and everything works as intended in the IDE (IntelliJ Idea Community) with runClient. But when I export the jar (via the gradle task), it crashes my client (or server). I already tried re-cloning the repo and loading the project again but this doesn't fix anything. I tried commenting the part of the code that make this crash but something else crashes (java.lang.NoSuchClass) so I think there is a dependency or else missing but I don't know how to fix it. Below is the crash-report. Time: 10/11/22 20:10 Description: Mod loading error has occurred java.lang.Exception: Mod Loading has failed at net.minecraftforge.fml.CrashReportExtender.dumpModLoadingCrashReport(CrashReportExtender.java:71) ~[forge:?] {re:classloading} at net.minecraftforge.fml.server.ServerModLoader.load(ServerModLoader.java:37) ~[forge:?] {re:classloading} at net.minecraft.server.Main.main(Main.java:95) ~[?:?] {re:classloading} at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_351] {} at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_351] {} at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_351] {} at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_351] {} at net.minecraftforge.fml.loading.FMLServerLaunchProvider.lambda$launchService$0(FMLServerLaunchProvider.java:37) ~[forge-1.16.5-36.2.39.jar:36.2] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.1.3.jar:?] {} at net.minecraftforge.server.ServerMain$Runner.runLauncher(ServerMain.java:49) [forge-1.16.5-36.2.39.jar:?] {} at net.minecraftforge.server.ServerMain$Runner.access$100(ServerMain.java:46) [forge-1.16.5-36.2.39.jar:?] {} at net.minecraftforge.server.ServerMain.main(ServerMain.java:43) [forge-1.16.5-36.2.39.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: main Stacktrace: at net.tardis.mod.world.structures.TStructures.registerStructurePiece(TStructures.java:173) ~[tardis:1.5.4] {re:classloading} -- MOD tardis -- Details: Mod File: Tardis-Mod-1.16.5-1.5.4.jar Failure message: Tardis Mod (tardis) has failed to load correctly java.lang.NoSuchFieldError: STRUCTURE_PIECE Mod Version: 1.5.4 Mod Issue URL: https://gitlab.com/Spectre0987/TardisMod-1-14/issues Exception message: java.lang.NoSuchFieldError: STRUCTURE_PIECE Stacktrace: at net.tardis.mod.world.structures.TStructures.registerStructurePiece(TStructures.java:173) ~[tardis:1.5.4] {re:classloading} at net.tardis.mod.world.structures.TStructures$Structures.<clinit>(TStructures.java:37) ~[tardis:1.5.4] {re:classloading} at net.tardis.mod.Tardis.<init>(Tardis.java:139) ~[tardis:1.5.4] {re:classloading} at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_351] {} at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_351] {} at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_351] {} at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_351] {} at java.lang.Class.newInstance(Unknown Source) ~[?:1.8.0_351] {} at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:67) ~[forge:36.2] {re:classloading} at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:106) ~[forge:?] {re:classloading} at java.util.concurrent.CompletableFuture$AsyncRun.run(Unknown Source) ~[?:1.8.0_351] {} at java.util.concurrent.CompletableFuture$AsyncRun.exec(Unknown Source) ~[?:1.8.0_351] {} at java.util.concurrent.ForkJoinTask.doExec(Unknown Source) ~[?:1.8.0_351] {} at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(Unknown Source) ~[?:1.8.0_351] {} at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source) ~[?:1.8.0_351] {} at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source) ~[?:1.8.0_351] {} buildscript { repositories { maven { url = 'https://maven.minecraftforge.net' } maven { url='https://repo.spongepowered.org/repository/maven-public' } jcenter() mavenCentral() } dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1+', changing: true classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT' classpath "gradle.plugin.com.matthewprenger:CurseGradle:1.4.0" } } apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.spongepowered.mixin' apply plugin: 'eclipse' apply plugin: 'maven-publish' apply plugin: "com.matthewprenger.cursegradle" version = "${mod_version}" group = "${mod_base_package}" archivesBaseName = "${project.jar_name}-${minecraft_version}" java.toolchain.languageVersion = JavaLanguageVersion.of(8) minecraft { mappings channel: "${mappings_channel}", version: "${mappings_version}" runs { client { workingDirectory project.file('run') arg "-mixin.config=tardis.mixins.json" property 'mixin.env.remapRefMap', 'true' property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg" property 'forge.logging.console.level', 'debug' mods { "${mod_id}" { source sourceSets.main } } } server { workingDirectory project.file('run') property 'mixin.env.remapRefMap', 'true' property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg" property 'forge.logging.console.level', 'debug' mods { "${mod_id}" { source sourceSets.main } } } data { workingDirectory project.file('run') property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' property 'forge.logging.console.level', 'debug' property 'mixin.env.remapRefMap', 'true' property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg" args '--mod', mod_id, '--all', '--output', file('src/main/generated/') mods { "${mod_id}" { source sourceSets.main } } } } accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') } mixin { add sourceSets.main, "${mod_id}.refmap.json" } repositories{ maven { url "https://dvs1.progwml6.com/files/maven/" } //JEI Maven maven { url "https://maven.blamejared.com/" } // IE Maven maven { url "https://www.cursemaven.com" } //Curse Maven //maven { url "https://maven.enginehub.org/repo/" } //WorldEdit Maven maven { url 'https://modmaven.dev/' } //Mekanism Maven } dependencies { minecraft "net.minecraftforge:forge:${forge_version}" annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor" //compileOnly fg.deobf("blusunrize.immersiveengineering:ImmersiveEngineering:${ie_version}") //runtimeOnly fg.deobf("blusunrize.immersiveengineering:ImmersiveEngineering:${ie_version}") compileOnly fg.deobf("mezz.jei:jei-${jei_version}:api") runtimeOnly fg.deobf("mezz.jei:jei-${jei_version}") runtimeOnly fg.deobf("curse.maven:configured-457570:${configured_version}") runtimeOnly fg.deobf("curse.maven:terraforged-363820:3451426") //runtimeOnly ("com.sk89q.worldedit:worldedit-core:${world_edit_version}") //runtimeOnly fg.deobf("com.sk89q.worldedit:worldedit-forge-mc${world_edit_mc_version}:${world_edit_version}") runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}")// core runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}:generators")// Mekanism: Generators } //Reference: https://github.com/SizableShrimp/ForgeTemplate/blob/1.16.x/build.gradle#L158-L188 def resourceTargets = ['META-INF/mods.toml', 'pack.mcmeta'] def intoTargets = ["$rootDir/out/production/resources/", "$rootDir/out/production/${project.name}.main/", "$rootDir/bin/main/"] def replaceProperties = [mod_id: mod_id, mod_name: mod_name, mod_version: mod_version, mod_authors: mod_authors, credits:credits, mod_description: mod_description, display_url:display_url, logo_file:logo_file, issue_tracker_url: issue_tracker_url, update_json_url: update_json_url, license: license, forge_version_range: forge_version_range, minecraft_version_range: minecraft_version_range, loader_version_range: loader_version_range] processResources { inputs.properties replaceProperties replaceProperties.put 'project', project filesMatching(resourceTargets) { expand replaceProperties } intoTargets.each { target -> if (file(target).exists()) { copy { from(sourceSets.main.resources) { include resourceTargets expand replaceProperties } into target } } } } jar { manifest { attributes([ "Specification-Title" : mod_id, "Specification-Vendor" : mod_authors, "Specification-Version" : "1.0.0", "Implementation-Title" : project.name, "Implementation-Version" : mod_version, "Implementation-Vendor" : mod_authors, "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), "MixinConfigs": "${mod_id}.mixins.json" ]) } } def reobfFile = file("$buildDir/reobfJar/output.jar") def reobfArtifact = artifacts.add('default', reobfFile) { type 'jar' builtBy 'reobfJar' } publishing { publications { mavenJava(MavenPublication) { artifact reobfArtifact } } repositories { maven { url "file:///${project.projectDir}/mcmodsrepo" } } } And here is the build.gradle
November 10, 20222 yr It's looking for a field called STRUCTURE_PIECE here: net.tardis.mod.world.structures.TStructures.registerStructurePiece(TStructures.java:173) ~[tardis:1.5.4] {re:classloading}, so go to that file, at the registerStructurePiece function on line 173 and see what's going on You're using IntelliJ, it's got one of the most powerful debugging tools available, use it to your advantage. whack a breakpoint on the function and have a see what's going on.
November 11, 20222 yr Author I already tried doing that by commenting this part of the code but there's always something crashing the mod elsewhere there seems to be a dependency missing.
November 11, 20222 yr Don't comment it out, walk through it, if you're certain it's a dependency, look here: dependencies { minecraft "net.minecraftforge:forge:${forge_version}" annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor" //compileOnly fg.deobf("blusunrize.immersiveengineering:ImmersiveEngineering:${ie_version}") //runtimeOnly fg.deobf("blusunrize.immersiveengineering:ImmersiveEngineering:${ie_version}") compileOnly fg.deobf("mezz.jei:jei-${jei_version}:api") runtimeOnly fg.deobf("mezz.jei:jei-${jei_version}") runtimeOnly fg.deobf("curse.maven:configured-457570:${configured_version}") runtimeOnly fg.deobf("curse.maven:terraforged-363820:3451426") //runtimeOnly ("com.sk89q.worldedit:worldedit-core:${world_edit_version}") //runtimeOnly fg.deobf("com.sk89q.worldedit:worldedit-forge-mc${world_edit_mc_version}:${world_edit_version}") runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}")// core runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}:generators")// Mekanism: Generators } There's your dependency tree. Make sure you have those in your mod folder when you start it up Commenting out random bits of code could well cause an issue elsewhere, which you need to check for, which means looking over this code a bit more, it's to do with STRUCTURE_PIECE. So, what is it? when is it made? why is it needed? Is this erroring function's result used elsewhere in the code? Use your debugger. Don't just comment out code without checking what it's used for first.
November 11, 20222 yr Author How can I debug this? The issue only appears when launching mc client or mc server oustide the ide. When I launch in the IDE using runClient, it all works perfectly.
November 11, 20222 yr Author Thanks for your help, I finally figured it out. It seems that the gradle build task in IntelliJ is not from the same gradle so I used gradlew build via command line in the project repertory and it built properly.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.