Hello.
So, here is my problem:
After i created custom event and i'm trying to use it, game crashes:
[12:55:06] [Client thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.client.event.TextureStitchEvent$Pre@3700d4c1:
java.lang.ClassCastException: net.minecraftforge.client.event.TextureStitchEvent$Pre cannot be cast to code.elix_x.coremods.keybindingsoverhaul.api.NewKeyBindingEvent
at cpw.mods.fml.common.eventhandler.ASMEventHandler_9_OnNewKeyBindingEvent_onNewKeyBinding_NewKeyBindingEvent.invoke(.dynamic) ~[?:?]
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:?]
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) [EventBus.class:?]
at net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(ForgeHooksClient.java:271) [ForgeHooksClient.class:?]
at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:110) [TextureMap.class:?]
at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:98) [TextureMap.class:?]
at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:89) [TextureManager.class:?]
at net.minecraft.client.renderer.texture.TextureManager.onResourceManagerReload(TextureManager.java:172) [TextureManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:143) [simpleReloadableResourceManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:121) [simpleReloadableResourceManager.class:?]
at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:654) [Minecraft.class:?]
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:327) [FMLClientHandler.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:597) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:942) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
at GradleStart.main(Unknown Source) [start/:?]
[12:55:06] [Client thread/ERROR] [FML]: Index: 1 Listeners:
[12:55:06] [Client thread/ERROR] [FML]: 0: NORMAL
[12:55:06] [Client thread/ERROR] [FML]: 1: ASM: code.elix_x.coremods.keybindingsoverhaul.events.OnNewKeyBindingEvent@56ddd82a onNewKeyBinding(Lcode/elix_x/coremods/keybindingsoverhaul/api/NewKeyBindingEvent;)V
[12:55:06] [Client thread/INFO]: Caught error stitching, removing all assigned resourcepacks
net.minecraft.util.ReportedException: Registering texture
at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:111) ~[TextureManager.class:?]
at net.minecraft.client.renderer.texture.TextureManager.onResourceManagerReload(TextureManager.java:172) ~[TextureManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:143) ~[simpleReloadableResourceManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:121) ~[simpleReloadableResourceManager.class:?]
at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:654) [Minecraft.class:?]
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:327) [FMLClientHandler.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:597) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:942) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
at GradleStart.main(Unknown Source) [start/:?]
Caused by: java.lang.ClassCastException: net.minecraftforge.client.event.TextureStitchEvent$Pre cannot be cast to code.elix_x.coremods.keybindingsoverhaul.api.NewKeyBindingEvent
at cpw.mods.fml.common.eventhandler.ASMEventHandler_9_OnNewKeyBindingEvent_onNewKeyBinding_NewKeyBindingEvent.invoke(.dynamic) ~[?:?]
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:?]
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) ~[EventBus.class:?]
at net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(ForgeHooksClient.java:271) ~[ForgeHooksClient.class:?]
at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:110) ~[TextureMap.class:?]
at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:98) ~[TextureMap.class:?]
at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:89) ~[TextureManager.class:?]
... 16 more
[12:55:06] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Key Bindings Overhaul, FMLFileResourcePack:EXCore
[12:55:06] [Client thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.client.event.TextureStitchEvent$Pre@78fee50c:
java.lang.ClassCastException: net.minecraftforge.client.event.TextureStitchEvent$Pre cannot be cast to code.elix_x.coremods.keybindingsoverhaul.api.NewKeyBindingEvent
at cpw.mods.fml.common.eventhandler.ASMEventHandler_9_OnNewKeyBindingEvent_onNewKeyBinding_NewKeyBindingEvent.invoke(.dynamic) ~[?:?]
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:?]
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) [EventBus.class:?]
at net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(ForgeHooksClient.java:271) [ForgeHooksClient.class:?]
at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:110) [TextureMap.class:?]
at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:98) [TextureMap.class:?]
at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:89) [TextureManager.class:?]
at net.minecraft.client.renderer.texture.TextureManager.onResourceManagerReload(TextureManager.java:172) [TextureManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:143) [simpleReloadableResourceManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:121) [simpleReloadableResourceManager.class:?]
at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:662) [Minecraft.class:?]
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:327) [FMLClientHandler.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:597) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:942) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
at GradleStart.main(Unknown Source) [start/:?]
[12:55:06] [Client thread/ERROR] [FML]: Index: 1 Listeners:
[12:55:06] [Client thread/ERROR] [FML]: 0: NORMAL
[12:55:06] [Client thread/ERROR] [FML]: 1: ASM: code.elix_x.coremods.keybindingsoverhaul.events.OnNewKeyBindingEvent@56ddd82a onNewKeyBinding(Lcode/elix_x/coremods/keybindingsoverhaul/api/NewKeyBindingEvent;)V
[12:55:06] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ----
// Ooh. Shiny.
Time: 08.08.15 12:55
Description: Registering texture
java.lang.ClassCastException: net.minecraftforge.client.event.TextureStitchEvent$Pre cannot be cast to code.elix_x.coremods.keybindingsoverhaul.api.NewKeyBindingEvent
at cpw.mods.fml.common.eventhandler.ASMEventHandler_9_OnNewKeyBindingEvent_onNewKeyBinding_NewKeyBindingEvent.invoke(.dynamic)
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138)
at net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(ForgeHooksClient.java:271)
at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:110)
at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:98)
at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:89)
at net.minecraft.client.renderer.texture.TextureManager.onResourceManagerReload(TextureManager.java:172)
at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:143)
at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:121)
at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:662)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:327)
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(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 net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at cpw.mods.fml.common.eventhandler.ASMEventHandler_9_OnNewKeyBindingEvent_onNewKeyBinding_NewKeyBindingEvent.invoke(.dynamic)
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138)
at net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(ForgeHooksClient.java:271)
at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:110)
at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:98)
-- Resource location being registered --
Details:
Resource location: minecraft:textures/atlas/blocks.png
Texture object class: net.minecraft.client.renderer.texture.TextureMap
Stacktrace:
at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:89)
at net.minecraft.client.renderer.texture.TextureManager.onResourceManagerReload(TextureManager.java:172)
at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:143)
at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:121)
at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:662)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:327)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:597)
-- Initialization --
Details:
Stacktrace:
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(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 net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)
-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.8.0_25, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 819016648 bytes (781 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 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.1492 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
UCHIJA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)
UCHIJA FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1492-1.7.10.jar)
UCHIJA Forge{10.13.4.1492} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1492-1.7.10.jar)
UCHIJA excore{1.0} [EXCore] (bin)
UCHIJA keybindingsoverhaul{1.2.2} [Key Bindings Overhaul] (bin)
GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.4.13084 Compatibility Profile Context 14.301.1001.0' Renderer: 'AMD Radeon HD 8570D'
Launched Version: 1.7.10
LWJGL: 2.9.1
OpenGL: AMD Radeon HD 8570D GL version 4.4.13084 Compatibility Profile Context 14.301.1001.0, ATI Technologies Inc.
GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: English (US)
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Anisotropic Filtering: Off (1)
[12:55:06] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:398]: #@!@# Game crashed! Crash report saved to: #@!@# C:\my\mcmodding\mods\Key-Bindings-Overhaul\1.7.10\eclipse\.\crash-reports\crash-2015-08-08_12.55.06-client.txt
AL lib: (EE) alc_cleanup: 1 device not closed
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
As you can see, it crashes when it tries to invoke my event handler with wrong event. And i don't understand why it does that.
Here's my event class:
@Cancelable
public class NewKeyBindingEvent extends Event{
public KeyBinding keybinding;
public int keyId;
public NewKeyBindingEvent(KeyBinding keybinding, int keyId) {
this.keybinding = keybinding;
this.keyId = keyId;
}
public NewKeyBindingEvent() {
super();
}
}
Event handler:
public class OnNewKeyBindingEvent {
public OnNewKeyBindingEvent() {
}
@SubscribeEvent
public void onNewKeyBinding(NewKeyBindingEvent event){
if(event.keybinding == Minecraft.getMinecraft().gameSettings.keyBindUseItem || event.keybinding == Minecraft.getMinecraft().gameSettings.keyBindAttack){
event.setCanceled(true);
KBOAPI.add(new AdvancedSimpleKeyBinding(event.keybinding, event.keyId){
private int cooldown = 0;
@Override
public void update() {
if(keyIds.isEmpty()){
return;
}
cooldown = cooldown <= 0 ? 0 : cooldown - 1;
boolean b = true;
for(Integer i : keyIds){
if(!isKeyDown(i)){
b = false;
break;
}
}
if(b && !getSimpleKeyBinding().pressed && cooldown == 0){
getSimpleKeyBinding().pressed = true;
getSimpleKeyBinding().pressTime++;
cooldown = 3;
} else if(b && getSimpleKeyBinding().pressed){
getSimpleKeyBinding().pressed = false;
getSimpleKeyBinding().pressTime = 0;
} else if(!b) {
getSimpleKeyBinding().pressed = false;
getSimpleKeyBinding().pressTime = 0;
}
}
});
}
}
}
And how i register event handler (in main class, init phase):
MinecraftForge.EVENT_BUS.register(new OnNewKeyBindingEvent());
So i don't see anything wrong here, but it crashes while loading...
Thanks for help!
If you have any questions - just ask!