mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Entity: Attach to level & chunk after initEntity() call, not before
this avoids leaving garbage entities attached to chunks when exceptions are thrown during initEntity().
This commit is contained in:
parent
47742d74c8
commit
85136b7b4a
@ -553,10 +553,12 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
$this->setGenericFlag(self::DATA_FLAG_AFFECTED_BY_GRAVITY, true);
|
||||
$this->setGenericFlag(self::DATA_FLAG_HAS_COLLISION, true);
|
||||
|
||||
$this->chunk->addEntity($this);
|
||||
$this->level->addEntity($this);
|
||||
$this->initEntity();
|
||||
$this->propertyManager->clearDirtyProperties(); //Prevents resending properties that were set during construction
|
||||
|
||||
$this->chunk->addEntity($this);
|
||||
$this->level->addEntity($this);
|
||||
|
||||
$this->lastUpdate = $this->server->getTick();
|
||||
$this->server->getPluginManager()->callEvent(new EntitySpawnEvent($this));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user