From 200b756b4ae2cbd0cce186d1b4db8041805c9ac1 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sun, 25 Oct 2026 20:53:31 +0100 Subject: [PATCH] Sculk: pass over idle sensors and catalysts in the block entity tick A sculk sensor, shrieker or catalyst with no vibration chosen, travelling or waiting, and no charge cursors, ticks without changing anything (vanilla's VibrationSystem.Ticker.tick and SculkSpreader.updateCursors return at once). The tick now leaves those out before asking whether the chunks around them tick (nine lookups each) and before looking them up a second time. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game/sculk.rs | 17 ++++++++++++----- crates/horizon-client/src/sculk.rs | 7 +++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/crates/horizon-client/src/game/sculk.rs b/crates/horizon-client/src/game/sculk.rs index a11a643c1..63909c592 100644 --- a/crates/horizon-client/src/game/sculk.rs +++ b/crates/horizon-client/src/game/sculk.rs @@ -718,17 +718,24 @@ impl Game<'_> { }) }; // The ticking ones in the index's order, with whether the chunks - // around them tick too. + // around them tick too. Most sensors and catalysts wait for a + // vibration or a death: their tick would change nothing, so they + // are passed over here (a vibration scheduled during these ticks is + // chosen on the next tick at the earliest, as in vanilla). + let entities = &self.world.block_entities; let due: Vec<((i32, i32, i32), bool)> = self .sculk .index .iter() .filter_map(|&key| { let (cx, cz) = (key.0 >> 4, key.2 >> 4); - ticks(cx, cz).then(|| { - let adjacent = (-1..=1).all(|dx| (-1..=1).all(|dz| ticks(cx + dx, cz + dz))); - (key, adjacent) - }) + if !ticks(cx, cz) + || matches!(entities.get(&key), Some(BlockEntity::Sculk(e)) if e.idle()) + { + return None; + } + let adjacent = (-1..=1).all(|dx| (-1..=1).all(|dz| ticks(cx + dx, cz + dz))); + Some((key, adjacent)) }) .collect(); for (key, adjacent) in due { diff --git a/crates/horizon-client/src/sculk.rs b/crates/horizon-client/src/sculk.rs index 3affbda77..eefedaa98 100644 --- a/crates/horizon-client/src/sculk.rs +++ b/crates/horizon-client/src/sculk.rs @@ -413,6 +413,13 @@ impl SculkEntity { spreader: SculkSpreader::default(), } } + /// Whether its block entity tick does nothing: no vibration chosen + /// or on its way, none waiting to be chosen, and no charge to spread. + pub fn idle(&self) -> bool { + self.vibration.current.is_none() + && self.vibration.selector.current().is_none() + && self.spreader.cursors.is_empty() + } pub fn for_block(name: &str) -> Option { Some(Self::new(match name { "minecraft:sculk_sensor" => SculkKind::Sensor,