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

Hey, recently upgraded my mod from 1.15 to 1.16 and I previously had a subscription to RenderGameOverlayEvent.Post however since upgrading I now get the following exception when starting the game:

 

Method public static void com.lickbread.mesoamericamythology.registry.event.ModGuiHandler.renderGameOverlay(net.minecraftforge.client.event.RenderGameOverlayEvent$Post) has @SubscribeEvent annotation, but takes an argument that is not a subtype of the base type interface net.minecraftforge.fml.event.lifecycle.IModBusEvent: class net.minecraftforge.client.event.RenderGameOverlayEvent$Post

 

For reference my subscription code:

@Mod.EventBusSubscriber
public class ModGuiHandler {

    @SubscribeEvent
    public static void renderGameOverlay(RenderGameOverlayEvent.Post event) {
        if (event.getType() == RenderGameOverlayEvent.ElementType.HOTBAR) {
            new BloodLevelGui().render();
        }
    }
}

And registration code:

@Mod(MesoamericaMythologyMod.MOD_ID)
public class MesoamericaMythologyMod {

    public static final String MOD_ID = "mesoamericamythology";

    public static final Logger LOGGER = LogManager.getLogger(MOD_ID);

    public static IEventBus MOD_EVENT_BUS;

    public MesoamericaMythologyMod() {
        //...
        MOD_EVENT_BUS.register(ModGuiHandler.class);
    }

 

RenderGameOverlayEvent only extends Event and not IModBusEvent. None of the events that implement this interface seem to be correct, so I'm thinking either I need to change my registration or subscription to listen to a different event bus potentially, but I'm not sure what the correct one is. I was looking at some of the places where RenderGameOverlayEvent was used and came across code like the following:

MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(mStack, eventParent, type));

 

Which confuses me here as it is posting to the EVENT_BUS, although there is nothing of IEventBus that limits events sent to the IModBusEvent.

Does anyone know the answer here?

No signature for you!

  • Author
11 minutes ago, diesieben07 said:

You are registering the class to both event busses. First to the mod event bus:

This is wrong, as the event is not a mod bus event (as indicated by the exception).

 

Additionally you register it to the forge event bus using @EventBusSubscriber. Do not register things to multiple event buses.

Didn't realise doing both was bad, thought it was required. I've commented out the MOD_EVENT_BUS registration and it worked like a charm. Thanks!

No signature for you!

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.