From cceda07476b2b15f7638d5a5b25269dd8611ab86 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sat, 17 Oct 2026 05:57:42 +0200 Subject: [PATCH] Sculk: find a loaded chunk's sensors from its palettes, not every block When chunks arrive, the sculk index looks through them for sensors, shriekers and catalysts. It unpacked and tested all 4,096 blocks of every section that wasn't uniform: 10 to 18 ms in a tick after a world loaded, more over a larger render distance (#489). A section whose palette holds no sculk state has no sculk block, so it is passed over without reading its blocks; the others are scanned as before, and the same blocks are found. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game/sculk.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/horizon-client/src/game/sculk.rs b/crates/horizon-client/src/game/sculk.rs index 6701181e7..6901200f1 100644 --- a/crates/horizon-client/src/game/sculk.rs +++ b/crates/horizon-client/src/game/sculk.rs @@ -373,6 +373,14 @@ impl Game<'_> { let mut found = Vec::new(); for (s, section) in chunk.sections.iter().enumerate() { let y0 = MIN_Y + s as i32 * 16; + // Without a sculk state in its palette, no block of the section + // is one: most sections are passed over without reading a block. + if !section + .blocks + .maybe_has(|v| u16::try_from(v).is_ok_and(|v| self.kind_of_state(v) != 0)) + { + continue; + } if section.blocks.uniform().is_some() { // A uniform section of sculk blocks does not exist. continue;