Skip to content

Make Peaceful spawn guard robust during world creation#16

Merged
tastybento merged 1 commit into
developfrom
13_peaceful_spawn_robustness
Jun 28, 2026
Merged

Make Peaceful spawn guard robust during world creation#16
tastybento merged 1 commit into
developfrom
13_peaceful_spawn_robustness

Conversation

@tastybento

Copy link
Copy Markdown
Member

Follow-up to #15. The smoke test still crashed with the exact same stack trace because the released jar pre-dates that fix — and because the original guard was not robust enough for this code path.

Why #15 alone wasn't sufficient

The populator runs while the world is still being created, inside WorldCreator.createWorld() (Poseidon.getWorld:167createWorlds:140). At that point the world is not yet registered with Bukkit, so Bukkit.getWorld(worldInfo.getUID()) can return null, the peaceful flag evaluates to false, and monster spawns proceed — crashing the chunk system again:

Caused by: java.lang.IllegalStateException: Cannot spawn monster for org.bukkit.entity.Drowned in Peaceful difficulty
    at world.bentobox.poseidon.generator.PoseidonBlockPop.netherPop(PoseidonBlockPop.java:89)
Caused by: java.lang.RuntimeException: Chunk system crash propagated from unrecoverableChunkSystemFailure

(seen in https://github.com/BentoBoxWorld/bbox-test-harness/actions/runs/28332381857/job/83932707724)

Fix

  • Fallback difficulty source: when the live world isn't registered yet, fall back to the addon's configured difficulty (Settings.getDifficulty()).
  • Defensive spawn: wrap spawnEntity in a try/catch (IllegalStateException). This is the real guarantee — a failed spawn for any reason (difficulty restriction, detection mismatch) is caught locally and can never propagate into an unrecoverable chunk-system failure during world generation.

No further version bump needed — #15 already set the version to 1.1.1.

🤖 Generated with Claude Code

The populator runs while the world is still being created (inside
WorldCreator.createWorld), so Bukkit.getWorld(uid) can return null and the
previous difficulty check would be bypassed, letting monster spawns crash
the chunk system again.

- Fall back to the addon's configured difficulty when the live world is
  not yet registered.
- Wrap spawnEntity in a try/catch for IllegalStateException so a failed
  spawn can never propagate and trigger an unrecoverable chunk system
  failure during world generation.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tastybento
tastybento merged commit 7ec79c4 into develop Jun 28, 2026
@tastybento tastybento mentioned this pull request Jun 28, 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