Chunks no longer exist in un-generated state

a non-generated chunk is now always represented by NULL. This forces the case of ungenerated chunks to be handled by all code, which is necessary because ungenerated chunks cannot be interacted with or modified in any meaningful way.
This commit is contained in:
Dylan K. Taylor
2020-12-03 22:28:43 +00:00
parent 05ab44f768
commit b9cd633cee
10 changed files with 59 additions and 97 deletions

View File

@ -51,8 +51,6 @@ class Chunk{
/** @var bool|null */
protected $lightPopulated = false;
/** @var bool */
protected $terrainGenerated = false;
/** @var bool */
protected $terrainPopulated = false;
/**
@ -207,15 +205,6 @@ class Chunk{
$this->dirtyFlags |= self::DIRTY_FLAG_TERRAIN;
}
public function isGenerated() : bool{
return $this->terrainGenerated;
}
public function setGenerated(bool $value = true) : void{
$this->terrainGenerated = $value;
$this->dirtyFlags |= self::DIRTY_FLAG_TERRAIN;
}
public function addEntity(Entity $entity) : void{
if($entity->isClosed()){
throw new \InvalidArgumentException("Attempted to add a garbage closed Entity to a chunk");