Skip to content

Auto-suppress structure searches in structureless worlds - #3035

Merged
tastybento merged 1 commit into
developfrom
feature/structureless-world-locate-suppression
Jul 24, 2026
Merged

Auto-suppress structure searches in structureless worlds#3035
tastybento merged 1 commit into
developfrom
feature/structureless-world-locate-suppression

Conversation

@tastybento

Copy link
Copy Markdown
Member

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 findNearestMapStructure synchronously 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 override getBaseHeight) 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 StructureListener added in #3019 covers this, but only when the admin populates world.disabled-structures — it is empty by default, so out of the box nothing is protected.

Change

StructureListener.onStructuresLocate now asks the world's Bukkit ChunkGenerator whether 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.

  • A per-world WorldSettings#getStructureSettings() entry of true still force-enables a structure (escape hatch for converted worlds that contain pre-existing structures).
  • Game modes that do generate structures report true from their generators and are unaffected: SkyGrid (true), Boxed (allow-structures config), CaveBlock (overworld only), AcidIsland (make-structures config). AOneBlock and BSkyBlock report false and get automatic protection. No addon changes required.
  • The generator layer applies to searches only; AsyncStructureSpawnEvent handling is unchanged (those events cannot fire in a structureless world).

Also expands the world.disabled-structures config 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

  • 4 new tests in StructureListenerTest covering: unconfigured cancellation in a structureless world, force-enable escape hatch, structure-generating worlds untouched, and spawn suppression unaffected.
  • Full test suite passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EDVXb9Lg33agNqUHrs5mzR

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
@sonarqubecloud

Copy link
Copy Markdown

@tastybento
tastybento merged commit 7bd3e6b into develop Jul 24, 2026
3 checks passed
@tastybento
tastybento deleted the feature/structureless-world-locate-suppression branch July 27, 2026 15:27
@tastybento tastybento mentioned this pull request Jul 27, 2026
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.

1 participant