Don't assume a level render state exists during extraction - #12
Closed
koolBEANS829 wants to merge 1 commit into
Closed
koolBEANS829 wants to merge 1 commit into
koolBEANS829 wants to merge 1 commit into
Conversation
Mods that render a secondary world reuse the level extraction pass for a different level. Immersive Portals does this from SecondaryWorldRenderCore.renderDestWorld when drawing a portal's destination, and that pass has no level render state, so LevelExtractionContext#levelState returns null and extractWaypointBoxes NPEs as soon as a portal is on screen. This only shows up once the world has a waypoint, since the empty waypoint map returns early before reaching levelState(). Skip the extraction when there is no level state. Waypoints are simply not collected for the secondary pass and still render normally in the main view. Fixes xpple#11 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016LE8JscQsjVStsxdM6WcJV
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.
Fixes #11.
extractWaypointBoxesassumesLevelExtractionContext#levelStateis non-null.Immersive Portals runs a second extraction pass for a portal's destination world from
SecondaryWorldRenderCore.renderDestWorld, and that pass has no level render state —so the handler NPEs and the game crashes the moment a portal is on screen.
It only shows up once the current world has a waypoint, because the empty waypoint map
returns early before ever reaching
levelState(). That makes it easy to miss: you canplay next to portals indefinitely, then crash the first time you add a waypoint.
This skips the extraction when there is no level state. Waypoints simply aren't
collected for the secondary pass and still render normally in the main view; the only
visible consequence is that they don't draw inside a portal view.
Testing
Built 1.4.0 with this change and reproduced the original crash first (waypoint set +
portal on screen → instant NPE), then confirmed it's gone with the patch, portals still
rendering see-through. Diffed the rebuilt jar against the released one — only
WaypointRenderingHelper*.classdiffer, so nothing else is in play.I deliberately left
renderWaypointBoxesunguarded (line 212 dereferencesLevelRenderContext#levelStatethe same way). I could not get that one to return nullacross tens of thousands of portal render passes, so I didn't want to add a guard I
couldn't justify — happy to add it if you'd prefer the symmetry.
Context
Same root cause turned up in clientcommands, which bundles this mod as a JiJ
dependency: Earthcomputer/clientcommands#811 / Earthcomputer/clientcommands#812.
🤖 Generated with Claude Code
https://claude.ai/code/session_016LE8JscQsjVStsxdM6WcJV