Stop /locate freezing the server for disabled structures (#116)#117
Merged
Conversation
Disabling a structure in `world.structures` cancels its AsyncStructureSpawnEvent so it never gets placed, but leaves the world's structure placement rules untouched. Every structure search — the /locate command, Eyes of Ender, explorer/treasure maps, dolphins and villager map trades — therefore keeps proposing candidate positions that are all cancelled, so the search can never succeed and scans out to the radius cap. On a test world, `/locate structure minecraft:trial_chambers` generated ~1,500 cancelled structure starts and froze the main thread for 62 seconds, tripping the Watchdog. Handle Paper's StructuresLocateEvent (fired before any structure search) to remove disabled structures from the search list, and cancel outright when nothing remains, so the search returns "not found" instantly instead of scanning. Enabled structures and searches in other worlds are untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015GBGsNFUshypm5Sj8KQsEa
|
This was referenced Jul 9, 2026
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.



Problem
Part of #116. Disabling a structure via
world.structurescancels itsAsyncStructureSpawnEventso it is never placed — but that leaves the world's structure placement rules intact. Every structure search keeps proposing candidate positions that are then all cancelled, so the search can never succeed and scans outward to the radius cap.This affects the whole search family, per
StructuresLocateEvent's own javadoc:/locatecommandOn a local test world,
/locate structure minecraft:trial_chambersgenerated ~1,500 cancelled trial-chamber structure starts, scanning ~±9,000 blocks, and froze the main thread for 62 seconds, tripping the Paper Watchdog:Fix
Handle
io.papermc.paper.event.world.StructuresLocateEvent, which Paper fires before any structure search. In a CaveBlock world:Enabled structures, and searches in other worlds, are untouched. This sits alongside the existing
AsyncStructureSpawnEventhandler:AsyncStructureSpawnEvent→ stops physical generationStructuresLocateEvent→ stops the search freezeTesting
/locate structure minecraft:trial_chambersnow returns immediately instead of freezing for 62 s, with no flood of cancelled spawn events and no Watchdog error.Not covered here (follow-up)
The other half of #116 — a structure still generating in the initial spawn pre-gen area — stems from
createWorlds()running beforeonEnable(), where the listener is registered, so the first chunks generate before suppression is active. That fix (register the listener before world creation) is a separate change and will follow.🤖 Generated with Claude Code