Added better Entity/Tile scheduled updates

This commit is contained in:
Shoghi Cervantes
2014-09-01 11:59:46 +02:00
parent e047b6a870
commit ff48eb3d4d
6 changed files with 23 additions and 33 deletions

View File

@@ -64,11 +64,6 @@ abstract class Entity extends Position implements Metadatable{
public static $entityCount = 1;
/**
* @var Entity[]
*/
public static $needUpdate = [];
/**
* @var Player[]
*/
@@ -584,8 +579,7 @@ abstract class Entity extends Position implements Metadatable{
}
public final function scheduleUpdate(){
//TODO!
Entity::$needUpdate[$this->id] = $this;
$this->level->updateEntities[$this->id] = $this;
}
public function setOnFire($seconds){
@@ -1106,7 +1100,7 @@ abstract class Entity extends Position implements Metadatable{
if($this->closed === false){
$this->server->getPluginManager()->callEvent(new EntityDespawnEvent($this));
$this->closed = true;
unset(Entity::$needUpdate[$this->id]);
unset($this->level->updateEntities[$this->id]);
if($this->chunk instanceof FullChunk){
$this->chunk->removeEntity($this);
}