Fix client crash: lazy CategoryIcon recipe-viewer wrapper (JEI runtime accessed during RegisterEvent)#5115
Open
ascorblack wants to merge 1 commit into
Open
Conversation
CategoryIcon constructors run during RegisterEvent dispatch (GTRecipeCategories.init in CommonProxy.onRegister). With JEI (no EMI) the JeiCallWrapper immediately calls GTJEIPlugin.getRuntime(), which does not exist yet -> ExceptionInInitializerError aborts onRegister, GTDataComponents never registers, and item registration crashes with 'Trying to access unbound value: gtceu:data_item' (data_stick). Defer wrapper creation to the first get() call, when the viewer runtime is available. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What
Fixes a client crash on world-independent startup when JEI is installed (and EMI is not):
CategoryIconconstructors run during theRegisterEventdispatch (GTRecipeCategories.init()insideCommonProxy.onRegister) and immediately callGTJEIPlugin.getRuntime(), which does not exist yet.The resulting
ExceptionInInitializerErrorabortsonRegistermidway, soGTDataComponents.DATA_COMPONENTSnever registers, and item registration then dies with:Implementation Details
CategoryIconnow stores the rawResourceLocation/ItemStackand resolves the EMI/JEI wrapper lazily on the firstget()call — by then the recipe-viewer runtime exists. Behavior for EMI (which was safe eagerly) is unchanged apart from the deferral.AI Usage
Agent Used
Claude Code (Claude Fable 5)
Agent Usage Description
The agent diagnosed the crash from our modpack's crash report, traced the eager
getRuntime()call, and wrote the lazy-resolution patch and this PR text. The diff was reviewed by the submitter before opening.Outcome
Client starts normally with JEI-only recipe viewer setups on 1.21 HEAD.
How Was This Tested
Reproduced the crash in our 1.21.1 pack (JEI 19.38, no EMI) on a build of 1.21 HEAD (
1023cb75); with this patch applied the client boots and GT items/data components register normally. Dedicated server was unaffected before and after (the JEI wrapper path is never taken there).Potential Compatibility Issues
None expected —
get()callers receive the same wrapper objects, just created on first use instead of at registration time.