Skip to content

[Forge 1.20.1] Crash on startup (ExceptionInInitializerError) when used with OverClocked and EMF due to FMLJavaModLoadingContext NPE in SkullBlockRenderer #74

@FcoMGX

Description

@FcoMGX

Description of the bug

The game crashes immediately on startup when Nirvana (1.2.2) is installed alongside OverClocked: Clockworks (tickcontrol 1.0.5) and Entity Model Features (EMF 3.0.12) on Forge 1.20.1.

The crash occurs due to a java.lang.ExceptionInInitializerError when initializing SkullBlockRenderer. Nirvana injects a mixin to register the "Reefer Skull" model (SkullBlockRendererMixin). However, because OverClocked alters the tick/initialization timing and EMF loads models asynchronously, Nirvana's mixin fires outside the main mod loading thread. As a result, FMLJavaModLoadingContext.get() returns null, causing a NullPointerException when NirvanaBlocks.<clinit> attempts to access the ModEventBus via Registrate.

To Reproduce

Steps to reproduce the behavior:

  1. Install Forge 47.4.10 for Minecraft 1.20.1.
  2. Install the following mods:
    • Nirvana (nirvana-forge-1.2.2.jar)
    • OverClocked: Clockworks (overclocked_clockworks-1.0.5.jar)
    • Entity Model Features (entity_model_features_1.20.1-forge-3.0.12.jar)
  3. Launch the game.
  4. The game will crash during the Forge loading overlay before reaching the main menu.

Expected behavior

The game should launch successfully without crashing. Nirvana should be able to register its custom skull renderer safely, even if other mods alter the loading thread timings.

Loader

forge

Mod Version

1.2.2

Minecraft Version

1.20

Relevant log output

java.lang.ExceptionInInitializerError: null
	at net.minecraft.client.renderer.blockentity.SkullBlockRenderer.handler$cdd000$registerReeferModel(SkullBlockRenderer.java:1041)
	at net.minecraft.client.renderer.blockentity.SkullBlockRenderer.m_173661_(SkullBlockRenderer.java:59)
	at net.minecraft.client.renderer.blockentity.SkullBlockRenderer.<init>(SkullBlockRenderer.java:63)
	at net.minecraft.client.renderer.blockentity.BlockEntityRenderers.m_257086_(BlockEntityRenderers.java:24)
...
Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext.getModEventBus()" because the return value of "net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext.get()" is null
	at com.tterrag.registrate.AbstractRegistrate.getModEventBus(AbstractRegistrate.java:222)
	at galena.nirvana.forge.ForgeNirvanaRegistrate.create(ForgeNirvanaRegistrate.java:9)
	at galena.nirvana.forge.ForgeEntrypoint.lambda$static$0(ForgeEntrypoint.java:26)
	at net.minecraftforge.common.util.Lazy$Fast.get(Lazy.java:55)
	at galena.nirvana.forge.services.ForgePlatformHelper.getRegistrate(ForgePlatformHelper.java:31)
	at galena.nirvana.index.NirvanaBlocks.<clinit>(NirvanaBlocks.java:40)
	at net.minecraft.client.renderer.blockentity.SkullBlockRenderer.handler$cdd000$registerReeferModel(SkullBlockRenderer.java:1041)

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions