mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
Typehints on missed sound and particle APIs
This commit is contained in:
parent
b4068dfd2f
commit
d80c471ae1
@ -26,7 +26,7 @@ namespace pocketmine\level\particle;
|
||||
use pocketmine\math\Vector3;
|
||||
|
||||
class CriticalParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos, $scale = 2){
|
||||
public function __construct(Vector3 $pos, int $scale = 2){
|
||||
parent::__construct($pos, Particle::TYPE_CRITICAL, $scale);
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\level\particle;
|
||||
use pocketmine\math\Vector3;
|
||||
|
||||
class DustParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos, $r, $g, $b, $a = 255){
|
||||
public function __construct(Vector3 $pos, int $r, int $g, int $b, int $a = 255){
|
||||
parent::__construct($pos, Particle::TYPE_DUST, (($a & 0xff) << 24) | (($r & 0xff) << 16) | (($g & 0xff) << 8) | ($b & 0xff));
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ class FloatingTextParticle extends Particle{
|
||||
return $this->invisible;
|
||||
}
|
||||
|
||||
public function setInvisible(bool $value = true){
|
||||
public function setInvisible(bool $value = true) : void{
|
||||
$this->invisible = $value;
|
||||
}
|
||||
|
||||
|
@ -27,11 +27,12 @@ use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
|
||||
class GenericParticle extends Particle{
|
||||
|
||||
/** @var int */
|
||||
protected $id;
|
||||
/** @var int */
|
||||
protected $data;
|
||||
|
||||
public function __construct(Vector3 $pos, $id, $data = 0){
|
||||
public function __construct(Vector3 $pos, int $id, int $data = 0){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z);
|
||||
$this->id = $id & 0xFFF;
|
||||
$this->data = $data;
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\level\particle;
|
||||
use pocketmine\math\Vector3;
|
||||
|
||||
class HeartParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos, $scale = 0){
|
||||
public function __construct(Vector3 $pos, int $scale = 0){
|
||||
parent::__construct($pos, Particle::TYPE_HEART, $scale);
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\level\particle;
|
||||
use pocketmine\math\Vector3;
|
||||
|
||||
class InkParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos, $scale = 0){
|
||||
public function __construct(Vector3 $pos, int $scale = 0){
|
||||
parent::__construct($pos, Particle::TYPE_INK, $scale);
|
||||
}
|
||||
}
|
||||
|
@ -27,11 +27,12 @@ use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
|
||||
class MobSpawnParticle extends Particle{
|
||||
|
||||
/** @var int */
|
||||
protected $width;
|
||||
/** @var int */
|
||||
protected $height;
|
||||
|
||||
public function __construct(Vector3 $pos, $width = 0, $height = 0){
|
||||
public function __construct(Vector3 $pos, int $width = 0, int $height = 0){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z);
|
||||
$this->width = $width;
|
||||
$this->height = $height;
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\level\particle;
|
||||
use pocketmine\math\Vector3;
|
||||
|
||||
class RedstoneParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos, $lifetime = 1){
|
||||
public function __construct(Vector3 $pos, int $lifetime = 1){
|
||||
parent::__construct($pos, Particle::TYPE_REDSTONE, $lifetime);
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\level\particle;
|
||||
use pocketmine\math\Vector3;
|
||||
|
||||
class SmokeParticle extends GenericParticle{
|
||||
public function __construct(Vector3 $pos, $scale = 0){
|
||||
parent::__construct($pos, Particle::TYPE_SMOKE, (int) $scale);
|
||||
public function __construct(Vector3 $pos, int $scale = 0){
|
||||
parent::__construct($pos, Particle::TYPE_SMOKE, $scale);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user