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 <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user