Fix slow SubChunk garbage collection check, closes #6574 (#6731)

This commit is contained in:
Dylan T. 2025-06-11 21:29:03 +01:00 committed by GitHub
parent a4ac28592c
commit 95b4db5169
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -134,11 +134,8 @@ class SubChunk{
foreach($this->blockLayers as $layer){ foreach($this->blockLayers as $layer){
$layer->collectGarbage(); $layer->collectGarbage();
foreach($layer->getPalette() as $p){ if($layer->getBitsPerBlock() !== 0 || $layer->get(0, 0, 0) !== $this->emptyBlockId){
if($p !== $this->emptyBlockId){ $cleanedLayers[] = $layer;
$cleanedLayers[] = $layer;
continue 2;
}
} }
} }
$this->blockLayers = $cleanedLayers; $this->blockLayers = $cleanedLayers;