From 95b4db5169db52777b826f3ea804c42c52c42100 Mon Sep 17 00:00:00 2001 From: "Dylan T." Date: Wed, 11 Jun 2025 21:29:03 +0100 Subject: [PATCH] Fix slow SubChunk garbage collection check, closes #6574 (#6731) --- src/world/format/SubChunk.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/world/format/SubChunk.php b/src/world/format/SubChunk.php index d8546e7e92..cc66734308 100644 --- a/src/world/format/SubChunk.php +++ b/src/world/format/SubChunk.php @@ -134,11 +134,8 @@ class SubChunk{ foreach($this->blockLayers as $layer){ $layer->collectGarbage(); - foreach($layer->getPalette() as $p){ - if($p !== $this->emptyBlockId){ - $cleanedLayers[] = $layer; - continue 2; - } + if($layer->getBitsPerBlock() !== 0 || $layer->get(0, 0, 0) !== $this->emptyBlockId){ + $cleanedLayers[] = $layer; } } $this->blockLayers = $cleanedLayers;