Posted July 17, 20241 yr Hi, I am trying to use a shadowed dependency in my mod for version 1.8.9, but I just can't get it fully working. I think the shadowing is working (at least a little) because I can use the dependency in my mod without getting a classdefnotfound, but if I actually try to use the dependency it just crashes with this error: The error: Spoiler net.minecraftforge.fml.common.LoaderException: java.lang.ExceptionInInitializerError at net.minecraftforge.fml.common.LoadController.transition(LoadController.java:162) at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:739) at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:310) at net.minecraft.client.Minecraft.startGame(Minecraft.java:495) at net.minecraft.client.Minecraft.run(Minecraft.java:329) at net.minecraft.client.main.Main.main(SourceFile:124) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at gg.essential.loader.stage2.relaunch.Relaunch.relaunch(Relaunch.java:124) at gg.essential.loader.stage2.EssentialLoader.preloadEssential(EssentialLoader.java:220) at gg.essential.loader.stage2.EssentialLoader.loadPlatform(EssentialLoader.java:116) at gg.essential.loader.stage2.EssentialLoaderBase.load(EssentialLoaderBase.java:148) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at gg.essential.loader.stage1.EssentialLoaderBase.load(EssentialLoaderBase.java:293) at gg.essential.loader.stage1.EssentialSetupTweaker.<init>(EssentialSetupTweaker.java:44) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at gg.essential.loader.stage0.EssentialSetupTweaker.loadStage1(EssentialSetupTweaker.java:53) at gg.essential.loader.stage0.EssentialSetupTweaker.<init>(EssentialSetupTweaker.java:26) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:98) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:243) at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:278) at org.multimc.EntryPoint.listen(EntryPoint.java:143) at org.multimc.EntryPoint.main(EntryPoint.java:34) Caused by: java.lang.ExceptionInInitializerError at me.ryan.ryanair.deps.moulconfig.processor.BuiltinMoulConfigGuis.addProcessors(BuiltinMoulConfigGuis.java:57) at me.ryan.ryanair.config.ConfigManager.init(ConfigManager.java:16) at me.ryan.ryanair.RyanairMod.init(RyanairMod.java:40) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:560) at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:211) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:189) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:737) ... 45 more Caused by: java.util.NoSuchElementException: Collection is empty. at kotlin.collections.CollectionsKt___CollectionsKt.first(_Collections.kt:201) at me.ryan.ryanair.deps.moulconfig.common.IMinecraft.<clinit>(IMinecraft.kt:60) ... 74 more I have no idea if this is me using the dependency wrong, me shadowing the dependency wrong, or the dependency just being broken. Can someone maybe check if something obvious is wrong? Thanks in advance! I have provided everything I could think of, if something more is needed, please tell me. Dependency I am trying to shadow into my jar: https://github.com/NotEnoughUpdates/MoulConfig I have downloaded this dependency as "/libs/legacy-3.0.0-beta.13.jar" Example of how the dependency should work (their own example): https://github.com/NotEnoughUpdates/MoulConfig/blob/master/legacy/src/main/java/io/github/notenoughupdates/moulconfig/test/MoulConfigTest.java Example of how the dependency should work (another mod written in kotlin (see line 91)): https://github.com/hannibal002/SkyHanni/blob/beta/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt My ConfigManager.java (Where it breaks (see comment on line 16)): Spoiler package me.ryan.ryanair.config; import io.github.notenoughupdates.moulconfig.processor.BuiltinMoulConfigGuis; import io.github.notenoughupdates.moulconfig.processor.ConfigProcessorDriver; import io.github.notenoughupdates.moulconfig.processor.MoulConfigProcessor; import me.ryan.ryanair.player.Player; import net.minecraft.client.gui.GuiScreen; public class ConfigManager { public static GuiScreen screenToOpen = null; private static final RyanairConfig con = new RyanairConfig(); public static void init(){ // MoulConfigProcessor<TestConfig> processor = new MoulConfigProcessor<>(testConfig); MoulConfigProcessor<RyanairConfig> processor = new MoulConfigProcessor<>(con); //LINE THAT CRASHES BuiltinMoulConfigGuis.addProcessors(processor); ConfigProcessorDriver driver = new ConfigProcessorDriver(processor); driver.checkExpose = false; driver.processConfig(con); con.testCategory.text2.whenChanged((oldValue, newValue) -> Player.sendChatMessage("Just changed text2 from " + oldValue + " to " + newValue)); } } My FMLInitializationEvent: Spoiler @EventHandler public void init(FMLInitializationEvent event){ MinecraftForge.EVENT_BUS.register(new ItemTooltipListener(this)); MinecraftForge.EVENT_BUS.register(new TickListener(this)); MinecraftForge.EVENT_BUS.register(new KeyInputListener(this)); ClientCommandHandler.instance.registerCommand(new StonkPriceCommand()); ClientRegistry.registerKeyBinding(debugKey); ConfigManager.init(); //THIS LINE CRASHES } My build.gradle file (gradle 4.5): (I run the tasks: "build shadowJar copyJarToBin" to build my mod) Spoiler import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar // For those who want the bleeding edge buildscript { repositories { jcenter() maven { name = "forge" url = "http://files.minecraftforge.net/maven" } maven{ name = "neu" url = "https://maven.notenoughupdates.org/releases" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT' classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4' } } apply plugin: 'net.minecraftforge.gradle.forge' apply plugin: 'com.github.johnrengelman.shadow' /* // for people who want stable - not yet functional for MC 1.8.8 - we require the forgegradle 2.1 snapshot plugins { id "net.minecraftforge.gradle.forge" version "2.0.2" } */ project.sourceCompatibility = '1.8' project.targetCompatibility = '1.8' version = "1.1" group= "me.ryan.ryanair" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "ryanair" minecraft { version = "1.8.9-11.15.1.2318-1.8.9" runDir = "run" // the mappings can be changed at any time, and must be in the following format. // snapshot_YYYYMMDD snapshot are built nightly. // stable_# stables are built at the discretion of the MCP team. // Use non-default mappings at your own risk. they may not allways work. // simply re-run your setup task after changing the mappings to update your workspace. mappings = "stable_20" // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. // launchConfigs { // client { // arg '--tweakClass', 'io.github.notenoughupdates.moulconfig.tweaker.DevelopmentResourceTweaker' // } // } } configurations { shadowModImpl modImplementation.extendsFrom shadowModImpl } dependencies { shadowModImpl files('libs/legacy-3.0.0-beta.13.jar') } dependencies { // you may put jars on which you depend on in ./libs // or you may define them like so.. //compile "some.group:artifact:version:classifier" //compile "some.group:artifact:version" // real examples // compile 'io.github.notenoughupdates:moulconfig:' // adds neu to the dev env //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env // the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. //provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' // the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided, // except that these dependencies get remapped to your current MCP mappings //deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev' //deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev' // for more info... // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html // http://www.gradle.org/docs/current/userguide/dependency_management.html } tasks.withType(ShadowJar) { configurations = [project.configurations.shadowModImpl] relocate 'io.github.notenoughupdates.moulconfig', 'me.ryan.ryanair.deps.moulconfig' finalizedBy 'reobfShadowJar' } processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' // replace version and mcversion expand 'version':project.version, 'mcversion':project.minecraft.version } // copy everything else, thats not the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } } assemble.dependsOn shadowJar reobf { shadowJar {} } task copyJarToBin(type: Copy) { from "${buildDir}/libs/ryanair-${project.version}-all.jar" into "C:\\Users\\ryanv\\Desktop\\programmas\\handige mc shit\\MultiMC\\instances\\1.8.9\\.minecraft\\mods" }
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.