From 81b07d1dd96c6773d07831a3aa62f90a0d610e30 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Thu, 15 Oct 2026 07:51:28 +0200 Subject: [PATCH] Rebuild every section when a meshing option changes like vanilla Options.cutoutLeaves, ambientOcclusion and biomeBlendRadius call LevelExtractor.allChanged when they change. Horizon only handed the new value to the mesher, so after turning See-Through Leaves off the loaded sections kept their see-through leaves, pale against the sky, beside the opaque ones of sections rebuilt later. Fixes #273 Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game.rs | 16 ++++++++++++++++ crates/horizon-client/src/game/debug_keys.rs | 8 +------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/crates/horizon-client/src/game.rs b/crates/horizon-client/src/game.rs index 45068c9d6..62e801f78 100644 --- a/crates/horizon-client/src/game.rs +++ b/crates/horizon-client/src/game.rs @@ -7269,9 +7269,17 @@ impl Game<'_> { .clamp_gui_scale([r.config.width as i32, r.config.height as i32]); } self.streaming.radius = self.settings.render_distance; + // Options.biomeBlendRadius, ambientOcclusion and cutoutLeaves: + // LevelExtractor.allChanged when they change. + let (s, st) = (&self.settings, &self.streaming); + let remesh = (s.biome_blend, s.smooth_lighting, s.cutout_leaves) + != (st.biome_blend, st.smooth_lighting, st.cutout_leaves); self.streaming.biome_blend = self.settings.biome_blend; self.streaming.smooth_lighting = self.settings.smooth_lighting; self.streaming.cutout_leaves = self.settings.cutout_leaves; + if remesh { + self.all_sections_changed(); + } self.audio.master = self.settings.master_volume; horizon_client::hud::GUI_SCALE.store( self.settings.gui_scale, @@ -7279,6 +7287,14 @@ impl Game<'_> { ); self.apply_ui_settings(); } + /// `LevelExtractor.allChanged`: every loaded section is rebuilt. + fn all_sections_changed(&mut self) { + for &(x, z) in self.world.chunks.keys() { + for sy in 0..horizon_client::chunk::HEIGHT / 16 { + self.world.dirty_sections.insert((x, sy, z)); + } + } + } /// Whether precipitation at a column is snow (Biome.coldEnoughToSnow: /// base temperature lowered above y 80) or none (no precipitation). fn precipitation(&self, x: i32, y: i32, z: i32) -> Option { diff --git a/crates/horizon-client/src/game/debug_keys.rs b/crates/horizon-client/src/game/debug_keys.rs index 3e920e60c..0f49cd459 100644 --- a/crates/horizon-client/src/game/debug_keys.rs +++ b/crates/horizon-client/src/game/debug_keys.rs @@ -227,13 +227,7 @@ impl Game<'_> { let player = self.player.is_some() && !self.reduced_debug_info(); match action { DebugAction::ReloadChunks => { - // LevelExtractor.allChanged: every section is rebuilt. - let keys: Vec<(i32, i32)> = self.world.chunks.keys().copied().collect(); - for (x, z) in keys { - for sy in 0..horizon_client::chunk::HEIGHT / 16 { - self.world.dirty_sections.insert((x, sy, z)); - } - } + self.all_sections_changed(); self.debug_translated("debug.reload_chunks.message"); true }