mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-12 08:49:42 +00:00
Sound::encode() now always returns an array
This commit is contained in:
parent
0cbc5c9a4a
commit
5a320f22b7
@ -477,9 +477,6 @@ class World implements ChunkManager{
|
|||||||
*/
|
*/
|
||||||
public function addSound(Vector3 $pos, Sound $sound, ?array $players = null) : void{
|
public function addSound(Vector3 $pos, Sound $sound, ?array $players = null) : void{
|
||||||
$pk = $sound->encode($pos);
|
$pk = $sound->encode($pos);
|
||||||
if(!is_array($pk)){
|
|
||||||
$pk = [$pk];
|
|
||||||
}
|
|
||||||
if(count($pk) > 0){
|
if(count($pk) > 0){
|
||||||
if($players === null){
|
if($players === null){
|
||||||
foreach($pk as $e){
|
foreach($pk as $e){
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
|||||||
|
|
||||||
class AnvilBreakSound implements Sound{
|
class AnvilBreakSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ANVIL_BREAK, 0, $pos);
|
return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ANVIL_BREAK, 0, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
|||||||
|
|
||||||
class AnvilFallSound implements Sound{
|
class AnvilFallSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ANVIL_FALL, 0, $pos);
|
return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ANVIL_FALL, 0, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
|||||||
|
|
||||||
class AnvilUseSound implements Sound{
|
class AnvilUseSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ANVIL_USE, 0, $pos);
|
return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ANVIL_USE, 0, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class ArrowHitSound implements Sound{
|
class ArrowHitSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BOW_HIT, $pos);
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BOW_HIT, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
|||||||
|
|
||||||
class BlazeShootSound implements Sound{
|
class BlazeShootSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_BLAZE_SHOOT, 0, $pos);
|
return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_BLAZE_SHOOT, 0, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ class BlockBreakSound implements Sound{
|
|||||||
$this->block = $block;
|
$this->block = $block;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BREAK, $pos, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()));
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BREAK, $pos, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()))];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ class BlockPlaceSound implements Sound{
|
|||||||
$this->block = $block;
|
$this->block = $block;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_PLACE, $pos, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()));
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_PLACE, $pos, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()))];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,11 +40,11 @@ class BlockPunchSound implements Sound{
|
|||||||
$this->block = $block;
|
$this->block = $block;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(
|
return [LevelSoundEventPacket::create(
|
||||||
LevelSoundEventPacket::SOUND_HIT,
|
LevelSoundEventPacket::SOUND_HIT,
|
||||||
$pos,
|
$pos,
|
||||||
RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId())
|
RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId())
|
||||||
);
|
)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class BowShootSound implements Sound{
|
class BowShootSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BOW, $pos);
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BOW, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class BucketEmptyLavaSound implements Sound{
|
class BucketEmptyLavaSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_EMPTY_LAVA, $pos);
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_EMPTY_LAVA, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class BucketEmptyWaterSound implements Sound{
|
class BucketEmptyWaterSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_EMPTY_WATER, $pos);
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_EMPTY_WATER, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class BucketFillLavaSound implements Sound{
|
class BucketFillLavaSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_FILL_LAVA, $pos);
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_FILL_LAVA, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class BucketFillWaterSound implements Sound{
|
class BucketFillWaterSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_FILL_WATER, $pos);
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_FILL_WATER, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class ChestCloseSound implements Sound{
|
class ChestCloseSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_CHEST_CLOSED, $pos);
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_CHEST_CLOSED, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class ChestOpenSound implements Sound{
|
class ChestOpenSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_CHEST_OPEN, $pos);
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_CHEST_OPEN, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ class ClickSound implements Sound{
|
|||||||
return $this->pitch;
|
return $this->pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_CLICK, (int) ($this->pitch * 1000), $pos);
|
return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_CLICK, (int) ($this->pitch * 1000), $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
|||||||
|
|
||||||
class DoorBumpSound implements Sound{
|
class DoorBumpSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_DOOR_BUMP, 0, $pos);
|
return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_DOOR_BUMP, 0, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
|||||||
|
|
||||||
class DoorCrashSound implements Sound{
|
class DoorCrashSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_DOOR_CRASH, 0, $pos);
|
return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_DOOR_CRASH, 0, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ class DoorSound implements Sound{
|
|||||||
return $this->pitch;
|
return $this->pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_DOOR, (int) ($this->pitch * 1000), $pos);
|
return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_DOOR, (int) ($this->pitch * 1000), $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class EnderChestCloseSound implements Sound{
|
class EnderChestCloseSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_ENDERCHEST_CLOSED, $pos);
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_ENDERCHEST_CLOSED, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class EnderChestOpenSound implements Sound{
|
class EnderChestOpenSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_ENDERCHEST_OPEN, $pos);
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_ENDERCHEST_OPEN, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
|||||||
|
|
||||||
class EndermanTeleportSound implements Sound{
|
class EndermanTeleportSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ENDERMAN_TELEPORT, 0, $pos);
|
return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ENDERMAN_TELEPORT, 0, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,12 +31,12 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
*/
|
*/
|
||||||
class EntityAttackNoDamageSound implements Sound{
|
class EntityAttackNoDamageSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(
|
return [LevelSoundEventPacket::create(
|
||||||
LevelSoundEventPacket::SOUND_ATTACK_NODAMAGE,
|
LevelSoundEventPacket::SOUND_ATTACK_NODAMAGE,
|
||||||
$pos,
|
$pos,
|
||||||
-1,
|
-1,
|
||||||
"minecraft:player"
|
"minecraft:player"
|
||||||
);
|
)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,12 +31,12 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
*/
|
*/
|
||||||
class EntityAttackSound implements Sound{
|
class EntityAttackSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(
|
return [LevelSoundEventPacket::create(
|
||||||
LevelSoundEventPacket::SOUND_ATTACK_STRONG, //TODO: seems like ATTACK is dysfunctional
|
LevelSoundEventPacket::SOUND_ATTACK_STRONG, //TODO: seems like ATTACK is dysfunctional
|
||||||
$pos,
|
$pos,
|
||||||
-1,
|
-1,
|
||||||
"minecraft:player"
|
"minecraft:player"
|
||||||
);
|
)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,13 +44,13 @@ class EntityLandSound implements Sound{
|
|||||||
$this->blockLandedOn = $blockLandedOn;
|
$this->blockLandedOn = $blockLandedOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(
|
return [LevelSoundEventPacket::create(
|
||||||
LevelSoundEventPacket::SOUND_LAND,
|
LevelSoundEventPacket::SOUND_LAND,
|
||||||
$pos,
|
$pos,
|
||||||
RuntimeBlockMapping::getInstance()->toRuntimeId($this->blockLandedOn->getFullId()),
|
RuntimeBlockMapping::getInstance()->toRuntimeId($this->blockLandedOn->getFullId()),
|
||||||
$this->entity::getNetworkTypeId()
|
$this->entity::getNetworkTypeId()
|
||||||
//TODO: does isBaby have any relevance here?
|
//TODO: does isBaby have any relevance here?
|
||||||
);
|
)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,13 +40,13 @@ class EntityLongFallSound implements Sound{
|
|||||||
$this->entity = $entity;
|
$this->entity = $entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(
|
return [LevelSoundEventPacket::create(
|
||||||
LevelSoundEventPacket::SOUND_FALL_BIG,
|
LevelSoundEventPacket::SOUND_FALL_BIG,
|
||||||
$pos,
|
$pos,
|
||||||
-1,
|
-1,
|
||||||
$this->entity::getNetworkTypeId()
|
$this->entity::getNetworkTypeId()
|
||||||
//TODO: is isBaby relevant here?
|
//TODO: is isBaby relevant here?
|
||||||
);
|
)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,13 +39,13 @@ class EntityShortFallSound implements Sound{
|
|||||||
$this->entity = $entity;
|
$this->entity = $entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(
|
return [LevelSoundEventPacket::create(
|
||||||
LevelSoundEventPacket::SOUND_FALL_SMALL,
|
LevelSoundEventPacket::SOUND_FALL_SMALL,
|
||||||
$pos,
|
$pos,
|
||||||
-1,
|
-1,
|
||||||
$this->entity::getNetworkTypeId()
|
$this->entity::getNetworkTypeId()
|
||||||
//TODO: does isBaby have any relevance here?
|
//TODO: does isBaby have any relevance here?
|
||||||
);
|
)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class ExplodeSound implements Sound{
|
class ExplodeSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_EXPLODE, $pos);
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_EXPLODE, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ class FizzSound implements Sound{
|
|||||||
return $this->pitch;
|
return $this->pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_FIZZ, (int) ($this->pitch * 1000), $pos);
|
return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_FIZZ, (int) ($this->pitch * 1000), $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class FlintSteelSound implements Sound{
|
class FlintSteelSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_IGNITE, $pos);
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_IGNITE, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
|||||||
|
|
||||||
class GhastShootSound implements Sound{
|
class GhastShootSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_GHAST_SHOOT, 0, $pos);
|
return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_GHAST_SHOOT, 0, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
|||||||
|
|
||||||
class GhastSound implements Sound{
|
class GhastSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_GHAST, 0, $pos);
|
return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_GHAST, 0, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
|||||||
|
|
||||||
class IgniteSound implements Sound{
|
class IgniteSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_IGNITE, 0, $pos);
|
return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_IGNITE, 0, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class ItemBreakSound implements Sound{
|
class ItemBreakSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BREAK, $pos);
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BREAK, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ class LaunchSound implements Sound{
|
|||||||
return $this->pitch;
|
return $this->pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_SHOOT, (int) ($this->pitch * 1000), $pos);
|
return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_SHOOT, (int) ($this->pitch * 1000), $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ class NoteSound implements Sound{
|
|||||||
$this->note = $note;
|
$this->note = $note;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_NOTE, $pos, ($this->instrument->getMagicNumber() << 8) | $this->note);
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_NOTE, $pos, ($this->instrument->getMagicNumber() << 8) | $this->note)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,8 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
|||||||
|
|
||||||
class PaintingPlaceSound implements Sound{
|
class PaintingPlaceSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
//item frame and painting have the same sound
|
//item frame and painting have the same sound
|
||||||
return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ITEMFRAME_PLACE, 0, $pos);
|
return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ITEMFRAME_PLACE, 0, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ class PopSound implements Sound{
|
|||||||
return $this->pitch;
|
return $this->pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_POP, (int) ($this->pitch * 1000), $pos);
|
return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_POP, (int) ($this->pitch * 1000), $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class PotionSplashSound implements Sound{
|
class PotionSplashSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_GLASS, $pos);
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_GLASS, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ class RecordSound implements Sound{
|
|||||||
$this->recordType = $recordType;
|
$this->recordType = $recordType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create($this->recordType->getSoundId(), $pos);
|
return [LevelSoundEventPacket::create($this->recordType->getSoundId(), $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class RecordStopSound implements Sound{
|
class RecordStopSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_STOP_RECORD, $pos);
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_STOP_RECORD, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class RedstonePowerOffSound implements Sound{
|
class RedstonePowerOffSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_POWER_OFF, $pos);
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_POWER_OFF, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class RedstonePowerOnSound implements Sound{
|
class RedstonePowerOnSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_POWER_ON, $pos);
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_POWER_ON, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ use pocketmine\network\mcpe\protocol\ClientboundPacket;
|
|||||||
interface Sound{
|
interface Sound{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ClientboundPacket|ClientboundPacket[]
|
* @return ClientboundPacket[]
|
||||||
*/
|
*/
|
||||||
public function encode(?Vector3 $pos);
|
public function encode(?Vector3 $pos) : array;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class ThrowSound implements Sound{
|
class ThrowSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_THROW, $pos, -1, "minecraft:player");
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_THROW, $pos, -1, "minecraft:player")];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
|||||||
|
|
||||||
class TotemUseSound implements Sound{
|
class TotemUseSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_TOTEM, 0, $pos);
|
return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_TOTEM, 0, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
|||||||
|
|
||||||
class XpCollectSound implements Sound{
|
class XpCollectSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ORB, 0, $pos);
|
return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ORB, 0, $pos)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,9 +41,9 @@ class XpLevelUpSound implements Sound{
|
|||||||
return $this->xpLevel;
|
return $this->xpLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos){
|
public function encode(?Vector3 $pos) : array{
|
||||||
//No idea why such odd numbers, but this works...
|
//No idea why such odd numbers, but this works...
|
||||||
//TODO: check arbitrary volume
|
//TODO: check arbitrary volume
|
||||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_LEVELUP, $pos, 0x10000000 * intdiv(min(30, $this->xpLevel), 5));
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_LEVELUP, $pos, 0x10000000 * intdiv(min(30, $this->xpLevel), 5))];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user