Lythom / capsule

A minecraft mod : Bring your base! Capsules can capture a region containing any blocks or machines, then deploy and undeploy at will. Inspired by Dragon Ball capsules.
MIT License
16 stars 13 forks source link

Add crash protection and additional loggin when loading block materials #78

Open Lythom opened 2 years ago

Lythom commented 2 years ago

[10:42] Lythom: The crash log tells there is an errors while configuring capsule mod, specifically when calling block.defaultBlockState().getMaterial() while iterating on ForgeRegistries.BLOCKS. It means there is a block registered that crashes when getMaterial is used on its default state. It can happen because the mod is not yet fully initialized at this point or because of a bug in the mod or because of a bug / incompatibility between one of the core mod that mofifies the getMaterial function and some other mod. I can't tell which block is causing this from the stack trace unfortunately. What I can do though is add crash protection to this section of capsule code and print an error with additional informations. I'm not at home this week but I'll try do add this later it should be quick to do.

Caused by 1: java.lang.ExceptionInInitializerError at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.handler$zch000$srm_getMaterial(BlockBehaviour.java:875) ~[client-1.18.2-20220404.173914-srg.jar%23184!/:?] {re:mixin,xf:fml:libx:random_tick_block,re:computing_frames,xf:fml:libx:random_tick_block,re:classloading,xf:fml:libx:random_tick_block,pl:mixin:APP:snowrealmagic.mixins.json:BlockStateMixin,pl:mixin:APP:byg.mixins.json:common.block.MixinBlockBehaviourBlockStateBase,pl:mixin:APP:valhelsia_core.mixins.json:BlockStateBaseMixin,pl:mixin:A} at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.m60767(BlockBehaviour.java) ~[client-1.18.2-20220404.173914-srg.jar%23184!/:?] {re:mixin,xf:fml:libx:random_tick_block,re:computing_frames,xf:fml:libx:random_tick_block,re:classloading,xf:fml:libx:random_tick_block,pl:mixin:APP:snowrealmagic.mixins.json:BlockStateMixin,pl:mixin:APP:byg.mixins.json:common.block.MixinBlockBehaviourBlockStateBase,pl:mixin:APP:valhelsia_core.mixins.json:BlockStateBaseMixin,pl:mixin:A} at capsule.Config.lambda$configureCapture$2(Config.java:185) ~[Capsule-1.18.2-6.0.92.jar%2378!/:1.18.2-6.0.92] {re:classloading} at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178) ~[?:?] {}