Skip to content

Fix chunk unload and cleanup logic #1347#1406

Merged
codeHusky merged 2 commits intosmartcmd:mainfrom
ModMaker101:fix/chunk-unload-1347
Mar 25, 2026
Merged

Fix chunk unload and cleanup logic #1347#1406
codeHusky merged 2 commits intosmartcmd:mainfrom
ModMaker101:fix/chunk-unload-1347

Conversation

@ModMaker101
Copy link
Copy Markdown
Contributor

Description

Fixed chunk bug where loaded chunks would never unload and could cause game crashes after some time. Also fixed an issue where changing your render distance caused the game to crash.

Changes

Previous Behavior

Chunks outside the new radius were never fully unloaded, remaining in cache and reloading instantly when the radius increased.

Root Cause

Chunk cache entries and related state were not being cleared during unload or radius changes.

New Behavior

Chunks outside the radius are now fully removed from the cache, tracking lists, and pending requests. The active chunk set is rebuilt correctly when the radius changes.

Fix Implementation

  • Properly clear chach[idx], hasData[idx]
  • Remove stale addRequests on radius change
  • Drop chunk cache on radius shrink
  • Celena server-side cache entries.

AI Use Disclosure

No.

Related Issues

2026-03-25.00-09-42.mp4

@codeHusky codeHusky merged commit a24318e into smartcmd:main Mar 25, 2026
1 check passed
chrisGrando pushed a commit to chrisGrando/LegacyMinecraft that referenced this pull request Mar 26, 2026
* Fix chunk unload and cleanup logic, fixes smartcmd#1347

* Applying formatting to code I edited 😝

(cherry picked from commit a24318e)
codeHusky added a commit that referenced this pull request Mar 26, 2026
This reverts commit a24318e.
This fix introduces broken behavior for dedicated servers. It will be
merged back in once the related issue is fixed
ArchieDxncan pushed a commit to ArchieDxncan/LegacyDxncan that referenced this pull request Apr 1, 2026
* Fix chunk unload and cleanup logic, fixes smartcmd#1347

* Applying formatting to code I edited 😝
ArchieDxncan pushed a commit to ArchieDxncan/LegacyDxncan that referenced this pull request Apr 1, 2026
This reverts commit a24318e.
This fix introduces broken behavior for dedicated servers. It will be
merged back in once the related issue is fixed
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.

[Bug] [MAJOR] Loaded chunks never unload and cause game to crash once too many are loaded.

2 participants