Skip to content

Refresh generators on config reload#107

Merged
tastybento merged 2 commits into
developfrom
fix/reload-generators
Jun 27, 2026
Merged

Refresh generators on config reload#107
tastybento merged 2 commits into
developfrom
fix/reload-generators

Conversation

@tastybento

Copy link
Copy Markdown
Member

Fixes issue #3 from the #105 review.

Problem

When the single chunk generator was split into three per-environment generators, onReload() stopped calling the generator reload that the old code did. As a result, after a /caveblock reload:

  • NewMaterialPopulator kept the worldDepth captured at onLoad, so depth changes did not apply to newly generated nether/end chunks until a full restart.
  • ChunkGeneratorWorld held the Settings instance captured at construction, but loadSettings() replaces it via loadConfigObject(), so roof/floor/main-block changes were also ignored on reload.

Fix

  • onReload() now calls reload() on all three generators.
  • ChunkGeneratorWorld.reload() re-reads addon.getSettings() (the settings field is no longer final) before rebuilding its populators, so reloaded settings take effect on newly generated chunks without a restart.
  • testOnReload now calls onLoad() first, matching the real addon lifecycle (generators exist before a reload). Includes the merged testCreateWorlds update from develop.

All 50 tests pass locally.

🤖 Generated with Claude Code

tastybento and others added 2 commits June 26, 2026 16:51
onReload() now calls reload() on all three per-environment generators, and the
generator's reload() re-reads addon.getSettings() (a reload replaces the
Settings instance) before rebuilding its populators. This makes world depth,
roof/floor and main-block changes take effect on newly generated nether/end
chunks without a full server restart, restoring the behaviour lost when the
single generator was split into three.

testOnReload now calls onLoad() first, matching the real addon lifecycle in
which generators exist before a reload.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@tastybento tastybento merged commit 224d13c into develop Jun 27, 2026
3 checks passed
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