diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index e7e924e76..9f9ff3a65 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -339,6 +339,7 @@ abstract class Entity extends Location implements Metadatable{ $this->invulnerable = $this->namedtag["Invulnerable"] > 0 ? true : false; $this->attributeMap = new AttributeMap(); + $this->addAttributes(); $this->chunk->addEntity($this); $this->level->addEntity($this); @@ -642,8 +643,6 @@ abstract class Entity extends Location implements Metadatable{ $this->scheduleUpdate(); - $this->addAttributes(); - if(isset($this->namedtag->ActiveEffects)){ foreach($this->namedtag->ActiveEffects->getValue() as $e){ $amplifier = $e["Amplifier"] & 0xff; //0-255 only diff --git a/src/pocketmine/entity/Living.php b/src/pocketmine/entity/Living.php index fbdac34e5..7a0a93e91 100644 --- a/src/pocketmine/entity/Living.php +++ b/src/pocketmine/entity/Living.php @@ -68,7 +68,7 @@ abstract class Living extends Entity implements Damageable{ public function setHealth($amount){ $wasAlive = $this->isAlive(); parent::setHealth($amount); - $this->attributeMap->getAttribute(Attribute::HEALTH)->setValue($this->getHealth()); + $this->attributeMap->getAttribute(Attribute::HEALTH)->setValue($this->getHealth(), true); if($this->isAlive() and !$wasAlive){ $pk = new EntityEventPacket(); $pk->eid = $this->getId(); diff --git a/src/pocketmine/entity/Squid.php b/src/pocketmine/entity/Squid.php index becc8cfc2..50a398360 100644 --- a/src/pocketmine/entity/Squid.php +++ b/src/pocketmine/entity/Squid.php @@ -43,8 +43,8 @@ class Squid extends WaterAnimal implements Ageable{ private $switchDirectionTicker = 0; public function initEntity(){ + $this->setMaxHealth(10); parent::initEntity(); - $this->setMaxHealth(5); } public function getName(){