[1.21.1 NeoForge] CRITICAL: NullPointerException Cascade (Create/AE2/Apotheosis) caused by registry_event_progress
ivannf-oviedo opened this issue · 2 comments
Bug Description
Hello,
I am reporting a critical incompatibility/race condition found in a complex NeoForge 1.21.1 modpack (160+ mods, heavily optimized with Lithium/Sodium).
The issue causes a cascading mod loading failure (FATAL CRASH) due to multiple major mods failing to access their own registered items during the loading process.
Bug Description
When loading a large pack, the game crashes during the net.neoforged.neoforge.registries.RegisterEvent. The error indicates that the item registration has been accelerated too aggressively, causing key mods to crash upon self-referencing an item that has not yet been fully bound by the system.
Errors Observed in Crash Logs (The 'Unbound Value' Cascade)
The crash logs consistently show the same NullPointerException (NPE) for key items across multiple major mods.
| Mod ID | Version | Crash Error Snippet |
|---|---|---|
| create | v6.0.7 | NullPointerException: Trying to access unbound value: ResourceKey[... create:brass_hand] |
| apotheosis | v8.4.0 | NullPointerException: Trying to access unbound value: ResourceKey[... apotheosis:sigil_of_withdrawal] |
| ae2 | v19.2.17 | NullPointerException: Trying to access unbound value: ResourceKey[minecraft:item / ae2:inscriber] |
| cataclysm_spellbooks | v1.1.9 | NoClassDefFoundError (This was a side-effect of the registry collapse, now confirmed stable after fixing the root cause). |
Reproduction Steps
Diagnosis and Solution (The Fix)
The issue was diagnosed as a race condition caused by the ModernFix mixin that speeds up the registry event progress bar.
- Culprit Mixin:
modernfix-neoforge.mixins.json:feature.registry_event_progress.GameDataMixin - Result of Mixin: The accelerated registry processing executes item logic before the
DeferredHolderis fully bound by the NeoForgeRegisterEvent.
The most effective and stable fix was to disable this specific optimization:
-
Navigate to the configuration file:
config/modernfix-mixins.properties -
Add the following line to the end of the file:
mixin.feature.registry_event_progress=false
Environment Details
- Minecraft Version: 1.21.1
- Mod Loader: NeoForge (v21.1.213)
- ModernFix Version: v5.24.3+mc1.21.1
- Diagnosis Context: The fix stabilizes the pack, allowing concurrent loading of mods that heavily rely on
DeferredRegister.
Log File
Please provide a specific, small list of mods and steps that can be used to reproduce the issue.
Forneça uma pequena lista específica de mods e etapas que podem ser usadas para reproduzir o problema.
Modpack Context: NeoForge 1.21.1 (160+ mods, focused on stability)
I am submitting this report detailing a severe instability issue where the ModernFix registry optimization creates a race condition that causes item registration to collapse across multiple complex mods. This issue was difficult to diagnose as it was initially masked by a dependency conflict.
1. The Conflict Narrative (How the Bug was Unmasked)
The core crash was only revealed after resolving a severe internal dependency conflict:
- Initial State (Dependency Hell): I'm was forced to downgrade
Placeboto v9.9.0 because the newerPlacebo(v9.9.1) conflicted withCreativeCore(v2.13.13). This created a secondary crash, asApotheosis(v8.4.0) requiredPlacebo v9.9.1. - The Solution that Revealed the Bug: We resolved the dependency hell by forcing a clean installation of the latest dependency chain (
Apotheosis v8.4.0+Placebo v9.9.1+CreativeCore v2.13.13). - The Outcome (The ModernFix Crash): Although the dependency chain was now correct, the game still crashed instantly upon loading registry events. This proved the crash was not a dependency issue, but a ModernFix timing conflict impacting how these complex mods self-register their items.
2. The Crash Analysis (Unbound Value Cascade)
The crash logs consistently show the same NullPointerException (NPE) for key items across major mods, all failing during the registration event when attempting to access a value that has not yet been bound (due to acceleration).
| Mod ID | Version | Crash Error Snippet |
|---|---|---|
| create | v6.0.7 | NullPointerException: Trying to access unbound value: ResourceKey[... create:brass_hand] |
| ae2 | v19.2.17 | NullPointerException: Trying to access unbound value: ResourceKey[minecraft:item / ae2:inscriber] |
| apotheosis | v8.4.0 | NullPointerException: Trying to access unbound value: ResourceKey[... apotheosis:sigil_of_withdrawal] |
| cataclysm_spellbooks | v1.1.9 | This mod also crashed, but as a side-effect of the initial registry collapse. |
3. The Final Fix (The Most Effective Optimization)
The crash is resolved by disabling the specific ModernFix mixin that accelerates the registry progress bar, thereby allowing DeferredRegister logic to complete safely.
-
File Location:
config/modernfix-mixins.properties -
Action: Add the following line to disable the registry progress mixin:
# Disables registry acceleration mixin causing NullPointerExceptions in item registration mixin.feature.registry_event_progress=false
Environment Details
- Minecraft Version: 1.21.1
- Mod Loader: NeoForge (v21.1.213)
- ModernFix Version: v5.24.3+mc1.21.1