This PR fixes a crash as reported in #16 where Forge versions 32.0.96 and above crash with java.lang.IllegalArgumentException: Method public void shadows.toaster.ToastControl.clientTick(net.minecraftforge.event.TickEvent$ClientTickEvent) has @SubscribeEvent annotation, but takes an argument that is not a subtype of the base type interface net.minecraftforge.fml.event.lifecycle.IModBusEvent.
FMLJavaModLoadingContext.get().getModEventBus() requires all methods decorated with @SubscribeEvent to implement IModBusEvent which KeyInputEvent and ClientTickEvent does not implement. Currently, all @SubscribeEvent decorated methods are registered on both getModEventBus() and MinecraftForge.EVENT_BUS which was allowed up until 32.0.96.
To fix this, my PR separates these methods in ToastControl that use KeyInputEvent and ClientTickEvent into an anonymous object, and registers these methods on the MinecraftForge.EVENT_BUS independently of the methods intended for getModEventBus() (using FMLClientSetupEvent).
This PR fixes a crash as reported in #16 where Forge versions 32.0.96 and above crash with
java.lang.IllegalArgumentException: Method public void shadows.toaster.ToastControl.clientTick(net.minecraftforge.event.TickEvent$ClientTickEvent) has @SubscribeEvent annotation, but takes an argument that is not a subtype of the base type interface net.minecraftforge.fml.event.lifecycle.IModBusEvent
.FMLJavaModLoadingContext.get().getModEventBus()
requires all methods decorated with@SubscribeEvent
to implementIModBusEvent
whichKeyInputEvent
andClientTickEvent
does not implement. Currently, all@SubscribeEvent
decorated methods are registered on bothgetModEventBus()
andMinecraftForge.EVENT_BUS
which was allowed up until 32.0.96.To fix this, my PR separates these methods in
ToastControl
that useKeyInputEvent
andClientTickEvent
into an anonymous object, and registers these methods on theMinecraftForge.EVENT_BUS
independently of the methods intended forgetModEventBus()
(usingFMLClientSetupEvent
).