Conversation
The lwjgl agent transforms every `org/lwjgl` class by gutting all method
bodies, including the static initializer. For `org.lwjgl.system.Configuration`
that leaves its `public static final Configuration<?>` option fields null.
Minecraft 26.2 added `com.mojang.blaze3d.platform.NativeLibrariesBootstrap`,
which reads `Configuration.SHARED_LIBRARY_EXTRACT_PATH` while loading native
libraries. With the field null the client crashes on startup before the window
opens (exit 253) under `--lwjgl`:
Description: Loading native libraries
java.lang.NullPointerException: Cannot invoke "org.lwjgl.system.Configuration.get()"
because "org.lwjgl.system.Configuration.SHARED_LIBRARY_EXTRACT_PATH" is null
at com.mojang.blaze3d.platform.NativeLibrariesBootstrap.configureLWJGLLibraryPath
Configuration is a pure settings registry with no native calls, so leave it
untouched. It then behaves exactly as it does in a real (non-headless) launch,
where these fields are always populated, while every actual native/GL class
stays stubbed. Fixes headless launches of Minecraft 26.2 (all modloaders).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Member
Author
|
Closing in favour of #426, which I'd missed when I opened this — thanks @okafke. #426 reaches the same conclusion for the native-libraries crash (ignore If it's useful, the regression test I added here ( |
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.
Problem
Launching Minecraft 26.2 headlessly with the
--lwjglagent crashes on startup (exit 253), for all three modloaders (Fabric, NeoForge, LexForge):Root cause
LwjglTransformertransforms everyorg/lwjglclass by replacing all method bodies with redirection calls, including the static initializer (<clinit>). Fororg.lwjgl.system.Configurationthis means itspublic static final Configuration<?>option fields are never assigned and staynull.Minecraft 26.2 introduced
com.mojang.blaze3d.platform.NativeLibrariesBootstrap, which readsConfiguration.SHARED_LIBRARY_EXTRACT_PATHduring native-library loading. Because the field isnull, the client NPEs before the window opens. Earlier versions (26.1.x and below) never touchedConfigurationat bootstrap, so the gutted initializer was harmless — this only surfaces on 26.2+.Fix
Leave
org.lwjgl.system.Configurationuntransformed. It is a pure configuration registry with no native calls, so it can safely run as-is. It then behaves exactly as it does in a real (non-headless) launch — where these fields are always populated — while every actual native/GL class stays stubbed.Testing
LwjglInstrumentationTest.testConfigurationStaticInitializerPreserved(), which loads a stuborg.lwjgl.system.Configurationthrough the transformer and asserts its static field is non-null. Verified it fails without the guard (expected: not <null>) and passes with it.:headlessmc-lwjgl:testsuite passes.Context
Surfaced while adding Minecraft 26.2 support to
headlesshq/mc-runtime-test(headlesshq/mc-runtime-test#137). The defaultxvfbpath already works on 26.2; only the--lwjglheadless path hit this. Once released, mc-runtime-test can bump itshmc-versionto pick this up.🤖 Generated with Claude Code