diff --git a/src/world/World.php b/src/world/World.php index cc42b6593..ed1e3da1e 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -477,9 +477,6 @@ class World implements ChunkManager{ */ public function addSound(Vector3 $pos, Sound $sound, ?array $players = null) : void{ $pk = $sound->encode($pos); - if(!is_array($pk)){ - $pk = [$pk]; - } if(count($pk) > 0){ if($players === null){ foreach($pk as $e){ diff --git a/src/world/sound/AnvilBreakSound.php b/src/world/sound/AnvilBreakSound.php index 0e12bdc35..9da378b35 100644 --- a/src/world/sound/AnvilBreakSound.php +++ b/src/world/sound/AnvilBreakSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket; class AnvilBreakSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ANVIL_BREAK, 0, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ANVIL_BREAK, 0, $pos)]; } } diff --git a/src/world/sound/AnvilFallSound.php b/src/world/sound/AnvilFallSound.php index 338b5e0f9..7abf3f6ce 100644 --- a/src/world/sound/AnvilFallSound.php +++ b/src/world/sound/AnvilFallSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket; class AnvilFallSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ANVIL_FALL, 0, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ANVIL_FALL, 0, $pos)]; } } diff --git a/src/world/sound/AnvilUseSound.php b/src/world/sound/AnvilUseSound.php index cb9c9841d..93c0b64ee 100644 --- a/src/world/sound/AnvilUseSound.php +++ b/src/world/sound/AnvilUseSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket; class AnvilUseSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ANVIL_USE, 0, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ANVIL_USE, 0, $pos)]; } } diff --git a/src/world/sound/ArrowHitSound.php b/src/world/sound/ArrowHitSound.php index 84899ab59..1927b0c2c 100644 --- a/src/world/sound/ArrowHitSound.php +++ b/src/world/sound/ArrowHitSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; class ArrowHitSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BOW_HIT, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BOW_HIT, $pos)]; } } diff --git a/src/world/sound/BlazeShootSound.php b/src/world/sound/BlazeShootSound.php index ed9335e3b..3924784d0 100644 --- a/src/world/sound/BlazeShootSound.php +++ b/src/world/sound/BlazeShootSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket; class BlazeShootSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_BLAZE_SHOOT, 0, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_BLAZE_SHOOT, 0, $pos)]; } } diff --git a/src/world/sound/BlockBreakSound.php b/src/world/sound/BlockBreakSound.php index 81809e126..b5c9a11b9 100644 --- a/src/world/sound/BlockBreakSound.php +++ b/src/world/sound/BlockBreakSound.php @@ -37,7 +37,7 @@ class BlockBreakSound implements Sound{ $this->block = $block; } - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BREAK, $pos, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId())); + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BREAK, $pos, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()))]; } } diff --git a/src/world/sound/BlockPlaceSound.php b/src/world/sound/BlockPlaceSound.php index 9441e5bc9..8635588b4 100644 --- a/src/world/sound/BlockPlaceSound.php +++ b/src/world/sound/BlockPlaceSound.php @@ -37,7 +37,7 @@ class BlockPlaceSound implements Sound{ $this->block = $block; } - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_PLACE, $pos, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId())); + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_PLACE, $pos, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()))]; } } diff --git a/src/world/sound/BlockPunchSound.php b/src/world/sound/BlockPunchSound.php index 33a15cce5..0637c4133 100644 --- a/src/world/sound/BlockPunchSound.php +++ b/src/world/sound/BlockPunchSound.php @@ -40,11 +40,11 @@ class BlockPunchSound implements Sound{ $this->block = $block; } - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create( + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create( LevelSoundEventPacket::SOUND_HIT, $pos, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()) - ); + )]; } } diff --git a/src/world/sound/BowShootSound.php b/src/world/sound/BowShootSound.php index ddbc310e9..09f644bfb 100644 --- a/src/world/sound/BowShootSound.php +++ b/src/world/sound/BowShootSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; class BowShootSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BOW, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BOW, $pos)]; } } diff --git a/src/world/sound/BucketEmptyLavaSound.php b/src/world/sound/BucketEmptyLavaSound.php index da9f4a703..2764cc823 100644 --- a/src/world/sound/BucketEmptyLavaSound.php +++ b/src/world/sound/BucketEmptyLavaSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; class BucketEmptyLavaSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_EMPTY_LAVA, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_EMPTY_LAVA, $pos)]; } } diff --git a/src/world/sound/BucketEmptyWaterSound.php b/src/world/sound/BucketEmptyWaterSound.php index 6c50d9ef7..b3b847721 100644 --- a/src/world/sound/BucketEmptyWaterSound.php +++ b/src/world/sound/BucketEmptyWaterSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; class BucketEmptyWaterSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_EMPTY_WATER, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_EMPTY_WATER, $pos)]; } } diff --git a/src/world/sound/BucketFillLavaSound.php b/src/world/sound/BucketFillLavaSound.php index a20601ef7..c8dbba300 100644 --- a/src/world/sound/BucketFillLavaSound.php +++ b/src/world/sound/BucketFillLavaSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; class BucketFillLavaSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_FILL_LAVA, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_FILL_LAVA, $pos)]; } } diff --git a/src/world/sound/BucketFillWaterSound.php b/src/world/sound/BucketFillWaterSound.php index 29e05e697..0661a5da0 100644 --- a/src/world/sound/BucketFillWaterSound.php +++ b/src/world/sound/BucketFillWaterSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; class BucketFillWaterSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_FILL_WATER, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_FILL_WATER, $pos)]; } } diff --git a/src/world/sound/ChestCloseSound.php b/src/world/sound/ChestCloseSound.php index e3476e47d..744305b1b 100644 --- a/src/world/sound/ChestCloseSound.php +++ b/src/world/sound/ChestCloseSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; class ChestCloseSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_CHEST_CLOSED, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_CHEST_CLOSED, $pos)]; } } diff --git a/src/world/sound/ChestOpenSound.php b/src/world/sound/ChestOpenSound.php index 2668b8e8d..86a7ea8fc 100644 --- a/src/world/sound/ChestOpenSound.php +++ b/src/world/sound/ChestOpenSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; class ChestOpenSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_CHEST_OPEN, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_CHEST_OPEN, $pos)]; } } diff --git a/src/world/sound/ClickSound.php b/src/world/sound/ClickSound.php index 67d904784..dad9e325a 100644 --- a/src/world/sound/ClickSound.php +++ b/src/world/sound/ClickSound.php @@ -39,7 +39,7 @@ class ClickSound implements Sound{ return $this->pitch; } - public function encode(?Vector3 $pos){ - return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_CLICK, (int) ($this->pitch * 1000), $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_CLICK, (int) ($this->pitch * 1000), $pos)]; } } diff --git a/src/world/sound/DoorBumpSound.php b/src/world/sound/DoorBumpSound.php index 3d03176f2..2d13b0ad8 100644 --- a/src/world/sound/DoorBumpSound.php +++ b/src/world/sound/DoorBumpSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket; class DoorBumpSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_DOOR_BUMP, 0, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_DOOR_BUMP, 0, $pos)]; } } diff --git a/src/world/sound/DoorCrashSound.php b/src/world/sound/DoorCrashSound.php index 833d4e9e3..fa9524a74 100644 --- a/src/world/sound/DoorCrashSound.php +++ b/src/world/sound/DoorCrashSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket; class DoorCrashSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_DOOR_CRASH, 0, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_DOOR_CRASH, 0, $pos)]; } } diff --git a/src/world/sound/DoorSound.php b/src/world/sound/DoorSound.php index 57f2ba6f9..9eca4181d 100644 --- a/src/world/sound/DoorSound.php +++ b/src/world/sound/DoorSound.php @@ -39,7 +39,7 @@ class DoorSound implements Sound{ return $this->pitch; } - public function encode(?Vector3 $pos){ - return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_DOOR, (int) ($this->pitch * 1000), $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_DOOR, (int) ($this->pitch * 1000), $pos)]; } } diff --git a/src/world/sound/EnderChestCloseSound.php b/src/world/sound/EnderChestCloseSound.php index 021d6c357..07073b523 100644 --- a/src/world/sound/EnderChestCloseSound.php +++ b/src/world/sound/EnderChestCloseSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; class EnderChestCloseSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_ENDERCHEST_CLOSED, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_ENDERCHEST_CLOSED, $pos)]; } } diff --git a/src/world/sound/EnderChestOpenSound.php b/src/world/sound/EnderChestOpenSound.php index 13788a6e8..17e6fef9b 100644 --- a/src/world/sound/EnderChestOpenSound.php +++ b/src/world/sound/EnderChestOpenSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; class EnderChestOpenSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_ENDERCHEST_OPEN, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_ENDERCHEST_OPEN, $pos)]; } } diff --git a/src/world/sound/EndermanTeleportSound.php b/src/world/sound/EndermanTeleportSound.php index 5f6b2372d..544ffcd21 100644 --- a/src/world/sound/EndermanTeleportSound.php +++ b/src/world/sound/EndermanTeleportSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket; class EndermanTeleportSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ENDERMAN_TELEPORT, 0, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ENDERMAN_TELEPORT, 0, $pos)]; } } diff --git a/src/world/sound/EntityAttackNoDamageSound.php b/src/world/sound/EntityAttackNoDamageSound.php index 5684adf6b..edd39483c 100644 --- a/src/world/sound/EntityAttackNoDamageSound.php +++ b/src/world/sound/EntityAttackNoDamageSound.php @@ -31,12 +31,12 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; */ class EntityAttackNoDamageSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create( + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create( LevelSoundEventPacket::SOUND_ATTACK_NODAMAGE, $pos, -1, "minecraft:player" - ); + )]; } } diff --git a/src/world/sound/EntityAttackSound.php b/src/world/sound/EntityAttackSound.php index 102e458d6..04b461f49 100644 --- a/src/world/sound/EntityAttackSound.php +++ b/src/world/sound/EntityAttackSound.php @@ -31,12 +31,12 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; */ class EntityAttackSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create( + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create( LevelSoundEventPacket::SOUND_ATTACK_STRONG, //TODO: seems like ATTACK is dysfunctional $pos, -1, "minecraft:player" - ); + )]; } } diff --git a/src/world/sound/EntityLandSound.php b/src/world/sound/EntityLandSound.php index 47e9736ab..983c0d2e6 100644 --- a/src/world/sound/EntityLandSound.php +++ b/src/world/sound/EntityLandSound.php @@ -44,13 +44,13 @@ class EntityLandSound implements Sound{ $this->blockLandedOn = $blockLandedOn; } - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create( + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create( LevelSoundEventPacket::SOUND_LAND, $pos, RuntimeBlockMapping::getInstance()->toRuntimeId($this->blockLandedOn->getFullId()), $this->entity::getNetworkTypeId() //TODO: does isBaby have any relevance here? - ); + )]; } } diff --git a/src/world/sound/EntityLongFallSound.php b/src/world/sound/EntityLongFallSound.php index 93378e218..2e95b9e8c 100644 --- a/src/world/sound/EntityLongFallSound.php +++ b/src/world/sound/EntityLongFallSound.php @@ -40,13 +40,13 @@ class EntityLongFallSound implements Sound{ $this->entity = $entity; } - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create( + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create( LevelSoundEventPacket::SOUND_FALL_BIG, $pos, -1, $this->entity::getNetworkTypeId() //TODO: is isBaby relevant here? - ); + )]; } } diff --git a/src/world/sound/EntityShortFallSound.php b/src/world/sound/EntityShortFallSound.php index d1f096ce2..de16c58b0 100644 --- a/src/world/sound/EntityShortFallSound.php +++ b/src/world/sound/EntityShortFallSound.php @@ -39,13 +39,13 @@ class EntityShortFallSound implements Sound{ $this->entity = $entity; } - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create( + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create( LevelSoundEventPacket::SOUND_FALL_SMALL, $pos, -1, $this->entity::getNetworkTypeId() //TODO: does isBaby have any relevance here? - ); + )]; } } diff --git a/src/world/sound/ExplodeSound.php b/src/world/sound/ExplodeSound.php index 7e9ee4715..86ed9b342 100644 --- a/src/world/sound/ExplodeSound.php +++ b/src/world/sound/ExplodeSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; class ExplodeSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_EXPLODE, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_EXPLODE, $pos)]; } } diff --git a/src/world/sound/FizzSound.php b/src/world/sound/FizzSound.php index 1f10bd22a..0e7b42ffb 100644 --- a/src/world/sound/FizzSound.php +++ b/src/world/sound/FizzSound.php @@ -39,7 +39,7 @@ class FizzSound implements Sound{ return $this->pitch; } - public function encode(?Vector3 $pos){ - return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_FIZZ, (int) ($this->pitch * 1000), $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_FIZZ, (int) ($this->pitch * 1000), $pos)]; } } diff --git a/src/world/sound/FlintSteelSound.php b/src/world/sound/FlintSteelSound.php index eb4fe3e93..185216959 100644 --- a/src/world/sound/FlintSteelSound.php +++ b/src/world/sound/FlintSteelSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; class FlintSteelSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_IGNITE, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_IGNITE, $pos)]; } } diff --git a/src/world/sound/GhastShootSound.php b/src/world/sound/GhastShootSound.php index 0029553ef..40f6a47cc 100644 --- a/src/world/sound/GhastShootSound.php +++ b/src/world/sound/GhastShootSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket; class GhastShootSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_GHAST_SHOOT, 0, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_GHAST_SHOOT, 0, $pos)]; } } diff --git a/src/world/sound/GhastSound.php b/src/world/sound/GhastSound.php index 484080397..b49a9c374 100644 --- a/src/world/sound/GhastSound.php +++ b/src/world/sound/GhastSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket; class GhastSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_GHAST, 0, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_GHAST, 0, $pos)]; } } diff --git a/src/world/sound/IgniteSound.php b/src/world/sound/IgniteSound.php index 4066ef189..dd72342da 100644 --- a/src/world/sound/IgniteSound.php +++ b/src/world/sound/IgniteSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket; class IgniteSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_IGNITE, 0, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_IGNITE, 0, $pos)]; } } diff --git a/src/world/sound/ItemBreakSound.php b/src/world/sound/ItemBreakSound.php index 7dd7de43b..fbe9aef77 100644 --- a/src/world/sound/ItemBreakSound.php +++ b/src/world/sound/ItemBreakSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; class ItemBreakSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BREAK, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BREAK, $pos)]; } } diff --git a/src/world/sound/LaunchSound.php b/src/world/sound/LaunchSound.php index e84a4a1de..e6772f1c9 100644 --- a/src/world/sound/LaunchSound.php +++ b/src/world/sound/LaunchSound.php @@ -39,7 +39,7 @@ class LaunchSound implements Sound{ return $this->pitch; } - public function encode(?Vector3 $pos){ - return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_SHOOT, (int) ($this->pitch * 1000), $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_SHOOT, (int) ($this->pitch * 1000), $pos)]; } } diff --git a/src/world/sound/NoteSound.php b/src/world/sound/NoteSound.php index d81db980d..70228021e 100644 --- a/src/world/sound/NoteSound.php +++ b/src/world/sound/NoteSound.php @@ -41,7 +41,7 @@ class NoteSound implements Sound{ $this->note = $note; } - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_NOTE, $pos, ($this->instrument->getMagicNumber() << 8) | $this->note); + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_NOTE, $pos, ($this->instrument->getMagicNumber() << 8) | $this->note)]; } } diff --git a/src/world/sound/PaintingPlaceSound.php b/src/world/sound/PaintingPlaceSound.php index cf64b248b..c836e0842 100644 --- a/src/world/sound/PaintingPlaceSound.php +++ b/src/world/sound/PaintingPlaceSound.php @@ -28,8 +28,8 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket; class PaintingPlaceSound implements Sound{ - public function encode(?Vector3 $pos){ + public function encode(?Vector3 $pos) : array{ //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)]; } } diff --git a/src/world/sound/PopSound.php b/src/world/sound/PopSound.php index 6bec571a9..5bce1145f 100644 --- a/src/world/sound/PopSound.php +++ b/src/world/sound/PopSound.php @@ -39,7 +39,7 @@ class PopSound implements Sound{ return $this->pitch; } - public function encode(?Vector3 $pos){ - return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_POP, (int) ($this->pitch * 1000), $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_POP, (int) ($this->pitch * 1000), $pos)]; } } diff --git a/src/world/sound/PotionSplashSound.php b/src/world/sound/PotionSplashSound.php index 97c1dab08..96a2f6ead 100644 --- a/src/world/sound/PotionSplashSound.php +++ b/src/world/sound/PotionSplashSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; class PotionSplashSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_GLASS, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_GLASS, $pos)]; } } diff --git a/src/world/sound/RecordSound.php b/src/world/sound/RecordSound.php index 1ec5c23ca..9f8bb15d1 100644 --- a/src/world/sound/RecordSound.php +++ b/src/world/sound/RecordSound.php @@ -36,7 +36,7 @@ class RecordSound implements Sound{ $this->recordType = $recordType; } - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create($this->recordType->getSoundId(), $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create($this->recordType->getSoundId(), $pos)]; } } diff --git a/src/world/sound/RecordStopSound.php b/src/world/sound/RecordStopSound.php index b5f87f87f..ccb139f82 100644 --- a/src/world/sound/RecordStopSound.php +++ b/src/world/sound/RecordStopSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; class RecordStopSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_STOP_RECORD, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_STOP_RECORD, $pos)]; } } diff --git a/src/world/sound/RedstonePowerOffSound.php b/src/world/sound/RedstonePowerOffSound.php index f8ea474f3..d1363ed54 100644 --- a/src/world/sound/RedstonePowerOffSound.php +++ b/src/world/sound/RedstonePowerOffSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; class RedstonePowerOffSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_POWER_OFF, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_POWER_OFF, $pos)]; } } diff --git a/src/world/sound/RedstonePowerOnSound.php b/src/world/sound/RedstonePowerOnSound.php index c01ee10b4..eaea5f617 100644 --- a/src/world/sound/RedstonePowerOnSound.php +++ b/src/world/sound/RedstonePowerOnSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; class RedstonePowerOnSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_POWER_ON, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_POWER_ON, $pos)]; } } diff --git a/src/world/sound/Sound.php b/src/world/sound/Sound.php index e44c0ecce..84121db6a 100644 --- a/src/world/sound/Sound.php +++ b/src/world/sound/Sound.php @@ -29,7 +29,7 @@ use pocketmine\network\mcpe\protocol\ClientboundPacket; interface Sound{ /** - * @return ClientboundPacket|ClientboundPacket[] + * @return ClientboundPacket[] */ - public function encode(?Vector3 $pos); + public function encode(?Vector3 $pos) : array; } diff --git a/src/world/sound/ThrowSound.php b/src/world/sound/ThrowSound.php index feb0ca724..65c5079af 100644 --- a/src/world/sound/ThrowSound.php +++ b/src/world/sound/ThrowSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket; class ThrowSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_THROW, $pos, -1, "minecraft:player"); + public function encode(?Vector3 $pos) : array{ + return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_THROW, $pos, -1, "minecraft:player")]; } } diff --git a/src/world/sound/TotemUseSound.php b/src/world/sound/TotemUseSound.php index 064008942..baa04275c 100644 --- a/src/world/sound/TotemUseSound.php +++ b/src/world/sound/TotemUseSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket; class TotemUseSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_TOTEM, 0, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_TOTEM, 0, $pos)]; } } diff --git a/src/world/sound/XpCollectSound.php b/src/world/sound/XpCollectSound.php index f87c2719f..71a304f30 100644 --- a/src/world/sound/XpCollectSound.php +++ b/src/world/sound/XpCollectSound.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket; class XpCollectSound implements Sound{ - public function encode(?Vector3 $pos){ - return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ORB, 0, $pos); + public function encode(?Vector3 $pos) : array{ + return [LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ORB, 0, $pos)]; } } diff --git a/src/world/sound/XpLevelUpSound.php b/src/world/sound/XpLevelUpSound.php index 837067446..abc41fef7 100644 --- a/src/world/sound/XpLevelUpSound.php +++ b/src/world/sound/XpLevelUpSound.php @@ -41,9 +41,9 @@ class XpLevelUpSound implements Sound{ return $this->xpLevel; } - public function encode(?Vector3 $pos){ + public function encode(?Vector3 $pos) : array{ //No idea why such odd numbers, but this works... //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))]; } }