Chunk: Share EmptySubChunk instance with other chunks on the same thread

This commit is contained in:
Dylan K. Taylor
2018-06-04 11:44:18 +01:00
parent 0d177d5219
commit 857f6dd5df
2 changed files with 11 additions and 1 deletions

View File

@ -103,7 +103,7 @@ class Chunk{
$this->height = Chunk::MAX_SUBCHUNKS; //TODO: add a way of changing this
$this->subChunks = new \SplFixedArray($this->height);
$this->emptySubChunk = new EmptySubChunk();
$this->emptySubChunk = EmptySubChunk::getInstance();
foreach($this->subChunks as $y => $null){
$this->subChunks[$y] = $subChunks[$y] ?? $this->emptySubChunk;