Fixed attriutes not sending

This commit is contained in:
PEMapModder
2016-02-11 18:45:58 +08:00
parent 28967ca495
commit 8807617480
6 changed files with 29 additions and 10 deletions

View File

@ -32,6 +32,7 @@ use pocketmine\item\Item as ItemItem;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\ShortTag;
use pocketmine\network\protocol\EntityEventPacket;
use pocketmine\Player;
use pocketmine\Server;
use pocketmine\utils\BlockIterator;
@ -47,6 +48,8 @@ abstract class Living extends Entity implements Damageable{
protected function initEntity(){
parent::initEntity();
$this->addAttributes();
if(isset($this->namedtag->HealF)){
$this->namedtag->Health = new ShortTag("Health", (int) $this->namedtag["HealF"]);
unset($this->namedtag->HealF);
@ -57,7 +60,9 @@ abstract class Living extends Entity implements Damageable{
}
$this->setHealth($this->namedtag["Health"]);
}
protected function addAttributes(){
$this->attributeMap->addAttribute(Attribute::getAttribute(Attribute::ABSORPTION));
$this->attributeMap->addAttribute(Attribute::getAttribute(Attribute::HEALTH));
$this->attributeMap->addAttribute(Attribute::getAttribute(Attribute::MOVEMENT_SPEED));