SpongePowered / Sponge

The SpongeAPI implementation targeting vanilla Minecraft and 3rd party platforms.
MIT License
383 stars 210 forks source link

Fix RegisterRegistryEvent.GameScoped being fired too soon #4062

Closed Yeregorix closed 2 months ago

Yeregorix commented 2 months ago

Forge constructs mods after bootstrapping registries. That's why we shouldn't fire events during SpongeLifecycle#establishEarlyGlobalRegistries and SpongeLifecycle#finalizeEarlyGlobalRegistries.

RegisterRegistryValueEvent.BuiltIn is fired in SpongeLifecycle#finalizeEarlyGlobalRegistries. I'm not sure how we could fix that because vanilla registries are frozen before mods are constructed.