mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 17:59:41 +00:00
Sound->encode() now accepts Vector3|null
this will be needed for proper no-relative sound support.
This commit is contained in:
parent
77ace57985
commit
1049ffecc9
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class ArrowHitSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BOW_HIT, $pos);
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class BlockBreakSound implements Sound{
|
||||
$this->block = $block;
|
||||
}
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BREAK, $pos, $this->block->getRuntimeId());
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class BlockPlaceSound implements Sound{
|
||||
$this->block = $block;
|
||||
}
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_PLACE, $pos, $this->block->getRuntimeId());
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class BowShootSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BOW, $pos);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class BucketEmptyLavaSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_EMPTY_LAVA, $pos);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class BucketEmptyWaterSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_EMPTY_WATER, $pos);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class BucketFillLavaSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_FILL_LAVA, $pos);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class BucketFillWaterSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BUCKET_FILL_WATER, $pos);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class ChestCloseSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_CHEST_CLOSED, $pos);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class ChestOpenSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_CHEST_OPEN, $pos);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class EnderChestCloseSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_ENDERCHEST_CLOSED, $pos);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class EnderChestOpenSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_ENDERCHEST_OPEN, $pos);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class ExplodeSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_EXPLODE, $pos);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class FlintSteelSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_IGNITE, $pos);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
|
||||
class IgniteSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_IGNITE, 0, $pos);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class ItemBreakSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_BREAK, $pos);
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ abstract class LevelEventSound implements Sound{
|
||||
$this->pitch = $pitch * 1000;
|
||||
}
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelEventPacket::create($this->getLevelEventId(), (int) $this->pitch, $pos);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class PotionSplashSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_GLASS, $pos);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class RedstonePowerOffSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_POWER_OFF, $pos);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class RedstonePowerOnSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_POWER_ON, $pos);
|
||||
}
|
||||
}
|
||||
|
@ -29,9 +29,9 @@ use pocketmine\network\mcpe\protocol\ClientboundPacket;
|
||||
interface Sound{
|
||||
|
||||
/**
|
||||
* @param Vector3 $pos
|
||||
* @param Vector3|null $pos
|
||||
*
|
||||
* @return ClientboundPacket|ClientboundPacket[]
|
||||
*/
|
||||
public function encode(Vector3 $pos);
|
||||
public function encode(?Vector3 $pos);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
|
||||
class ThrowSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelSoundEventPacket::create(LevelSoundEventPacket::SOUND_THROW, $pos, -1, "minecraft:player");
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
|
||||
class TotemUseSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_TOTEM, 0, $pos);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
|
||||
class XpCollectSound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
return LevelEventPacket::create(LevelEventPacket::EVENT_SOUND_ORB, 0, $pos);
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ class XpLevelUpSound implements Sound{
|
||||
return $this->xpLevel;
|
||||
}
|
||||
|
||||
public function encode(Vector3 $pos){
|
||||
public function encode(?Vector3 $pos){
|
||||
//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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user