From ee0af20e16cc4ec5e3ad3240dccdde8dec3fe8fb Mon Sep 17 00:00:00 2001 From: socksprox Date: Tue, 27 Oct 2026 01:27:41 +0100 Subject: [PATCH] Cap the view scale's render distance by the server's streaming.radius reverts to the client setting in apply_settings, so an options change on a server with a lower view distance raised every entity's render range past vanilla's. min(render_distance, remote.view_distance) is Options.getEffectiveRenderDistance. Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- crates/horizon-client/src/game/entity_culling.rs | 11 ++++++++--- crates/horizon-client/src/game/remote.rs | 4 +++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/crates/horizon-client/src/game/entity_culling.rs b/crates/horizon-client/src/game/entity_culling.rs index 4377b2f8d..971639a42 100644 --- a/crates/horizon-client/src/game/entity_culling.rs +++ b/crates/horizon-client/src/game/entity_culling.rs @@ -63,10 +63,15 @@ impl Game<'_> { impl Game<'_> { /// Entity.setViewScale (LevelExtractor.extractVisibleEntities): the entity /// distance option times the render distance's boost — 1 at 8 chunks, 2.5 - /// at 20 or more (`streaming.radius` is the effective render distance). + /// at 20 or more. The render distance is the client setting, capped by + /// the server's view distance when connected + /// (Options.getEffectiveRenderDistance). pub(super) fn view_scale(&self) -> f64 { - (f64::from(self.streaming.radius) / 8.0).clamp(1.0, 2.5) - * f64::from(self.settings.entity_distance) + let distance = match &self.remote { + Some(r) => self.settings.render_distance.min(r.view_distance), + None => self.settings.render_distance, + }; + (f64::from(distance) / 8.0).clamp(1.0, 2.5) * f64::from(self.settings.entity_distance) } } diff --git a/crates/horizon-client/src/game/remote.rs b/crates/horizon-client/src/game/remote.rs index e9f30e84b..698dbb903 100644 --- a/crates/horizon-client/src/game/remote.rs +++ b/crates/horizon-client/src/game/remote.rs @@ -123,7 +123,9 @@ pub(super) struct Remote { pub(super) chunk_format: Arc, /// Decodes chunk packets as they arrive, off the frame. decoder: ChunkDecoder, - view_distance: i32, + /// Options.serverRenderDistance: the server's view distance from the + /// login or the last chunk-cache-radius packet. + pub(super) view_distance: i32, sequence: i32, position_sender: horizon_client::player_sync::PositionSender, last_input: u8,