generation: drop AsyncWorker thread-local storage in favour of a more specialized storage

This commit is contained in:
Dylan K. Taylor
2020-12-03 19:28:22 +00:00
parent 999defd20d
commit dde2e7e66f
4 changed files with 69 additions and 8 deletions

View File

@ -72,12 +72,13 @@ class PopulationTask extends AsyncTask{
}
public function onRun() : void{
$manager = $this->worker->getFromThreadStore("generation.world{$this->worldId}.manager");
$generator = $this->worker->getFromThreadStore("generation.world{$this->worldId}.generator");
if(!($manager instanceof SimpleChunkManager) or !($generator instanceof Generator)){
$context = ThreadLocalGeneratorContext::fetch($this->worldId);
if($context === null){
$this->state = false;
return;
}
$generator = $context->getGenerator();
$manager = $context->getChunkManager();
/** @var Chunk[] $chunks */
$chunks = [];