Skip to content

Don't assume a level render state exists during extraction - #812

Open
koolBEANS829 wants to merge 1 commit into
Earthcomputer:fabricfrom
koolBEANS829:fix/portal-levelstate-npe
Open

Don't assume a level render state exists during extraction#812
koolBEANS829 wants to merge 1 commit into
Earthcomputer:fabricfrom
koolBEANS829:fix/portal-levelstate-npe

Conversation

@koolBEANS829

Copy link
Copy Markdown

Fixes #811.

RenderQueue's END_EXTRACTION handler assumes LevelExtractionContext#levelState
is 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.

This skips the extraction when there is no level state. The shapes simply aren't
collected for the secondary pass and still render normally in the main view; the only
visible consequence is that clientcommands' overlays don't draw inside a portal view.

The same guard is added to render() for symmetry, but I want to flag that I could
not get it to trigger — LevelRenderContext#levelState stayed non-null through every
portal pass I observed. Happy to drop that half if you'd rather keep it minimal.

Testing

Built this against 26.2 and played with Seamless Portals (Immersive Portals engine)
for a while: no crash, portals still render see-through with stock Immersive Portals
config, and /cenchant works end to end (RNG cracked, enchantment manipulation,
seed ready).

To be sure nothing else was in play, I diffed the resulting jar against the released
2.15.1 artifact — only RenderQueue*.class and build_info.json differ, the other
1293 entries are byte-identical.

Reproduction, full stack trace, and a note about the same unguarded call in the
bundled simplewaypoints are in #811.

🤖 Generated with Claude Code

https://claude.ai/code/session_016LE8JscQsjVStsxdM6WcJV

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 the END_EXTRACTION
handler NPEs as soon as a portal is on screen.

Skip the extraction when there is no level state. The shapes are simply
not collected for the secondary pass and still render normally in the
main view.

The same guard is added to render() for symmetry, although
LevelRenderContext#levelState was never observed to be null in practice.

Fixes Earthcomputer#811

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LE8JscQsjVStsxdM6WcJV
@Earthcomputer

Copy link
Copy Markdown
Owner

Please respond to my comment on the issue

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.

NPE in RenderQueue when a portal is rendered (Immersive Portals / Seamless Portals)

2 participants