Added API to allow flagging an entity not to be saved to disk when its chunk is saved (#1452)

This commit is contained in:
Dylan K. Taylor
2017-10-11 16:09:08 +01:00
committed by GitHub
parent 7b1bfc0520
commit be2d134994
6 changed files with 55 additions and 20 deletions

View File

@ -337,6 +337,9 @@ abstract class Entity extends Location implements Metadatable{
/** @var bool */
protected $isStatic = false;
/** @var bool */
private $savedWithChunk = true;
/** @var bool */
public $isCollided = false;
/** @var bool */
@ -764,6 +767,24 @@ abstract class Entity extends Location implements Metadatable{
return false;
}
/**
* Returns whether this entity will be saved when its chunk is unloaded.
* @return bool
*/
public function canSaveWithChunk() : bool{
return $this->savedWithChunk;
}
/**
* Sets whether this entity will be saved when its chunk is unloaded. This can be used to prevent the entity being
* saved to disk.
*
* @param bool $value
*/
public function setCanSaveWithChunk(bool $value) : void{
$this->savedWithChunk = $value;
}
/**
* Returns the short save name
*