remove LevelEventSound, remove pitch from sounds that don't support it (most of them)

This commit is contained in:
Dylan K. Taylor
2019-08-21 17:59:00 +01:00
parent ea2c418a77
commit e9fd57275a
16 changed files with 131 additions and 102 deletions

View File

@ -23,11 +23,26 @@ declare(strict_types=1);
namespace pocketmine\world\sound;
use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
class FizzSound extends LevelEventSound{
class FizzSound implements Sound{
protected function getLevelEventId() : int{
return LevelEventPacket::EVENT_SOUND_FIZZ;
/** @var float */
private $pitch;
public function __construct(float $pitch = 0){
$this->pitch = $pitch;
}
/**
* @return float
*/
public function getPitch() : float{
return $this->pitch;
}
public function encode(?Vector3 $pos){
return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_FIZZ, (int) ($this->pitch * 1000), $pos);
}
}