Move a giant heap of network garbage out of Entity

This commit is contained in:
Dylan K. Taylor
2019-04-26 18:52:38 +01:00
parent ea8c723092
commit 854a2f5135
19 changed files with 488 additions and 339 deletions

View File

@ -35,6 +35,8 @@ use pocketmine\item\Potion;
use pocketmine\level\particle\PotionSplashParticle;
use pocketmine\level\sound\PotionSplashSound;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\network\mcpe\protocol\types\EntityMetadataFlags;
use pocketmine\network\mcpe\protocol\types\EntityMetadataProperties;
use pocketmine\utils\Color;
use function round;
use function sqrt;
@ -136,14 +138,14 @@ class SplashPotion extends Throwable{
* @return int
*/
public function getPotionId() : int{
return $this->propertyManager->getShort(self::DATA_POTION_AUX_VALUE) ?? 0;
return $this->propertyManager->getShort(EntityMetadataProperties::POTION_AUX_VALUE) ?? 0;
}
/**
* @param int $id
*/
public function setPotionId(int $id) : void{
$this->propertyManager->setShort(self::DATA_POTION_AUX_VALUE, $id);
$this->propertyManager->setShort(EntityMetadataProperties::POTION_AUX_VALUE, $id);
}
/**
@ -151,7 +153,7 @@ class SplashPotion extends Throwable{
* @return bool
*/
public function willLinger() : bool{
return $this->getDataFlag(self::DATA_FLAGS, self::DATA_FLAG_LINGER);
return $this->getDataFlag(EntityMetadataProperties::FLAGS, EntityMetadataFlags::LINGER);
}
/**
@ -160,7 +162,7 @@ class SplashPotion extends Throwable{
* @param bool $value
*/
public function setLinger(bool $value = true) : void{
$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_LINGER, $value);
$this->setDataFlag(EntityMetadataProperties::FLAGS, EntityMetadataFlags::LINGER, $value);
}
/**