migrate to new CompoundTag API (#1515)

This commit is contained in:
Dylan K. Taylor
2017-11-10 15:38:21 +00:00
committed by GitHub
parent d4494687d1
commit aa399a1109
20 changed files with 305 additions and 370 deletions

View File

@ -34,7 +34,6 @@ use pocketmine\level\Level;
use pocketmine\level\MovingObjectPosition;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\ShortTag;
abstract class Projectile extends Entity{
@ -62,9 +61,7 @@ abstract class Projectile extends Entity{
$this->setMaxHealth(1);
$this->setHealth(1);
if(isset($this->namedtag->Age)){
$this->age = $this->namedtag["Age"];
}
$this->age = $this->namedtag->getShort("Age", $this->age);
}
public function canCollideWith(Entity $entity) : bool{
@ -107,7 +104,7 @@ abstract class Projectile extends Entity{
public function saveNBT(){
parent::saveNBT();
$this->namedtag->Age = new ShortTag("Age", $this->age);
$this->namedtag->setShort("Age", $this->age);
}
protected function applyDragBeforeGravity() : bool{