LightPopulationTask: Don't overwrite the whole chunk on completion

this is more efficient (less data copied for ITC), fixes #2873, and also fixes terrain changes during task run getting overwritten.

This still leaves the problem that the light information provided may be out of date by the time the task completes, but this is nonetheless a step forward.
This commit is contained in:
Dylan K. Taylor
2019-10-22 20:13:46 +01:00
parent 296825b87e
commit e1352668d1
2 changed files with 56 additions and 4 deletions

View File

@ -620,6 +620,17 @@ class Chunk{
return $this->heightMap->toArray();
}
/**
* @param int[] $values
* @throws \InvalidArgumentException
*/
public function setHeightMapArray(array $values) : void{
if(count($values) !== 256){
throw new \InvalidArgumentException("Expected exactly 256 values");
}
$this->heightMap = \SplFixedArray::fromArray($values);
}
/**
* @return bool
*/