It Takes a Pillage (Fabric)

It Takes a Pillage (Fabric)

5M Downloads

Crash due to trying to load net.minecraft.client.gui.screens.Screen.class on dist DEDICATED_SERVER

unilock opened this issue ยท 1 comments

commented
[20:20:31] [main/ERROR] [minecraft/Main]: Failed to start the minecraft server
net.minecraftforge.fml.LoadingFailedException: Loading errors encountered: [
	It Takes A Pillage (takesapillage) has failed to load correctly
java.lang.RuntimeException: Attempted to load class net/minecraft/client/gui/screens/Screen for invalid dist DEDICATED_SERVER
]
	at net.minecraftforge.fml.ModLoader.waitForTransition(ModLoader.java:222) ~[fmlcore-1.18.2-40.2.0.jar%23530!/:?] {}
	at net.minecraftforge.fml.ModLoader.lambda$dispatchAndHandleError$21(ModLoader.java:187) ~[fmlcore-1.18.2-40.2.0.jar%23530!/:?] {}
	at java.util.Optional.ifPresent(Optional.java:178) ~[?:?] {re:mixin}
	at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:187) ~[fmlcore-1.18.2-40.2.0.jar%23530!/:?] {}
	at net.minecraftforge.fml.ModLoader.lambda$gatherAndInitializeMods$11(ModLoader.java:164) ~[fmlcore-1.18.2-40.2.0.jar%23530!/:?] {}
	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?] {re:mixin}
	at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:164) ~[fmlcore-1.18.2-40.2.0.jar%23530!/:?] {}
	at net.minecraftforge.server.loading.ServerModLoader.load(ServerModLoader.java:32) ~[forge-1.18.2-40.2.0-universal.jar%23534!/:?] {re:classloading}
	at net.minecraft.server.Main.main(Main.java:112) ~[server-1.18.2-20220404.173914-srg.jar%23529!/:?] {re:classloading,re:mixin,pl:mixin:A}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}
	at net.minecraftforge.fml.loading.targets.CommonServerLaunchHandler.lambda$launchService$0(CommonServerLaunchHandler.java:32) ~[fmlloader-1.18.2-40.2.0.jar%2317!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.1.3.jar%235!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.1.3.jar%235!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.1.3.jar%235!/:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.1.3.jar%235!/:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.1.3.jar%235!/:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.1.3.jar%235!/:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.1.3.jar%235!/:?] {}
	at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:149) [bootstraplauncher-1.0.0.jar:?] {}

I was able to fix this by:

  • wrapping eventBus.addListener(this::clientSetup); in if (FMLEnvironment.dist.isClient()) { }
  • moving ModLoadingContext.get().registerExtensionPoint( ... ); into #clientSetup(FMLClientSetupEvent event), and
  • annotating #clientSetup with @OnlyIn(Dist.CLIENT).

(in TakesAPillage.class)

commented

Fixed in [1.19.2] e98605c [1.18.2] 1bbe4bc [1.16.5] 4e6c64c