Description
Nicelight Async Loader
High-throughput async chunk streaming, predictive prefetching, and zero-redundancy structure generation.
Overview
Nicelight Async Loader is a lightweight, low-overhead optimization engine engineered to eliminate the most notorious bottlenecks in heavily modded Minecraft: massive worldgen lockups, aggressive chunk loading stutter, and severe memory spikes during high-speed exploration (Elytra, mounts, creative flight).
Unlike conventional chunk loaders that flood the main server thread with unmanaged requests, Nicelight introduces velocity-based raycasting, radial idle prefetching, adaptive smooth chunk unloading, and multi-stage fast structure collision filtering.
Core Architectural Features
1. Structure Template Air Skipping & Fast Jigsaw Collision
- The Bottleneck: Large dungeon and boss mods (Cataclysm, When Dungeons Arise, Dungeons and Taverns) generate hundreds of complex jigsaw pieces. Vanilla Minecraft redundantly places every single
minecraft:airblock, repeatedly rebuilding heightmaps and firing expensive lighting recalculations for open space. Furthermore, intersecting bounding boxes invoke heavy 3D voxel checks (Shapes.joinIsNotEmpty). - The Solution:
- Zero-Redundancy Placement: Automatically bypasses
minecraft:airplacement whenever the target coordinate is already exposed to sky air. (Benchmark: skips 48,700+ redundant air blocks per worldgen, eliminating 57.6% of wastedsetBlockcalls). - O(1) AABB Pre-Filtering: Discards non-intersecting pieces via lightweight AABB checks prior to invoking costly 3D shape collision methods, bypassing over 600,000 heavy checks per session.
- Batched Heightmap Recalculation: Groups heightmap updates into batches rather than recalculating them per slice.
- Zero-Redundancy Placement: Automatically bypasses
2. Velocity-Based Predictive Chunk Prefetching
- Directional Raycasting: Continuously computes player vector angle and total velocity to prefetch chunks along the trajectory before borders are crossed (Walking: 3–4 chunks; Sprinting: 5–6 chunks; Flight: 8–18 chunks with strict ticket boundaries).
- Radial Idle Prefetching: While stationary or building, dynamically generates concentric chunk rings (R=1 to 3) in background worker threads.
- Ticket Storm Suppression: Enforces a hard ceiling on concurrent tickets to protect server tick health during rapid camera turns.
3. Adaptive Smooth Chunk Unloader (Anti-GC Lag Spike)
- The Bottleneck: Rapid travel accumulates thousands of unloaded chunks inside vanilla's
toDropbuffer (capped at 2,000). Flushing this buffer in a single tick triggers major garbage collection (GC) freezes and memory spikes. - The Solution: Decreases the unload threshold to 500 chunks and smoothly amortizes unloads (200 chunks/tick dynamically scaled to TPS health). Eliminates memory leak behavior during long sessions.
4. Instant Spawn Chunk Preparation
- Trims the bloated vanilla 11-radius spawn chunk area (441 chunks) down to a streamlined 3-radius zone (25 chunks), cutting 8–15 seconds off initial world boot times without breaking respawn anchors or beds.
Compatibility Matrix
Nicelight Async Loader is built for drop-in synergy with the modern optimization stack:
| Mod | Status | Recommended Synergy |
|---|---|---|
| C2ME (Concurrent Chunk Management Engine) | Fully Compatible | Nicelight detects C2ME automatically at boot. Structure acceleration and smooth unloading remain active while prefetch priority yields cleanly to C2ME (default: enablePrefetchWithC2ME: false). |
| ModernFix | Fully Compatible | Complements ModernFix's resource caching and memory leak patches. |
| Embeddium / Rubidium | Fully Compatible | Optimal pairing. Embeddium accelerates client mesh rendering; Nicelight accelerates server-side chunk streaming. |
| FerriteCore / Noisium | Fully Compatible | FerriteCore lowers baseline heap usage; Nicelight eliminates RAM spikes from the chunk drop buffer. |
| Canary / Radon | Fully Compatible | Entity AI and light engine improvements work in full harmony with Nicelight. |
| Cataclysm / Alex's Mobs / When Dungeons Arise | High Impact | Massively mitigates worldgen tick drops during dense dungeon assembly and biome decoration. |
Configuration Guide (8 Key Settings)
| Config Key | Default | Function | Recommendation |
|---|---|---|---|
enableSpawnChunkOptimization |
true |
Minimizes spawn chunk allocation for sub-second world loading (~0.4s). | Always keep true. |
enableVelocityPrefetch |
true |
Predictive raycasting for sprinting/flying to eliminate void edges. | Always keep true. |
prefetchMaxFlightDistance |
18 |
Maximum lookahead distance during high-speed Elytra or Creative flight. | Lower to 12 on lower-end hardware. |
enableIdleRadialPrefetch |
true |
Generates concentric chunk rings while stationary. | Always keep true. |
enableSmoothChunkUnload |
true |
Throttles chunk drops (35 chunks/tick) to remove GC lag spikes. | Always keep true. |
enableStructureTemplateBypass |
true |
Skips redundant sky air blocks in massive dungeons (cuts load by up to 50%). | Always keep true. |
enableFastJigsawCollision |
true |
O(1) AABB bounding box filtering before complex 3D shape joins. | Always keep true. |
enablePrefetchWithC2ME |
false |
Passes prefetch signals directly to C2ME scheduler. | Keep false. Set true if running ultra-high-speed mounts/spells. |
The Golden Rule: Out-of-the-Box Tuning
Leave settings at 100% default unless troubleshooting specific edge cases.
- Without C2ME: Defaults run all subsystems autonomously (directional streaming, instant spawn init, dungeon air bypass, and smoothed GC queues).
- With C2ME: Automatically harmonizes chunk tickets (
enablePrefetchWithC2ME: false) while preserving structure caching and RAM protection. - Deep Internal Settings: Thread pools and executor caches are pre-tuned across 200+ modpack stress benchmarks.
