Cannot cast SpongeNeoEventBus to EventBus
Closed this issue ยท 0 comments
Problem
Placebo fails to start with SpongeNeo:
simple crash log
[16:56:39] [main/ERROR] [minecraft/Main]: Failed to start the minecraft server
net.neoforged.fml.ModLoadingException: Loading errors encountered:
- Placebo (placebo) has failed to load correctly
java.lang.ClassCastException: class org.spongepowered.neoforge.launch.event.NeoEventManager cannot be cast to class net.neoforged.bus.EventBus (org.spongepowered.neoforge.launch.event.NeoEventManager is in module [email protected] of loader 'TRANSFORMER' @362cf66; net.neoforged.bus.EventBus is in module net.neoforged.bus of loader 'MC-BOOTSTRAP' @74a10858)
- More Overlays Updated (moreoverlays) has failed to load correctly
java.lang.BootstrapMethodError: java.lang.RuntimeException: Attempted to load class net/minecraft/client/KeyMapping for invalid dist DEDICATED_SERVER
at MC-BOOTSTRAP/[email protected]/net.neoforged.fml.ModLoader.waitForFuture(ModLoader.java:281) ~[loader-4.0.35.jar%2360!/:4.0] {}
at MC-BOOTSTRAP/[email protected]/net.neoforged.fml.ModLoader.dispatchParallelTask(ModLoader.java:244) ~[loader-4.0.35.jar%2360!/:4.0] {}
at MC-BOOTSTRAP/[email protected]/net.neoforged.fml.ModLoader.constructMods(ModLoader.java:152) ~[loader-4.0.35.jar%2360!/:4.0] {}
at MC-BOOTSTRAP/[email protected]/net.neoforged.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:142) ~[loader-4.0.35.jar%2360!/:4.0] {}
at TRANSFORMER/[email protected]/net.neoforged.neoforge.internal.CommonModLoader.begin(CommonModLoader.java:49) ~[neoforge-21.1.97-universal.jar%23525!/:?] {re:classloading}
at TRANSFORMER/[email protected]/net.neoforged.neoforge.server.loading.ServerModLoader.load(ServerModLoader.java:34) ~[neoforge-21.1.97-universal.jar%23525!/:?] {re:classloading}
at TRANSFORMER/[email protected]/net.minecraft.server.Main.main(Main.java:124) ~[server-1.21.1-20240808.144430-srg.jar%23524!/:?] {re:mixin,re:classloading,pl:mixin:A}
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?] {}
at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?] {}
at MC-BOOTSTRAP/[email protected]/net.neoforged.fml.loading.targets.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:136) ~[loader-4.0.35.jar%2360!/:4.0] {}
at MC-BOOTSTRAP/[email protected]/net.neoforged.fml.loading.targets.CommonLaunchHandler.serverService(CommonLaunchHandler.java:128) ~[loader-4.0.35.jar%2360!/:4.0] {}
at MC-BOOTSTRAP/[email protected]/net.neoforged.fml.loading.targets.CommonServerLaunchHandler.runService(CommonServerLaunchHandler.java:32) ~[loader-4.0.35.jar%2360!/:4.0] {}
at MC-BOOTSTRAP/[email protected]/net.neoforged.fml.loading.targets.CommonLaunchHandler.lambda$launchService$4(CommonLaunchHandler.java:118) ~[loader-4.0.35.jar%2360!/:4.0] {}
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-11.0.4.jar%2362!/:?] {}
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-11.0.4.jar%2362!/:?] {}
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-11.0.4.jar%2362!/:?] {}
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.run(Launcher.java:103) [modlauncher-11.0.4.jar%2362!/:?] {}
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.main(Launcher.java:74) [modlauncher-11.0.4.jar%2362!/:?] {}
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-11.0.4.jar%2362!/:?] {}
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-11.0.4.jar%2362!/:?] {}
at [email protected]/cpw.mods.bootstraplauncher.BootstrapLauncher.run(BootstrapLauncher.java:210) [bootstraplauncher-2.0.2.jar:?] {}
at [email protected]/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:69) [bootstraplauncher-2.0.2.jar:?] {}
Context
IT seems that a method call in Placebo is expecting that the eventbus is an EventBus
instance to call start()
. However, SpongeNeo replaces this eventbus with its own to keep symmetrical compatibility between SpongeAPI implementation of it's EventManager and Neo events and their listeners. It seems that the method start()
is available on the IEventBus
interface, so would it be suitable to simply call that instead, since SpongeNeo can easily forward that to the wrapped instance?