When I try to call Minecraft.getMinecraft();, it gives this error
java.lang.NoSuchMethodError: net.minecraft.client.Minecraft.getMinecraft()Lnet/minecraft/client/Minecraft;
here is my full stacktrace
Time: 12/15/20 11:23 AM
Description: There was a severe problem during mod loading that has caused the game to fail
net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from XENON (xenon)
Caused by: java.lang.NoSuchMethodError: net.minecraft.client.Minecraft.getMinecraft()Lnet/minecraft/client/Minecraft;
at club.max.xenon.XenonClient.onClientStarted(XenonClient.java:47)
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.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:637)
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 com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
at com.google.common.eventbus.EventBus.post(EventBus.java:217)
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:219)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:197)
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 com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
at com.google.common.eventbus.EventBus.post(EventBus.java:217)
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:136)
at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:749)
at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:336)
at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:535)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:378)
at net.minecraft.client.main.Main.main(SourceFile:123)
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)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- System Details --
Details:
Minecraft Version: 1.12.2
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_51, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 440908008 bytes (420 MB) / 1073741824 bytes (1024 MB) up to 4294967296 bytes (4096 MB)
JVM Flags: 8 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx4G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP 9.42 Powered by Forge 14.23.5.2854 5 mods loaded, 5 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
| State | ID | Version | Source | Signature |
|:----- |:--------- |:------------ |:----------------------------- |:---------------------------------------- |
| LCHI | minecraft | 1.12.2 | minecraft.jar | None |
| LCHI | mcp | 9.42 | minecraft.jar | None |
| LCHI | FML | 8.0.99.99 | forge-1.12.2-14.23.5.2854.jar | e3c3d50c7c986df74c645c0ac54639741c90a557 |
| LCHI | forge | 14.23.5.2854 | forge-1.12.2-14.23.5.2854.jar | e3c3d50c7c986df74c645c0ac54639741c90a557 |
| LCHE | xenon | 1 | xenon-0.0.3-all.jar | None |
Loaded coremods (and transformers):
GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.6.13587 Compatibility Profile Context 20.4.1 26.20.15029.20013' Renderer: 'Radeon RX 580 Series'
along with my main class
package club.max.xenon;
import club.max.xenon.api.command.management.CommandManager;
import club.max.xenon.api.config.management.ConfigManager;
import club.max.xenon.api.event.management.EventManager;
import club.max.xenon.api.module.management.ModuleManager;
import com.mojang.realmsclient.gui.ChatFormatting;
import club.max.xenon.client.gui.ClickGui;
import net.minecraft.client.Minecraft;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import org.lwjgl.opengl.Display;
import team.stiff.pomelo.impl.annotated.AnnotatedEventManager;
/**
* @author SrRina
* @since 15/11/20 at 4:51pm
*/
@Mod(modid = "xenon", name = "Xenon", version = "1")
public class XenonClient {
public static final String NAME = "XENON";
public static final String VERSION = "0.0.3";
public static final String CHAT = ChatFormatting.GRAY + "{" + ChatFormatting.BLUE + ChatFormatting.BOLD + "XENON" + ChatFormatting.RESET + ChatFormatting.GRAY + "} ";
/*
* Thanks so much for Pomelo of team stiff exist!!!!!!!!
*/
public static final team.stiff.pomelo.EventManager EVENT_BUS = new AnnotatedEventManager();
/* All managers of the client. */
private static EventManager clientEventManager;
private static CommandManager commandManager;
public static ModuleManager moduleManager;
public static ClickGui gui;
public static Minecraft mc;
public static ConfigManager configManager;
public static XenonDiscordRPC rpc;
@Mod.EventHandler
public static void onClientStarted(FMLInitializationEvent event) {
// MinecraftForge.EVENT_BUS.register(this);
mc = Minecraft.getMinecraft();
clientEventManager = new EventManager();
System.out.println("Initialized Event Manager");
commandManager = new CommandManager();
commandManager.initCommands();
System.out.println("Initialized Commands");
moduleManager = new ModuleManager();
moduleManager.initMods();
System.out.println("Initialized Modules");
gui = new ClickGui();
System.out.println("Initialized GUI");
configManager = new ConfigManager();
configManager.onStartup();
System.out.println("Initialized Config");
// rpc = new XenonDiscordRPC();
// rpc.start();
MinecraftForge.EVENT_BUS.register(clientEventManager);
MinecraftForge.EVENT_BUS.register(commandManager);
MinecraftForge.EVENT_BUS.register(new XenonClient());
Display.setTitle(NAME + " " + VERSION);
}
public static ModuleManager getModuleManager() {
return moduleManager;
}
public static EventManager getClientEventManager() {
return clientEventManager;
}
public static CommandManager getCommandManager() {
return commandManager;
}
public static Minecraft getMinecraft() {
return Minecraft.getMinecraft();
}
public static team.stiff.pomelo.EventManager getEventBus(){
return EVENT_BUS;
}
}