Limit SubChunk to 2 layers, avoid arrays (#6747)

Initially proposed in #6575

This shows about a 10% performance improvement to both SubChunk->getBlockStateId() and SubChunk->setBlockStateId(), so definitely worth doing. It does result in increased complexity, but for a double digits performance gain, I think it's worth it.

Closes #6575
This commit is contained in:
Dylan T.
2025-09-27 18:51:15 +01:00
committed by GitHub
parent 9eadf59bf5
commit 7ec548774c
10 changed files with 104 additions and 76 deletions

View File

@@ -32,7 +32,7 @@ class SubChunkTest extends TestCase{
* Test that a cloned SubChunk instance doesn't influence the original
*/
public function testClone() : void{
$sub1 = new SubChunk(0, [], new PalettedBlockArray(BiomeIds::OCEAN));
$sub1 = new SubChunk(0, null, null, new PalettedBlockArray(BiomeIds::OCEAN));
$sub1->setBlockStateId(0, 0, 0, 1);
$sub1->getBlockLightArray()->set(0, 0, 0, 1);