Refresh generators on config reload#107
Merged
Merged
Conversation
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>
|
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.



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:NewMaterialPopulatorkept theworldDepthcaptured atonLoad, so depth changes did not apply to newly generated nether/end chunks until a full restart.ChunkGeneratorWorldheld theSettingsinstance captured at construction, butloadSettings()replaces it vialoadConfigObject(), so roof/floor/main-block changes were also ignored on reload.Fix
onReload()now callsreload()on all three generators.ChunkGeneratorWorld.reload()re-readsaddon.getSettings()(thesettingsfield is no longerfinal) before rebuilding its populators, so reloaded settings take effect on newly generated chunks without a restart.testOnReloadnow callsonLoad()first, matching the real addon lifecycle (generators exist before a reload). Includes the mergedtestCreateWorldsupdate from develop.All 50 tests pass locally.
🤖 Generated with Claude Code