Skip to content

Fix NPE in PackageRenderer by adjusting model registration timing - #126

Closed
choke-dev wants to merge 2 commits into
DragonsPlusMinecraft:1.21.1/6.0.0-devfrom
choke-dev:1.21.1/6.0.0-dev
Closed

Fix NPE in PackageRenderer by adjusting model registration timing#126
choke-dev wants to merge 2 commits into
DragonsPlusMinecraft:1.21.1/6.0.0-devfrom
choke-dev:1.21.1/6.0.0-dev

Conversation

@choke-dev

@choke-dev choke-dev commented Sep 2, 2026

Copy link
Copy Markdown

Placing a rare package (e.g., Rare Marble Gate or Rare Blaze) causes an immediate NullPointerException in Create's PackageRenderer on NeoForge

What was happening was that CDPPartialModels.register() was executing inside FMLClientSetupEvent, so it missed the NeoForge Model Bakery phase and resulted in PartialModel returning a fatal null value when the renderer queried it.

Tested locally on NeoForge 1.21.1 on version 1.11.7b of the mod

Before After
before.fix.webm
game shortly crashed after the black screen
after.fix.webm

Moved `CDPPartialModels.register() out of `FMLClientSetupEvent` and into the client constructor. It was executing too late and missing the NeoForge Model Bakery, causing `PartialModel` to return null and crash `PackageRenderer` on block placement.
@MarbleGateKeeper

Copy link
Copy Markdown
Member

Thank you for Your PR! I'm so sorry that I'm afraid I'll close this PR since this is not a proper way to fix this issue. Just like how AllPartialModels are initialized in Create itself, partial models initialize with side effect (somehow I found it can be avoided). Simply moving registration timing in this mod will cause game start or datagen to break.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants