gigaherz / JsonThings

Data-driven minecraft
https://www.curseforge.com/minecraft/mc-mods/json-things
Other
22 stars 6 forks source link

[1.18.2] Crash/Incompat with Solar Flux Reborn #16

Closed PhweeDev closed 1 year ago

PhweeDev commented 1 year ago

Using Json Things (and Rhino) along with Solar Flux Reborn (And Hammer Lib) The game refuses to load. See below.

Latest: https://paste.gg/p/anonymous/fe8f30bc9a754549bcbc28ddc5e55125

Crash Rep: https://paste.gg/p/anonymous/038e51dcbe4c4bf8b38e7b28a9c3416a

gigaherz commented 1 year ago

I'll take a look as soon as I can. It may or may not be related to the breaking changes I introduced (didn't realize there were people actually using the mod's API when I made the changes)

gigaherz commented 1 year ago

I have done some investigation on this. After adding some extra logging:

java.lang.IllegalStateException: Registry is already frozen
    at net.minecraftforge.registries.NamespacedHolderHelper.createIntrusiveHolder(NamespacedHolderHelper.java:177) ~[forge-1.18.2-40.1.80_mapped_parchment_2022.09.04-1.18.2-recomp.jar%2378%2385!/:?] {re:classloading}
    at net.minecraftforge.registries.NamespacedDefaultedWrapper.createIntrusiveHolder(NamespacedDefaultedWrapper.java:205) ~[forge-1.18.2-40.1.80_mapped_parchment_2022.09.04-1.18.2-recomp.jar%2378%2385!/:?] {re:classloading}
    at net.minecraftforge.registries.NamespacedDefaultedWrapper.createIntrusiveHolder(NamespacedDefaultedWrapper.java:33) ~[forge-1.18.2-40.1.80_mapped_parchment_2022.09.04-1.18.2-recomp.jar%2378%2385!/:?] {re:classloading}
    at net.minecraft.world.level.block.Block.<init>(Block.java:67) ~[forge-1.18.2-40.1.80_mapped_parchment_2022.09.04-1.18.2-recomp.jar%2379!/:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.world.level.block.BaseEntityBlock.<init>(BaseEntityBlock.java:15) ~[forge-1.18.2-40.1.80_mapped_parchment_2022.09.04-1.18.2-recomp.jar%2379!/:?] {re:classloading}
    at org.zeith.solarflux.block.SolarPanelBlock.<init>(SolarPanelBlock.java:48) ~[solar-flux-reborn-246974-3721906_mapped_parchment_2022.09.04-1.18.2.jar%2388!/:18.2.4] {re:classloading}
    at org.zeith.solarflux.panels.SolarPanel.createBlock(SolarPanel.java:78) ~[solar-flux-reborn-246974-3721906_mapped_parchment_2022.09.04-1.18.2.jar%2388!/:18.2.4] {re:classloading}
    at org.zeith.solarflux.panels.SolarPanel.getBlock(SolarPanel.java:85) ~[solar-flux-reborn-246974-3721906_mapped_parchment_2022.09.04-1.18.2.jar%2388!/:18.2.4] {re:classloading}
    at org.zeith.solarflux.client.SolarFluxResourcePack.lambda$init$4(SolarFluxResourcePack.java:68) ~[solar-flux-reborn-246974-3721906_mapped_parchment_2022.09.04-1.18.2.jar%2388!/:18.2.4] {re:classloading}
    at java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1779) ~[?:?] {}
    at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) ~[?:?] {}
    at org.zeith.solarflux.client.SolarFluxResourcePack.init(SolarFluxResourcePack.java:66) ~[solar-flux-reborn-246974-3721906_mapped_parchment_2022.09.04-1.18.2.jar%2388!/:18.2.4] {re:classloading}
    at org.zeith.solarflux.client.SolarFluxResourcePack.getNamespaces(SolarFluxResourcePack.java:148) ~[solar-flux-reborn-246974-3721906_mapped_parchment_2022.09.04-1.18.2.jar%2388!/:18.2.4] {re:classloading}
    at net.minecraft.server.packs.resources.MultiPackResourceManager.<init>(MultiPackResourceManager.java:28) ~[forge-1.18.2-40.1.80_mapped_parchment_2022.09.04-1.18.2-recomp.jar%2379!/:?] {re:classloading}
    at net.minecraft.server.packs.resources.ReloadableResourceManager.createReload(ReloadableResourceManager.java:44) ~[forge-1.18.2-40.1.80_mapped_parchment_2022.09.04-1.18.2-recomp.jar%2379!/:?] {re:classloading}
    at dev.gigaherz.jsonthings.things.parsers.ThingResourceManager.beginLoading(ThingResourceManager.java:125) ~[%2384!/:?] {re:classloading}
    at dev.gigaherz.jsonthings.JsonThings.lambda$construct$0(JsonThings.java:97) ~[%2384!/:?] {re:classloading}
[...]

It looks like Solar Flux Reborn has a complex system which runs during Thingpack resource reload, however it isn't designedto run this early, and it expects to be running after registration when normal resource loading happens. The issue is Solar Flux Reborn doesn't account for the possibility of there being more pack types than resource packs and data packs, and runs the code when thingpacks are loading, when it probably shouldn't. I believe that's what is causing this incompatibility. I cannot fix the compatibility from my end, it needs to be fixed in Solar Flux Reborn. Feel free to pass them a link to this explanation.