MoreCulling

MoreCulling

5M Downloads

Add sanity check to CONFIG calls from mixins triggered early on in the loading phase

ChiefArug opened this issue ยท 1 comments

commented

When mod loading fails early on, (neo)forge stops firing events and loading things to attempt to recover enough to get to the mod loading failed screen. This means that things like configs may not get initialized.

Because your mod uses a mixin to a method in Minecraft that is called before this screen appears you should add sanity checks to your config getting, as there is a chance it has not loaded yet due to (neo)forge trying to limp to an error screen. If you don't do these sanity checks then crash reports generate that blame you for the error, like #324, even though the actual cause is something that happened earlier.

commented

Stacktrace from such a crash, as it seems the report I mentioned didn't have one

java.lang.NullPointerException: Cannot read field "modCompatibility" because "ca.fxco.moreculling.MoreCulling.CONFIG" is null
at TRANSFORMER/[email protected]/net.minecraft.client.Minecraft.md9503c6$moreculling$lambda$moreculling$onInit$0$2(Minecraft.java:10509) ~[client-1.21.1-20240808.144430-srg.jar%23242!/:?] {re:mixin,pl:accesstransformer:B,pl:connector_pre_launch:A,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:A,pl:connector_pre_launch:A,pl:runtimedistcleaner:A}
at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[?:?] {re:mixin}
at TRANSFORMER/[email protected]/net.minecraft.client.Minecraft.handler$bdf000$moreculling$onInit(Minecraft.java:10508) ~[client-1.21.1-20240808.144430-srg.jar%23242!/:?] {re:mixin,pl:accesstransformer:B,pl:connector_pre_launch:A,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:A,pl:connector_pre_launch:A,pl:runtimedistcleaner:A}
at TRANSFORMER/[email protected]/net.minecraft.client.Minecraft.<init>(Minecraft.java:636) ~[client-1.21.1-20240808.144430-srg.jar%23242!/:?] {re:mixin,pl:accesstransformer:B,pl:connector_pre_launch:A,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:A,pl:connector_pre_launch:A,pl:runtimedistcleaner:A}
at TRANSFORMER/[email protected]/net.minecraft.client.main.Main.main(Main.java:214) ~[client-1.21.1-20240808.144430-srg.jar%23242!/:?] {re:classloading,pl:connector_pre_launch:A,pl:runtimedistcleaner:A}
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?] {}
at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?] {re:mixin}
at MC-BOOTSTRAP/[email protected]/net.neoforged.fml.loading.targets.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:136) ~[loader-4.0.34.jar%23130!/:4.0] {}
at MC-BOOTSTRAP/[email protected]/net.neoforged.fml.loading.targets.CommonLaunchHandler.clientService(CommonLaunchHandler.java:124) ~[loader-4.0.34.jar%23130!/:4.0] {}
at MC-BOOTSTRAP/[email protected]/net.neoforged.fml.loading.targets.CommonClientLaunchHandler.runService(CommonClientLaunchHandler.java:32) ~[loader-4.0.34.jar%23130!/:4.0] {}
at MC-BOOTSTRAP/[email protected]/net.neoforged.fml.loading.targets.CommonLaunchHandler.lambda$launchService$4(CommonLaunchHandler.java:118) ~[loader-4.0.34.jar%23130!/:4.0] {}
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-11.0.4.jar%23105!/:?] {}
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-11.0.4.jar%23105!/:?] {}
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-11.0.4.jar%23105!/:?] {}
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.run(Launcher.java:103) [modlauncher-11.0.4.jar%23105!/:?] {}
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.main(Launcher.java:74) [modlauncher-11.0.4.jar%23105!/:?] {}
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-11.0.4.jar%23105!/:?] {}
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-11.0.4.jar%23105!/:?] {}
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:?] {}