Typehints on missed sound and particle APIs

This commit is contained in:
Dylan K. Taylor
2018-05-02 11:44:18 +01:00
parent b4068dfd2f
commit d80c471ae1
23 changed files with 38 additions and 35 deletions

View File

@ -27,7 +27,7 @@ use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
class AnvilBreakSound extends GenericSound{
public function __construct(Vector3 $pos, $pitch = 0){
public function __construct(Vector3 $pos, float $pitch = 0){
parent::__construct($pos, LevelEventPacket::EVENT_SOUND_ANVIL_BREAK, $pitch);
}
}

View File

@ -27,7 +27,7 @@ use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
class AnvilFallSound extends GenericSound{
public function __construct(Vector3 $pos, $pitch = 0){
public function __construct(Vector3 $pos, float $pitch = 0){
parent::__construct($pos, LevelEventPacket::EVENT_SOUND_ANVIL_FALL, $pitch);
}
}

View File

@ -27,7 +27,7 @@ use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
class AnvilUseSound extends GenericSound{
public function __construct(Vector3 $pos, $pitch = 0){
public function __construct(Vector3 $pos, float $pitch = 0){
parent::__construct($pos, LevelEventPacket::EVENT_SOUND_ANVIL_USE, $pitch);
}
}

View File

@ -27,7 +27,7 @@ use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
class BlazeShootSound extends GenericSound{
public function __construct(Vector3 $pos, $pitch = 0){
public function __construct(Vector3 $pos, float $pitch = 0){
parent::__construct($pos, LevelEventPacket::EVENT_SOUND_BLAZE_SHOOT, $pitch);
}
}

View File

@ -27,7 +27,7 @@ use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
class ClickSound extends GenericSound{
public function __construct(Vector3 $pos, $pitch = 0){
public function __construct(Vector3 $pos, float $pitch = 0){
parent::__construct($pos, LevelEventPacket::EVENT_SOUND_CLICK, $pitch);
}
}

View File

@ -27,7 +27,7 @@ use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
class DoorBumpSound extends GenericSound{
public function __construct(Vector3 $pos, $pitch = 0){
public function __construct(Vector3 $pos, float $pitch = 0){
parent::__construct($pos, LevelEventPacket::EVENT_SOUND_DOOR_BUMP, $pitch);
}
}

View File

@ -27,7 +27,7 @@ use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
class DoorCrashSound extends GenericSound{
public function __construct(Vector3 $pos, $pitch = 0){
public function __construct(Vector3 $pos, float $pitch = 0){
parent::__construct($pos, LevelEventPacket::EVENT_SOUND_DOOR_CRASH, $pitch);
}
}

View File

@ -27,7 +27,7 @@ use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
class DoorSound extends GenericSound{
public function __construct(Vector3 $pos, $pitch = 0){
public function __construct(Vector3 $pos, float $pitch = 0){
parent::__construct($pos, LevelEventPacket::EVENT_SOUND_DOOR, $pitch);
}
}

View File

@ -27,7 +27,7 @@ use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
class FizzSound extends GenericSound{
public function __construct(Vector3 $pos, $pitch = 0){
public function __construct(Vector3 $pos, float $pitch = 0){
parent::__construct($pos, LevelEventPacket::EVENT_SOUND_FIZZ, $pitch);
}
}

View File

@ -28,24 +28,25 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
class GenericSound extends Sound{
public function __construct(Vector3 $pos, $id, $pitch = 0){
/** @var int */
protected $id;
/** @var float */
protected $pitch = 0;
public function __construct(Vector3 $pos, int $id, float $pitch = 0){
parent::__construct($pos->x, $pos->y, $pos->z);
$this->id = (int) $id;
$this->pitch = (float) $pitch * 1000;
$this->id = $id;
$this->pitch = $pitch * 1000;
}
protected $pitch = 0;
protected $id;
public function getPitch(){
public function getPitch() : float{
return $this->pitch / 1000;
}
public function setPitch($pitch){
$this->pitch = (float) $pitch * 1000;
public function setPitch(float $pitch) : void{
$this->pitch = $pitch * 1000;
}
public function encode(){
$pk = new LevelEventPacket;
$pk->evid = $this->id;

View File

@ -27,7 +27,7 @@ use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
class GhastShootSound extends GenericSound{
public function __construct(Vector3 $pos, $pitch = 0){
public function __construct(Vector3 $pos, float $pitch = 0){
parent::__construct($pos, LevelEventPacket::EVENT_SOUND_GHAST_SHOOT, $pitch);
}
}

View File

@ -27,7 +27,7 @@ use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
class GhastSound extends GenericSound{
public function __construct(Vector3 $pos, $pitch = 0){
public function __construct(Vector3 $pos, float $pitch = 0){
parent::__construct($pos, LevelEventPacket::EVENT_SOUND_GHAST, $pitch);
}
}

View File

@ -27,7 +27,7 @@ use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
class LaunchSound extends GenericSound{
public function __construct(Vector3 $pos, $pitch = 0){
public function __construct(Vector3 $pos, float $pitch = 0){
parent::__construct($pos, LevelEventPacket::EVENT_SOUND_SHOOT, $pitch);
}
}

View File

@ -27,7 +27,7 @@ use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
class PopSound extends GenericSound{
public function __construct(Vector3 $pos, $pitch = 0){
public function __construct(Vector3 $pos, float $pitch = 0){
parent::__construct($pos, LevelEventPacket::EVENT_SOUND_POP, $pitch);
}
}