Mixin Error , Cant find Inject method


#1

Im trying to mixin the multiplayer gui in forge mod with sponge, but it gives me a error that i dont know why :L

ERROR:

       Description: Initializing game
java.lang.NoClassDefFoundError: net/minecraft/client/gui/GuiMultiplayer
	at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:505)
	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:497)
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
Caused by: java.lang.ClassNotFoundException: net.minecraft.client.gui.GuiMultiplayer
	at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 9 more
Caused by: org.spongepowered.asm.mixin.transformer.throwables.MixinTransformerError: An unexpected critical error was encountered
	at org.spongepowered.asm.mixin.transformer.MixinTransformer.transform(MixinTransformer.java:604)
	at org.spongepowered.asm.mixin.transformer.MixinTransformer$Proxy.transform(MixinTransformer.java:183)
	at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279)
	at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176)
	... 11 more
Caused by: org.spongepowered.asm.mixin.throwables.MixinApplyError: Mixin [mixins.mkmod.json:MixinGuiMultiplayer] from phase [DEFAULT] in config [mixins.mkmod.json] FAILED during APPLY
	at org.spongepowered.asm.mixin.transformer.MixinTransformer.handleMixinError(MixinTransformer.java:883)
	at org.spongepowered.asm.mixin.transformer.MixinTransformer.handleMixinApplyError(MixinTransformer.java:836)
	at org.spongepowered.asm.mixin.transformer.MixinTransformer.transform(MixinTransformer.java:596)
	... 14 more
Caused by: org.spongepowered.asm.mixin.injection.throwables.InvalidInjectionException: @Inject annotation on handler$initGui$zza000 could not find 'initGui'
	at org.spongepowered.asm.mixin.injection.struct.InjectionInfo.findMethods(InjectionInfo.java:362)
	at org.spongepowered.asm.mixin.injection.struct.InjectionInfo.readAnnotation(InjectionInfo.java:149)
	at org.spongepowered.asm.mixin.injection.struct.InjectionInfo.<init>(InjectionInfo.java:136)
	at org.spongepowered.asm.mixin.injection.struct.CallbackInjectionInfo.<init>(CallbackInjectionInfo.java:44)
	at org.spongepowered.asm.mixin.injection.struct.InjectionInfo.parse(InjectionInfo.java:394)
	at org.spongepowered.asm.mixin.transformer.MixinTargetContext.prepareInjections(MixinTargetContext.java:1040)
	at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.prepareInjections(MixinApplicatorStandard.java:875)
	at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.applyMixin(MixinApplicatorStandard.java:292)
	at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.apply(MixinApplicatorStandard.java:256)
	at org.spongepowered.asm.mixin.transformer.TargetClassContext.applyMixins(TargetClassContext.java:280)
	at org.spongepowered.asm.mixin.transformer.MixinTransformer.apply(MixinTransformer.java:817)
	at org.spongepowered.asm.mixin.transformer.MixinTransformer.applyMixins(MixinTransformer.java:787)
	at org.spongepowered.asm.mixin.transformer.MixinTransformer.transform(MixinTransformer.java:592)
	... 14 more


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
	at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:505)

-- Initialization --
Details:
Stacktrace:
	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:497)
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

My Gradle.build

    buildscript {
    repositories {
        jcenter()
        maven {
            name = "forge"
            url = "http://files.minecraftforge.net/maven"
        }
        maven {
            name = 'sponge'
            url = 'https://repo.spongepowered.org/maven'
        }
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
        classpath 'org.spongepowered:mixingradle:0.4-SNAPSHOT'
        classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
    }
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'org.spongepowered.mixin'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: "eclipse"

/*
// 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= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "modid"

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.
}

repositories {
    maven {
        name = 'spongepowered-repo'
        url = 'http://repo.spongepowered.org/maven/'
    }
    mavenCentral()
}

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 '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
    
    compile 'org.spongepowered:mixin:0.6.6-SNAPSHOT'
    

}

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'
    }
}

shadowJar {
    dependencies {
        include(dependency('org.spongepowered:mixin'))
    }

    exclude 'dummyThing'
    exclude 'LICENSE.txt'
    classifier = 'full'
}

sourceSets {
    main {
        refMap = "mixins.mkmod.refmap.json"
    }
}

jar {
    manifest.attributes(
        'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker',
        'MixinConfigs': 'mixins.mkmod.json',
        'FMLCorePluginContainsFMLMod': 'true'
    )
}

config:
    {
  "required": true,
  "compatibilityLevel": "JAVA_8",
  "package": "com.mkcoldwolf.mkmod.mc.mixin",
  "refmap": "mixins.mkmod.refmap.json",
  "target": "@env(DEFAULT)",
  "mixins": [
    "MixinGuiMultiplayer"
  ]
}

MixinMultiplayer:

    package com.mkcoldwolf.mkmod.mc.mixin;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import com.mkcoldwolf.mkmod.gui.MkModScreen;

import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiMultiplayer;
import net.minecraft.client.gui.GuiScreen;

@Mixin({GuiMultiplayer.class})
public abstract class MixinGuiMultiplayer extends GuiScreen {
	
	  private GuiButton bungeeCordSpoofButton;
	  
	  @Inject(method="initGui", at={@org.spongepowered.asm.mixin.injection.At("RETURN")})
	  private void initGui(CallbackInfo callbackInfo)
	  {
	    this.buttonList.add(new GuiButton(997, 5, 8, 98, 20, "AntiForge"));
//	    this.buttonList.add(this.bungeeCordSpoofButton = new GuiButton(998, 108, 8, 98, 20, "BungeeCord Spoof: " + (lllll1l11.l ? "On" : "Off")));
//	    this.buttonList.add(new GuiButton(999, this.field_146294_l - 104, 8, 98, 20, "Tools"));
	  }
	  
	  @Inject(method="actionPerformed", at={@org.spongepowered.asm.mixin.injection.At("HEAD")})
	  private void actionPerformed(GuiButton button, CallbackInfo callbackInfo)
	  {
	    switch (button.id)
	    {
	    case 997: 
//	      this.field_146297_k.func_147108_a(new lll1llll1((GuiScreen)this));
	      System.out.println("Its button 997!");
	      break;
	    case 998: 
	      break;
	    case 999: 
	    }
	  }
}

image

{
  "required": true,
  "compatibilityLevel": "JAVA_8",
  "package": "com.mkcoldwolf.mkmod.mc.mixin",
  "refmap": "mixins.mkmod.refmap.json",
  "target": "@env(DEFAULT)",
  "mixins": [
    "MixinGuiMultiplayer"
  ]
}

#2

How are you creating the mod JAR file?


#3

Yes, it has been sucessfully shaded spongemixin and my code into a fat jar, but one weird thing is when i test it on eclipse, it didn’t work, it just give a minimize window of minecraft and the start screen even glitched when i slide it to bigger, after i build it and put it into mods folder, the forge loading screen works but give me this error before to start screen

EDIT:
omg am i watch the reply wrong…
btw i create the jar by doing gradle shadowJar on root folder