Due to the asynchronous nature of mod loading ColorHandlerEvent is sometimes (depending on how fast mods are loaded) fired before Block and Item registration which causes NullPointerException crashes.
net.minecraft.client.Minecraft line 457, mod loader thread is started
net.minecraft.client.Minecraft line 507, ColorHandlerEvents are fired
is this still a bug since cpw moved the color events to the mod bus?
This appears to still be an issue as of 28.1.96. ColorHandlerEvent.Block sometimes seems to be called before RegistryEvent.Register<Block> has finished, resulting in the blocks you're trying to color still being null.
I have seen that exception when another mod throws an exception during initialization. In my specific case, I had a faulty reobf in build causing my client event to fail, which caused that exception from various mods.
Try asking for full game logs to determine the faulting mod. Meanwhile, something should be done to make the crash more clear in Forge (I can post logs of when the issue happened for me if it helps)
Meanwhile, something should be done to make the crash more clear in Forge (I can post logs of when the issue happened for me if it helps).
That would be splendid. I get a lot of reports that should be for other mods. Any way I can help with this?
I would take a look at #6374 and maybe attempt to come up with another solution or implement a PR along the lines of what tt was suggesting, the big issue is at least with the way he was thinking of having it done from my understanding would be a breaking change so I am not sure if it can be considered before forge for MC 1.16.
Though I do wonder from the point of view that if it does not crash in ColorHandlerEvent (due to no problem mods), it show the proper error if memory serves in the forge GUI. I am not sure if the ColorHandlerEvent is async, but if it is not it may just be a matter of moving the check that shows the gui earlier/adding a second check to see if any errors occurred during the async stage, before moving onto the stage where things are not async. (Note I am not fully positive how the loading of mods works and only vaguely remember discussions I read so I may be wrong about it not all being async for loading)
Most helpful comment
I have seen that exception when another mod throws an exception during initialization. In my specific case, I had a faulty reobf in build causing my client event to fail, which caused that exception from various mods.
Try asking for full game logs to determine the faulting mod. Meanwhile, something should be done to make the crash more clear in Forge (I can post logs of when the issue happened for me if it helps)