package com.example.examplemod;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.common.MinecraftForge;
@Mod(modid = ExampleMod.MODID, version = ExampleMod.VERSION)
public class ExampleMod {
static final String MODID = "examplemod";
static final String VERSION = "1.0";
@EventHandler
public void load(FMLInitializationEvent event) {
System.out.println("load()");
MinecraftForge.EVENT_BUS.register(new EventHandlerCommon());
FMLCommonHandler.instance().bus().register(new EventHandlerCommon());
FMLCommonHandler.instance().fireKeyInput();
}
@EventHandler
public void init(FMLInitializationEvent event) {
RenderGuiHandler a = new RenderGuiHandler();
MinecraftForge.EVENT_BUS.register(a);
}
}
package com.example.examplemod;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent;
import net.minecraft.client.settings.KeyBinding;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerPickupXpEvent;
import org.lwjgl.input.Keyboard;
class EventHandlerCommon {
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onPlayerPickupXP(PlayerPickupXpEvent e) {
e.orb.xpValue *= 50;
}
@SubscribeEvent(priority= EventPriority.NORMAL)
public void onEvent(InputEvent.KeyInputEvent event) {
KeyBinding k = new KeyBinding("key.hud.desc", Keyboard.KEY_H, "key.magicbeans.category");
if (k.isPressed()) {
// RenderGuiHandler a = new RenderGuiHandler();
//MinecraftForge.EVENT_BUS.register(a);
}
}
}
---- Minecraft Crash Report ----
// Don't do that.
Time: 4/28/17 3:05 PM
Description: There was a severe problem during mod loading that has caused the game to fail
cpw.mods.fml.common.LoaderException: java.lang.IllegalAccessError: tried to access class com.example.examplemod.EventHandlerCommon from class cpw.mods.fml.common.eventhandler.ASMEventHandler_7_EventHandlerCommon_onEvent_KeyInputEvent
at cpw.mods.fml.common.LoadController.transition(LoadController.java:163)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:739)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:311)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:597)
at net.minecraft.client.Minecraft.run(Minecraft.java:942)
at net.minecraft.client.main.Main.main(Main.java:164)
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)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)
Caused by: java.lang.IllegalAccessError: tried to access class com.example.examplemod.EventHandlerCommon from class cpw.mods.fml.common.eventhandler.ASMEventHandler_7_EventHandlerCommon_onEvent_KeyInputEvent
at cpw.mods.fml.common.eventhandler.ASMEventHandler_7_EventHandlerCommon_onEvent_KeyInputEvent.invoke(.dynamic)
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140)
at cpw.mods.fml.common.FMLCommonHandler.fireKeyInput(FMLCommonHandler.java:540)
at com.example.examplemod.ExampleMod.load(ExampleMod.java:21)
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 cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532)
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 cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190)
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 cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:737)
... 12 more
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_131, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 671793000 bytes (640 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1614 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.05} [Minecraft Coder Pack] (minecraft.jar)
UCHI FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar)
UCHI Forge{10.13.4.1614} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar)
UCHE examplemod{1.0} [Example Mod] (MCMods3_main)
GL info: ' Vendor: 'Intel' Version: '4.3.0 - Build 10.18.15.4279' Renderer: 'Intel(R) HD Graphics 4600'
This happens with any event I try to add. Not sure what the issue is