Posted March 10, 20169 yr Hi everyone, When I launched Minecraft with a mod I've been developing, I got a java.lang.NoSuchMethodError before the mod loading even completed. Here is the crash report: ---- Minecraft Crash Report ---- // Daisy, daisy... Time: 3/9/16 8:36 PM Description: There was a severe problem during mod loading that has caused the game to fail net.minecraftforge.fml.common.LoaderException: java.lang.NoSuchMethodError: net.minecraft.client.Minecraft.getMinecraft()Lnet/minecraft/client/Minecraft; 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.func_71384_a(Minecraft.java:495) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:329) at net.minecraft.client.main.Main.main(SourceFile:124) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) Caused by: java.lang.NoSuchMethodError: net.minecraft.client.Minecraft.getMinecraft()Lnet/minecraft/client/Minecraft; at org.redfrog404.mobycraft.Moby.init(Moby.java:46) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:560) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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) ... 10 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.8.9 Operating System: Mac OS X (x86_64) version 10.10.5 Java Version: 1.8.0_74, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 111562552 bytes (106 MB) / 358658048 bytes (342 MB) up to 1060372480 bytes (1011 MB) JVM Flags: 5 total; -Xmx1G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP 9.19 Powered by Forge 11.15.1.1764 4 mods loaded, 4 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored UCHI mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) UCHI FML{8.0.99.99} [Forge Mod Loader] (forge-1.8.9-11.15.1.1764.jar) UCHI Forge{11.15.1.1764} [Minecraft Forge] (forge-1.8.9-11.15.1.1764.jar) UCHE moby{1.0} [moby] (mobycraft-1.0-all.jar) Loaded coremods (and transformers): GL info: ' Vendor: 'ATI Technologies Inc.' Version: '2.1 ATI-1.32.25' Renderer: 'AMD Radeon R9 M290X OpenGL Engine' The file which this error is pointing to is located at https://github.com/AdityaGupta1/mobycraft/blob/master/src/src/main/java/org/redfrog404/mobycraft/Moby.java. The mod has a bunch of other JARs bundled with it into a shadow JAR. I use the shadowJar plugin in the build.gradle file to make it. I put the shadow JAR into the mods folder and got the above error. The next thing I tried was to convert the shadow JAR to a ZIP file and remove the mod files. I placed the mod files into a separate JAR, which I will call the mod JAR. I called the JAR with everything but the mod files as the dependency JAR. I tried putting both the mod JAR and the dependency JAR into the mods folder, but that gave me a different error - the mod JAR was not able to find the classes from the dependency JAR. Any suggestions on how to debug this further?
March 10, 20169 yr You are running client only code on the server. This is why we have proxies Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
March 10, 20169 yr What Draco said is true and will definitely crash the dedicated server, but I don't think it's the problem here. It looks like you're trying to use your mod in the obfuscated client without reobfuscating it. Use the build Gradle task to build and reobfuscate your mod. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
March 10, 20169 yr Author Thanks for the quick replies! When I am building my mod, I first do "./gradlew build", then "./gradlew shadowJar" to bundle the mod with the other JARs. Correct me if I'm wrong, but that should reobfuscate the mod. Here is my build.gradle file: // For those who want the bleeding edge buildscript { repositories { jcenter() maven { name = "forge" url = "http://files.minecraftforge.net/maven" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT' classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3' } } 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" } */ version = "1.0" group= "org.redfrog404.mobycraft" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "mobycraft" minecraft { version = "1.8.9-11.15.1.1762" 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. } 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" compile group: 'com.github.docker-java', name: 'docker-java', version: '2.2.1' // real examples //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft 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 } shadowJar { dependencies { include(dependency('com.github.docker-java:docker-java:2.2.1')) include(dependency('com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.1.2')) include(dependency('com.fasterxml.jackson.core:jackson-core:2.1.2')) include(dependency('com.fasterxml.jackson.core:jackson-databind:2.1.2')) include(dependency('com.fasterxml.jackson.core:jackson-annotations:2.1.1')) include(dependency('com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.1.2')) include(dependency('org.glassfish.jersey.connectors:jersey-apache-connector:2.11')) include(dependency('org.glassfish.jersey.core:jersey-common:2.11')) include(dependency('javax.annotation:javax.annotation-api:1.2')) include(dependency('org.glassfish.jersey.bundles.repackaged:jersey-guava:2.11')) include(dependency('org.glassfish.hk2:osgi-resource-locator:1.0.1')) include(dependency('javax.ws.rs:javax.ws.rs-api:2.0')) include(dependency('org.apache.httpcomponents:httpclient:4.3.1')) include(dependency('org.apache.httpcomponents:httpcore:4.3')) include(dependency('commons-logging:commons-logging:1.1.3')) include(dependency('org.glassfish.jersey.core:jersey-client:2.11')) include(dependency('org.glassfish.hk2:hk2-api:2.3.0-b05')) include(dependency('org.glassfish.hk2:hk2-utils:2.3.0-b05')) include(dependency('org.glassfish.hk2.external:aopalliance-repackaged:2.3.0-b05')) include(dependency('org.glassfish.hk2.external:javax.inject:2.3.0-b05')) include(dependency('org.glassfish.hk2:hk2-locator:2.3.0-b05')) include(dependency('org.javassist:javassist:3.18.1-GA')) include(dependency('de.gesellix:unix-socket-factory:2015-01-27T15-02-14')) include(dependency('org.apache.commons:commons-compress:1.5')) include(dependency('org.tukaani:xz:1.2')) include(dependency('commons-codec:commons-codec:1.8')) include(dependency('commons-lang:commons-lang:2.6')) include(dependency('commons-io:commons-io:2.3')) include(dependency('org.slf4j:slf4j-api:1.7.5')) include(dependency('org.slf4j:jcl-over-slf4j:1.7.12')) include(dependency('com.google.guava:guava:18.0')) include(dependency('org.bouncycastle:bcpkix-jdk15on:1.51')) include(dependency('org.bouncycastle:bcprov-jdk15on:1.51')) } } 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' } } Also, I've seen proxies in use by other mods but I never understood how they work. Is there some place I can see how to use those? Thanks!
March 10, 20169 yr Proxy is used do separate registration code that is meant for the Physical client(logical client and logical server) and Physical server(logical server only) In your main mod file you use @SidedProxy(clientSide = Refs.CLIENTPROXY, serverSide = Refs.SERVERPROXY) public static CommonProxy proxy; CLIENTPROXY and SERVERPROXY are strings that would be equal to an import line. if an import would look like import modid.ClientProxy; @SidedProxy(clientSide = "modid.ClientProxy" your clientproxy class should extend common proxy. Your mod file will now have this: @SidedProxy(clientSide = Refs.CLIENTPROXY, serverSide = Refs.SERVERPROXY) public static CommonProxy proxy; @EventHandler public void preInit (FMLPreInitializationEvent event){ proxy.preInit(); } @EventHandler public void init (FMLInitializationEvent event){ proxy.init(); } @EventHandler public void postInit (FMLPostInitializationEvent event){ proxy.postInit(); } the majority of your registration will go in CommonProxy, and any client specific stuff (KeyBindings, GUI's, etc) will go in ClientProxy. Current Project: Armerger Planned mods: Light Drafter | Ore Swords Looking for help getting a mod off the ground? Coding | Textures
March 10, 20169 yr Thanks for the quick replies! When I am building my mod, I first do "./gradlew build", then "./gradlew shadowJar" to bundle the mod with the other JARs. Correct me if I'm wrong, but that should reobfuscate the mod. It looks like the shadowJar task uses the compiled output from the main SourceSet , but ForgeGradle handles reobfuscation separately (it assembles the JAR and then reobfuscates that). It may be easier to use the shading method described here than trying to integrate the shadow plugin with ForgeGradle. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
March 10, 20169 yr I have a project that uses the shadow plugin, and I had to do it a bit of messing around but I got it to work. My build.gradle file is here but the key point is these two lines: reobf { shadowJar { mappingType = "SEARGE" } } tasks.reobfShadowJar.mustRunAfter shadowJar This tells ForgeGradle to add a reobfShadowJar task that reobfuscates the shadowJar and has it automatically run after the shadowJar task. Depending on your configuration, you may need to run reobfShadowJar manually (e.g. run gradlew shadowJar reobfShadowJar ). If you use CurseGradle you'll need to add something like this (but with 000000 replaced with your project id): afterEvaluate { tasks.curseforge240995.dependsOn reobfShadowJar } Don't make mods if you don't know Java. Check out my website: http://shadowfacts.net Developer of many mods
March 11, 20169 yr Author Thanks for all the quick resposnses again! @Shadowfacts: I tried out the two lines you posted in my build.gradle file, and I got the same error as before (NoSuchMethodError). I didn't try out the second code sample because I am not using CurseGradle. I have a project that uses the shadow plugin, and I had to do it a bit of messing around but I got it to work. My build.gradle file is here but the key point is these two lines: reobf { shadowJar { mappingType = "SEARGE" } } tasks.reobfShadowJar.mustRunAfter shadowJar This tells ForgeGradle to add a reobfShadowJar task that reobfuscates the shadowJar and has it automatically run after the shadowJar task. Depending on your configuration, you may need to run reobfShadowJar manually (e.g. run gradlew shadowJar reobfShadowJar ). If you use CurseGradle you'll need to add something like this (but with 000000 replaced with your project id): afterEvaluate { tasks.curseforge240995.dependsOn reobfShadowJar } @Choonster: After trying out shadowfacts' code, I switched to the "shade" plugin and used that instead. This time I got a different error: * What went wrong: Execution failed for task ':reobfJar'. > java.util.zip.ZipException: duplicate entry: org/apache/commons/logging/Log.class Here is my new build.gradle file: // For those who want the bleeding edge buildscript { repositories { jcenter() maven { name = "forge" url = "http://files.minecraftforge.net/maven" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT' } } apply plugin: 'net.minecraftforge.gradle.forge' /* // 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" } */ version = "1.0" group= "org.redfrog404.mobycraft" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "mobycraft" minecraft { version = "1.8.9-11.15.1.1762" 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. } configurations { shade compile.extendsFrom shade } dependencies { shade 'com.github.docker-java:docker-java:2.2.1' shade 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.1.2' shade 'com.fasterxml.jackson.core:jackson-core:2.1.2' shade 'com.fasterxml.jackson.core:jackson-databind:2.1.2' shade 'com.fasterxml.jackson.core:jackson-annotations:2.1.1' shade 'com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.1.2' shade 'org.glassfish.jersey.connectors:jersey-apache-connector:2.11' shade 'org.glassfish.jersey.core:jersey-common:2.11' shade 'javax.annotation:javax.annotation-api:1.2' shade 'org.glassfish.jersey.bundles.repackaged:jersey-guava:2.11' shade 'org.glassfish.hk2:osgi-resource-locator:1.0.1' shade 'javax.ws.rs:javax.ws.rs-api:2.0' shade 'org.apache.httpcomponents:httpclient:4.3.1' shade 'org.apache.httpcomponents:httpcore:4.3' shade 'commons-logging:commons-logging:1.1.3' shade 'org.glassfish.jersey.core:jersey-client:2.11' shade 'org.glassfish.hk2:hk2-api:2.3.0-b05' shade 'org.glassfish.hk2:hk2-utils:2.3.0-b05' shade 'org.glassfish.hk2.external:aopalliance-repackaged:2.3.0-b05' shade 'org.glassfish.hk2.external:javax.inject:2.3.0-b05' shade 'org.glassfish.hk2:hk2-locator:2.3.0-b05' shade 'org.javassist:javassist:3.18.1-GA' shade 'de.gesellix:unix-socket-factory:2015-01-27T15-02-14' shade 'org.apache.commons:commons-compress:1.5' shade 'org.tukaani:xz:1.2' shade 'commons-codec:commons-codec:1.8' shade 'commons-lang:commons-lang:2.6' shade 'commons-io:commons-io:2.3' shade 'org.slf4j:slf4j-api:1.7.5' shade 'org.slf4j:jcl-over-slf4j:1.7.12' shade 'com.google.guava:guava:18.0' shade 'org.bouncycastle:bcpkix-jdk15on:1.51' shade 'org.bouncycastle:bcprov-jdk15on:1.51' } jar { configurations.shade.each { dep -> from(project.zipTree(dep)){ exclude 'META-INF', 'META-INF/**' } } } //minecraft { // srgExtra "PK: com/fasterxml org/redfrog404/mobycraft/dependencies/com/fasterxml" //} 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' } } Thanks for the quick replies! When I am building my mod, I first do "./gradlew build", then "./gradlew shadowJar" to bundle the mod with the other JARs. Correct me if I'm wrong, but that should reobfuscate the mod. It looks like the shadowJar task uses the compiled output from the main SourceSet , but ForgeGradle handles reobfuscation separately (it assembles the JAR and then reobfuscates that). It may be easier to use the shading method described here than trying to integrate the shadow plugin with ForgeGradle. @UberAffe: The proxy example is helpful but isn't what I am looking for. Draco18s said that I was running client-only code on a server, which implies that I should use a server-only proxy, but your example is for client-side proxies. Proxy is used do separate registration code that is meant for the Physical client(logical client and logical server) and Physical server(logical server only) In your main mod file you use @SidedProxy(clientSide = Refs.CLIENTPROXY, serverSide = Refs.SERVERPROXY) public static CommonProxy proxy; CLIENTPROXY and SERVERPROXY are strings that would be equal to an import line. if an import would look like import modid.ClientProxy; @SidedProxy(clientSide = "modid.ClientProxy" your clientproxy class should extend common proxy. Your mod file will now have this: @SidedProxy(clientSide = Refs.CLIENTPROXY, serverSide = Refs.SERVERPROXY) public static CommonProxy proxy; @EventHandler public void preInit (FMLPreInitializationEvent event){ proxy.preInit(); } @EventHandler public void init (FMLInitializationEvent event){ proxy.init(); } @EventHandler public void postInit (FMLPostInitializationEvent event){ proxy.postInit(); } the majority of your registration will go in CommonProxy, and any client specific stuff (KeyBindings, GUI's, etc) will go in ClientProxy.
March 11, 20169 yr Everything in your CommonProxy is the Server Side from a physical perspective (a dedicated server (logical server) will use CommonProxy). A physical client (always has logical client, in smp it also is the logical server) will use ClientProxy which includes server code. Current Project: Armerger Planned mods: Light Drafter | Ore Swords Looking for help getting a mod off the ground? Coding | Textures
March 11, 20169 yr @Choonster: After trying out shadowfacts' code, I switched to the "shade" plugin and used that instead. This time I got a different error: * What went wrong: Execution failed for task ':reobfJar'. > java.util.zip.ZipException: duplicate entry: org/apache/commons/logging/Log.class Here is my new build.gradle file: // For those who want the bleeding edge buildscript { repositories { jcenter() maven { name = "forge" url = "http://files.minecraftforge.net/maven" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT' } } apply plugin: 'net.minecraftforge.gradle.forge' /* // 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" } */ version = "1.0" group= "org.redfrog404.mobycraft" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "mobycraft" minecraft { version = "1.8.9-11.15.1.1762" 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. } configurations { shade compile.extendsFrom shade } dependencies { shade 'com.github.docker-java:docker-java:2.2.1' shade 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.1.2' shade 'com.fasterxml.jackson.core:jackson-core:2.1.2' shade 'com.fasterxml.jackson.core:jackson-databind:2.1.2' shade 'com.fasterxml.jackson.core:jackson-annotations:2.1.1' shade 'com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.1.2' shade 'org.glassfish.jersey.connectors:jersey-apache-connector:2.11' shade 'org.glassfish.jersey.core:jersey-common:2.11' shade 'javax.annotation:javax.annotation-api:1.2' shade 'org.glassfish.jersey.bundles.repackaged:jersey-guava:2.11' shade 'org.glassfish.hk2:osgi-resource-locator:1.0.1' shade 'javax.ws.rs:javax.ws.rs-api:2.0' shade 'org.apache.httpcomponents:httpclient:4.3.1' shade 'org.apache.httpcomponents:httpcore:4.3' shade 'commons-logging:commons-logging:1.1.3' shade 'org.glassfish.jersey.core:jersey-client:2.11' shade 'org.glassfish.hk2:hk2-api:2.3.0-b05' shade 'org.glassfish.hk2:hk2-utils:2.3.0-b05' shade 'org.glassfish.hk2.external:aopalliance-repackaged:2.3.0-b05' shade 'org.glassfish.hk2.external:javax.inject:2.3.0-b05' shade 'org.glassfish.hk2:hk2-locator:2.3.0-b05' shade 'org.javassist:javassist:3.18.1-GA' shade 'de.gesellix:unix-socket-factory:2015-01-27T15-02-14' shade 'org.apache.commons:commons-compress:1.5' shade 'org.tukaani:xz:1.2' shade 'commons-codec:commons-codec:1.8' shade 'commons-lang:commons-lang:2.6' shade 'commons-io:commons-io:2.3' shade 'org.slf4j:slf4j-api:1.7.5' shade 'org.slf4j:jcl-over-slf4j:1.7.12' shade 'com.google.guava:guava:18.0' shade 'org.bouncycastle:bcpkix-jdk15on:1.51' shade 'org.bouncycastle:bcprov-jdk15on:1.51' } jar { configurations.shade.each { dep -> from(project.zipTree(dep)){ exclude 'META-INF', 'META-INF/**' } } } //minecraft { // srgExtra "PK: com/fasterxml org/redfrog404/mobycraft/dependencies/com/fasterxml" //} 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' } } I'm not too sure why that would happen, sorry. I don't have much experience with this. Minecraft already uses several of your dependencies (e.g. commons-logging, commons-io, Guava), so I'd recommend removing any that you don't need. I'd also recommend using srgExtra like in the page I linked to move your shaded dependencies into a unique package (e.g. org/apache/commons to mobycraft/repack/org/apache/commons ) to prevent conflicts with other mods that package different versions of the same libraries. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
March 13, 20169 yr Author @Choonster I tried shading again and I am now getting: > Could not find method srgExtra() for arguments [PK: org/apache/commons/logging org/mobycraft/org/apache/commons/logging] on root project 'mobycraft.forge'. I have already looked at http://www.minecraftforge.net/forum/index.php?topic=37004.0 and the syntax seems to be fine in my case. Here is how the minecraft section of my build.gradle file looks like: minecraft { version = "1.8.9-11.15.1.1762" 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. srgExtra "PK: org/apache/commons/logging org/mobycraft/org/apache/commons/logging" } Any idea what could be wrong?
March 13, 20169 yr I think the documentation on Read the Docs is for ForgeGradle 1.2, there doesn't seem to be any documentation for 2.x. I'm looking through ForgeGradle's code, but I don't fully understand how Gradle works. This PR changed the reobfuscation system, so now you need to specify reobfuscation per JAR task (like this). I'll try this myself and see if it works. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
March 13, 20169 yr I've managed to get this working, you can see my code here. I ended up using the Shadow plugin to package and relocate the dependency and just told ForgeGradle to reobfuscate the resulting JAR. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
March 14, 20169 yr Author Thanks for the reply, moved forward but getting a different error now. I ended up using the Shadow plugin to package and relocate the dependency and just told ForgeGradle to reobfuscate the resulting JAR. Now getting: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory at com.github.dockerjava.jaxrs.DockerCmdExecFactoryImpl.<clinit>(DockerCmdExecFactoryImpl.java:82) ~[DockerCmdExecFactoryImpl.class:?] at com.github.dockerjava.core.DockerClientBuilder.getDefaultDockerCmdExecFactory(DockerClientBuilder.java:35) ~[DockerClientBuilder.class:?] at com.github.dockerjava.core.DockerClientBuilder.build(DockerClientBuilder.java:47) ~[DockerClientBuilder.class:?] at org.redfrog404.mobycraft.DockerCommands.getDockerClient(DockerCommands.java:233) ~[DockerCommands.class:?] at org.redfrog404.mobycraft.DockerCommands.ps(DockerCommands.java:193) ~[DockerCommands.class:?] at org.redfrog404.mobycraft.DockerCommands.func_71515_b(DockerCommands.java:110) ~[DockerCommands.class:?] at net.minecraft.command.CommandHandler.func_175786_a(CommandHandler.java:100) [j.class:?] at net.minecraft.command.CommandHandler.func_71556_a(CommandHandler.java:79) [j.class:?] at net.minecraft.network.NetHandlerPlayServer.func_147361_d(NetHandlerPlayServer.java:815) [lm.class:?] at net.minecraft.network.NetHandlerPlayServer.func_147354_a(NetHandlerPlayServer.java:794) [lm.class:?] The updated build.gradle shows how I used your code. Further thoughts?
March 14, 20169 yr I've tried to test this here and it works in the deobfuscated client, but SLF4J refuses to load in the obfuscated client. I suspect it's something to do with the ClassLoader s used by Minecraft/Forge, but I don't have any idea how to fix it. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
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.