Auto-suppress structure searches in structureless worlds - #3035
Merged
tastybento merged 1 commit intoJul 24, 2026
Conversation
A cartographer villager levelling up in a void world triggers a synchronous findNearestMapStructure scan on the main thread. Because the world's custom generator never places structures, the search can never succeed and grinds through vanilla noise generation for every candidate position until the watchdog kills the server — on auto-restarting hosts this repeats as soon as the villager's chunk loads again, producing a reboot loop. StructureListener now asks the world's Bukkit ChunkGenerator whether it places structures at all (shouldGenerateStructures). If not, every StructuresLocateEvent in that world is cancelled (or narrowed) with no configuration needed — a search in a structureless world is always the pathological scan-to-the-cap case. A per-world getStructureSettings() entry of true still force-enables a structure, as an escape hatch for converted worlds containing pre-existing structures. Game modes that do generate structures (SkyGrid, Boxed with allow-structures, CaveBlock overworld) report true and are unaffected, so no addon changes are required. Also expands the world.disabled-structures config comments: how to list valid keys in-game (/locate structure tab-completion) and a concrete example disabling the structures that explorer/treasure maps search for (monument, mansion, trial_chambers, buried_treasure). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EDVXb9Lg33agNqUHrs5mzR
|
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
A production server (BentoBox 3.16.2, Purpur 1.21.10, AOneBlock) froze repeatedly and entered a reboot loop. The watchdog thread dumps showed a cartographer villager levelling up and rolling an explorer-map trade, which runs
findNearestMapStructuresynchronously on the main thread. In a void world the structure can never be found, so the search evaluates jigsaw placement + full vanilla noise columns (the generator does not overridegetBaseHeight) out to the radius cap, exceeding the 60s watchdog limit. The level-up never completes/saves, so after the host auto-restarts, the villager re-triggers the same search — an indefinite freeze/reboot loop.The
StructureListeneradded in #3019 covers this, but only when the admin populatesworld.disabled-structures— it is empty by default, so out of the box nothing is protected.Change
StructureListener.onStructuresLocatenow asks the world's BukkitChunkGeneratorwhether it places structures at all (shouldGenerateStructures). If it does not, every structure search in that world is suppressed with no configuration needed — a search in a structureless world is always the pathological scan-to-the-cap case, never a success.WorldSettings#getStructureSettings()entry oftruestill force-enables a structure (escape hatch for converted worlds that contain pre-existing structures).truefrom their generators and are unaffected: SkyGrid (true), Boxed (allow-structuresconfig), CaveBlock (overworld only), AcidIsland (make-structuresconfig). AOneBlock and BSkyBlock reportfalseand get automatic protection. No addon changes required.AsyncStructureSpawnEventhandling is unchanged (those events cannot fire in a structureless world).Also expands the
world.disabled-structuresconfig comments (Settings.java + config.yml): how to list valid structure keys in-game (tab-complete/locate structure) and a concrete example disabling the structures explorer/treasure maps search for (monument,mansion,trial_chambers,buried_treasure) — the fix admins on released versions can apply today.Testing
StructureListenerTestcovering: unconfigured cancellation in a structureless world, force-enable escape hatch, structure-generating worlds untouched, and spawn suppression unaffected.🤖 Generated with Claude Code
https://claude.ai/code/session_01EDVXb9Lg33agNqUHrs5mzR