Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

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?

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.

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.