
Crashes with Json Things
WizardJoker opened this issue ยท 5 comments
Issue description
Game failed to launch with Emendatus Enigmatica and Json Things.
Steps to reproduce
- Adding Emendatus Enigmatica and Json Things to a new instance
- Launch the instance
- Game failed to launch
Minecraft version
1.19.2 (Latest)
Forge version
43.4.4
Emendatus Enigmatica version
2.1.x (Latest)
Other relevant versions
Json Things: 0.7.15
If a (crash)log is relevant for this issue, link it here: (It's almost always relevant)
Appears to be a timing issue in JsonThings from my little debugging session ๐ They request a pack reload which triggers EE Data generation, and then they try to reference the instance of the future with their manager, which fails because it is still being constructed. Magic of working in parallel essentially ^^"
Not much I can do to fix this on EE side, especially for 1.19.2 >.>
Reported to Json Things: gigaherz/JsonThings#39
Fwiw, I don't request a pack reload per se.
Json Things loads a special kind of resource manager for "things", separate from "data" and "assets, so for that purpose it has a custom Pack Type. Understandably, a lot of mods don't know that there's going to be more enum entries than assets + data, so the code doesn't protect against this situation, and mods end up thinking it's resource packs, or data packs that are loading, and run the "wrong" code.
Thing is, because Json Things resources have to load before registry events, there's no way for me to change the timing of the code. I can only beg mod devs to add a default case in their pack type switch, or have if+else-if instead of just if+else.
That is assuming it's even this issue, which I didn't check to confirm.
Fwiw, I don't request a pack reload per se. Json Things loads a special kind of resource manager for "things", separate from "data" and "assets, so for that purpose it has a custom Pack Type. Understandably, a lot of mods don't know that there's going to be more enum entries than assets + data, so the code doesn't protect against this situation, and mods end up thinking it's resource packs, or data packs that are loading, and run the "wrong" code. Thing is, because Json Things resources have to load before registry events, there's no way for me to change the timing of the code. I can only beg mod devs to add a default case in their pack type switch, or have if+else-if instead of just if+else. That is assuming it's even this issue, which I didn't check to confirm.
That was just a summary of my understanding of the code, which as you can see I didn't get correct ๐
The issue here is that the EE Resource Manager is also being constructed by the construction of Json Things Resource Manager, and it takes too long for the future to get construct in time, resulting in NPE (from my understanding).
I would need to take more time to understand the underlying code and how everything is implemented, but like I said above, from the first quick debug session, it appears to be (in my understanding) a timing issue caused by EE data gen being executed when Json Things constructs the Resource Manager.
I think I have a possibly work-around for this issue on EE end however, but not sure if I will be able to release a patch for 1.19.2 as 1.21.1 is in the focus. I will test out if the issue persists on the 1.21.1 version as well hovewer, as the Data Generation logic was reworked on there ๐