fix: shrink Level scan to unlocked chunks only - #44
Merged
Conversation
The Level addon scans every chunk within island.getProtectionRange(). With the default of 240 blocks, that is ~961 chunks per dimension — most of them locked and empty in ChunkBlock. On slower servers this causes a 5-minute timeout. Listen for IslandPreLevelEvent and temporarily set the protection range to cover only the current unlocked ring (ring * 16 + 8). The Level calculator builds its chunk queue in the same tick, so the original range is restored on the next tick with no side effects. A player with only the center chunk now triggers 1 chunk scan instead of 961. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B94CWZDoiM9VevWtXb4RxF
240 supports up to ring 14 (841 chunks) but the default max-chunks is 441 (ring 10), so 168 is the minimum needed. The oversized default caused the Level addon to scan ~961 chunks instead of ~441. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B94CWZDoiM9VevWtXb4RxF
|
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.



Summary
IslandPreLevelEventand temporarily sets the island's protection range to cover only the unlocked chunk ring (ring * 16 + 8blocks) instead of the full 240-block defaultIslandLevelCalculatorreads the range in the same tick to build its chunk queue; the original range is restored on the next tickReported by an admin whose
/ch levelcommand consistently timed out. The Level addon generates every chunk in the protection range viagetChunkAtAsync(world, x, z, true)— with 240-block range that's ~961 void-chunk gen/load operations per dimension, which completes in ~13s on an M2 Mac but exceeds the 5-minute timeout on production VPS hardware.Test plan
LevelListenerTestcovering: range shrink for center-only island, range matching current ring, skip when range already small, ignore non-ChunkBlock worlds/ch levelon test server and verify faster completion🤖 Generated with Claude Code
https://claude.ai/code/session_01B94CWZDoiM9VevWtXb4RxF