Fix NPE in PackageRenderer by adjusting model registration timing - #126
Closed
choke-dev wants to merge 2 commits into
Closed
Fix NPE in PackageRenderer by adjusting model registration timing#126choke-dev wants to merge 2 commits into
choke-dev wants to merge 2 commits into
Conversation
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.
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Placing a rare package (e.g., Rare Marble Gate or Rare Blaze) causes an immediate
NullPointerExceptionin Create'sPackageRendereron NeoForgeWhat was happening was that
CDPPartialModels.register()was executing insideFMLClientSetupEvent, so it missed the NeoForge Model Bakery phase and resulted inPartialModelreturning a fatal null value when the renderer queried it.Tested locally on
NeoForge 1.21.1on version1.11.7bof the modbefore.fix.webm
after.fix.webm