Posted March 8, 20214 yr 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!
March 8, 20214 yr 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.