mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 22:45:28 +00:00
Sound::encode() position is no longer nullable
making this nullable was based on the invalid assumption that global sounds have no position, but it turns out they _do_ still use the position to make the sound come from the correct direction.
This commit is contained in:
parent
e50072dc27
commit
701a71a4ee
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
|||||||
|
|
||||||
class AnvilBreakSound implements Sound{
|
class AnvilBreakSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
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) : array{
|
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) : array{
|
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) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BOW_HIT, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BOW_HIT, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class BarrelCloseSound implements Sound{
|
class BarrelCloseSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BLOCK_BARREL_CLOSE, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BLOCK_BARREL_CLOSE, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class BarrelOpenSound implements Sound{
|
class BarrelOpenSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BLOCK_BARREL_OPEN, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BLOCK_BARREL_OPEN, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
final class BellRingSound implements Sound{
|
final class BellRingSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BLOCK_BELL_HIT, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BLOCK_BELL_HIT, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
|||||||
|
|
||||||
class BlazeShootSound implements Sound{
|
class BlazeShootSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
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) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BREAK, $pos, false, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()))];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BREAK, $pos, false, 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) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_PLACE, $pos, false, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()))];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_PLACE, $pos, false, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()))];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ class BlockPunchSound implements Sound{
|
|||||||
$this->block = $block;
|
$this->block = $block;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(
|
return [LevelSoundEventPacket::nonActorSound(
|
||||||
LevelSoundEventPacket::SOUND_HIT,
|
LevelSoundEventPacket::SOUND_HIT,
|
||||||
$pos,
|
$pos,
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class BowShootSound implements Sound{
|
class BowShootSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BOW, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BOW, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class BucketEmptyLavaSound implements Sound{
|
class BucketEmptyLavaSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BUCKET_EMPTY_LAVA, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BUCKET_EMPTY_LAVA, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class BucketEmptyWaterSound implements Sound{
|
class BucketEmptyWaterSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BUCKET_EMPTY_WATER, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BUCKET_EMPTY_WATER, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class BucketFillLavaSound implements Sound{
|
class BucketFillLavaSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BUCKET_FILL_LAVA, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BUCKET_FILL_LAVA, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class BucketFillWaterSound implements Sound{
|
class BucketFillWaterSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BUCKET_FILL_WATER, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BUCKET_FILL_WATER, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class ChestCloseSound implements Sound{
|
class ChestCloseSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_CHEST_CLOSED, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_CHEST_CLOSED, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class ChestOpenSound implements Sound{
|
class ChestOpenSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_CHEST_OPEN, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_CHEST_OPEN, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ class ClickSound implements Sound{
|
|||||||
return $this->pitch;
|
return $this->pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
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) : array{
|
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) : array{
|
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) : array{
|
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) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_ENDERCHEST_CLOSED, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_ENDERCHEST_CLOSED, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class EnderChestOpenSound implements Sound{
|
class EnderChestOpenSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_ENDERCHEST_OPEN, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_ENDERCHEST_OPEN, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
|||||||
|
|
||||||
class EndermanTeleportSound implements Sound{
|
class EndermanTeleportSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
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,7 +31,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
*/
|
*/
|
||||||
class EntityAttackNoDamageSound implements Sound{
|
class EntityAttackNoDamageSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::create(
|
return [LevelSoundEventPacket::create(
|
||||||
LevelSoundEventPacket::SOUND_ATTACK_NODAMAGE,
|
LevelSoundEventPacket::SOUND_ATTACK_NODAMAGE,
|
||||||
$pos,
|
$pos,
|
||||||
|
@ -31,7 +31,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
*/
|
*/
|
||||||
class EntityAttackSound implements Sound{
|
class EntityAttackSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
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,
|
||||||
|
@ -44,7 +44,7 @@ class EntityLandSound implements Sound{
|
|||||||
$this->blockLandedOn = $blockLandedOn;
|
$this->blockLandedOn = $blockLandedOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::create(
|
return [LevelSoundEventPacket::create(
|
||||||
LevelSoundEventPacket::SOUND_LAND,
|
LevelSoundEventPacket::SOUND_LAND,
|
||||||
$pos,
|
$pos,
|
||||||
|
@ -40,7 +40,7 @@ class EntityLongFallSound implements Sound{
|
|||||||
$this->entity = $entity;
|
$this->entity = $entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::create(
|
return [LevelSoundEventPacket::create(
|
||||||
LevelSoundEventPacket::SOUND_FALL_BIG,
|
LevelSoundEventPacket::SOUND_FALL_BIG,
|
||||||
$pos,
|
$pos,
|
||||||
|
@ -39,7 +39,7 @@ class EntityShortFallSound implements Sound{
|
|||||||
$this->entity = $entity;
|
$this->entity = $entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::create(
|
return [LevelSoundEventPacket::create(
|
||||||
LevelSoundEventPacket::SOUND_FALL_SMALL,
|
LevelSoundEventPacket::SOUND_FALL_SMALL,
|
||||||
$pos,
|
$pos,
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class ExplodeSound implements Sound{
|
class ExplodeSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_EXPLODE, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_EXPLODE, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
final class FireExtinguishSound implements Sound{
|
final class FireExtinguishSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_EXTINGUISH_FIRE, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_EXTINGUISH_FIRE, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ class FizzSound implements Sound{
|
|||||||
return $this->pitch;
|
return $this->pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
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) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_IGNITE, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_IGNITE, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
|||||||
|
|
||||||
class GhastShootSound implements Sound{
|
class GhastShootSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
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) : array{
|
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) : array{
|
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) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BREAK, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_BREAK, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ class LaunchSound implements Sound{
|
|||||||
return $this->pitch;
|
return $this->pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
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) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_NOTE, $pos, false, ($this->instrument->getMagicNumber() << 8) | $this->note)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_NOTE, $pos, false, ($this->instrument->getMagicNumber() << 8) | $this->note)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
|||||||
|
|
||||||
class PaintingPlaceSound implements Sound{
|
class PaintingPlaceSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
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) : array{
|
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) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_GLASS, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_GLASS, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ class RecordSound implements Sound{
|
|||||||
$this->recordType = $recordType;
|
$this->recordType = $recordType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound($this->recordType->getSoundId(), $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound($this->recordType->getSoundId(), $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class RecordStopSound implements Sound{
|
class RecordStopSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_STOP_RECORD, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_STOP_RECORD, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class RedstonePowerOffSound implements Sound{
|
class RedstonePowerOffSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_POWER_OFF, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_POWER_OFF, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class RedstonePowerOnSound implements Sound{
|
class RedstonePowerOnSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_POWER_ON, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_POWER_ON, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class ShulkerBoxCloseSound implements Sound{
|
class ShulkerBoxCloseSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_SHULKERBOX_CLOSED, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_SHULKERBOX_CLOSED, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
|||||||
|
|
||||||
class ShulkerBoxOpenSound implements Sound{
|
class ShulkerBoxOpenSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_SHULKERBOX_OPEN, $pos, false)];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_SHULKERBOX_OPEN, $pos, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,5 +31,5 @@ interface Sound{
|
|||||||
/**
|
/**
|
||||||
* @return ClientboundPacket[]
|
* @return ClientboundPacket[]
|
||||||
*/
|
*/
|
||||||
public function encode(?Vector3 $pos) : array;
|
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) : array{
|
public function encode(Vector3 $pos) : array{
|
||||||
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_THROW, $pos, -1, "minecraft:player", false, false)];
|
return [LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_THROW, $pos, -1, "minecraft:player", false, false)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
|||||||
|
|
||||||
class TotemUseSound implements Sound{
|
class TotemUseSound implements Sound{
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
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) : array{
|
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,7 +41,7 @@ class XpLevelUpSound implements Sound{
|
|||||||
return $this->xpLevel;
|
return $this->xpLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(?Vector3 $pos) : array{
|
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::nonActorSound(LevelSoundEventPacket::SOUND_LEVELUP, $pos, false, 0x10000000 * intdiv(min(30, $this->xpLevel), 5))];
|
return [LevelSoundEventPacket::nonActorSound(LevelSoundEventPacket::SOUND_LEVELUP, $pos, false, 0x10000000 * intdiv(min(30, $this->xpLevel), 5))];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user