Posted October 2, 201510 yr In my FML event handler class, I subscribe to an event: @SubscribeEvent public void onMissing(FMLMissingMappingsEvent e) In my mod's postInit, I try to register the event handler class with FML: public void postInit(FMLPostInitializationEvent e) { super.postInit (e); classEventBusSubs eb = new classEventBusSubs (); classCommonBusSubs cb = new classCommonBusSubs (); MinecraftForge.EVENT_BUS.register (eb); // All of my "listeners" are in class...EventSubs, FMLCommonHandler.instance ().bus ().register (cb); // So register it on every bus until events are triggered } But FML rejects its own event as an event: [18:44:45] [Client thread/ERROR] [FML]: The following problems were captured during this phase [18:44:45] [Client thread/ERROR] [FML]: Caught exception from jrfmoonsensor java.lang.IllegalArgumentException: Method public void jrfmoonsensor.classCommonBusSubs.onMissing(net.minecraftforge.fml.common.event.FMLMissingMappingsEvent) has @SubscribeEvent annotation, but takes a argument that is not an Event class net.minecraftforge.fml.common.event.FMLMissingMappingsEvent at net.minecraftforge.fml.common.eventhandler.EventBus.register(EventBus.java:82) ~[forgeSrc-1.8-11.14.3.1450.jar:?] at jrfmoonsensor.classSensorMod.postInit(classSensorMod.java:123) ~[bin/:?] How can it not be an event class??? It's an extension of class FMLEvent! What part of "event" is not being communicated here? The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
October 2, 201510 yr I am still learning but I have never heard of onMissing() method for 1.8 in the API, maybe it has been depreciated? what are you trying to do?
October 2, 201510 yr There are two types of events in Forge: Events that extend FMLEvent and are handled by a method with the @Mod.EventHandler annotation in your @Mod class (e.g. FMLPreInitializationEvent , FMLMissingMappingsEvent ) Events that extend Event and are handled by a method with the @SubscribeEvent annotation in a class registered on the appropriate event bus (e.g. BlockEvent.HarvestDropsEvent , PlayerEvent.ItemSmeltedEvent ) You're trying to handle an FMLEvent like it's an Event . 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.
October 2, 201510 yr Author Aha... Coincidence (or confusion?) in naming. I guess I should move the handler to my main mod class (and change the annotation). @statphantom: "onMissing" was just my own choice of method name (I had to call it something). The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
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.