From 2c244f188824aedc48212955ac87333863c67a30 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sun, 18 Oct 2026 00:04:14 +0200 Subject: [PATCH] Creaking hearts: scan only sections whose palette holds a heart scan_for_hearts read all 4,096 blocks of every non-air section of each new chunk on the server thread to find creaking hearts. A section whose palette holds no heart state (PalettedContainer.maybeHas) cannot have one, so it is skipped. Same block entities, same order. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game/creaking.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/horizon-client/src/game/creaking.rs b/crates/horizon-client/src/game/creaking.rs index 099f3d7d8..4a8a5239b 100644 --- a/crates/horizon-client/src/game/creaking.rs +++ b/crates/horizon-client/src/game/creaking.rs @@ -327,13 +327,16 @@ impl Game<'_> { } let hearts = &self.creaking.hearts; let _ = heart; + let is_heart = |id: u32| hearts.get(id as usize).copied().unwrap_or(false); for (si, section) in chunk.sections.iter().enumerate() { - if section.is_uniform(0) { + // Only a section whose palette holds a heart state can have + // one: the others are skipped without reading their 4,096 blocks. + if !section.blocks.maybe_has(is_heart) { continue; } for i in 0..4096 { let id = section.get(i); - if !hearts.get(id as usize).copied().unwrap_or(false) { + if !is_heart(id) { continue; } let (lx, lz, ly) = ((i & 15) as i32, ((i >> 4) & 15) as i32, (i >> 8) as i32);