mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Clean up LevelSoundEvent handling
This commit is contained in:
@ -30,10 +30,10 @@ use pocketmine\event\inventory\InventoryPickupArrowEvent;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\item\ItemFactory;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\level\sound\ArrowHitSound;
|
||||
use pocketmine\math\RayTraceResult;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\network\mcpe\protocol\EntityEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\TakeItemEntityPacket;
|
||||
use pocketmine\Player;
|
||||
use function mt_rand;
|
||||
@ -138,7 +138,7 @@ class Arrow extends Projectile{
|
||||
|
||||
protected function onHit(ProjectileHitEvent $event) : void{
|
||||
$this->setCritical(false);
|
||||
$this->level->broadcastLevelSoundEvent($this, LevelSoundEventPacket::SOUND_BOW_HIT);
|
||||
$this->level->addSound($this, new ArrowHitSound());
|
||||
}
|
||||
|
||||
protected function onHitBlock(Block $blockHit, RayTraceResult $hitResult) : void{
|
||||
|
@ -25,7 +25,7 @@ namespace pocketmine\entity\projectile;
|
||||
|
||||
use pocketmine\event\entity\ProjectileHitEvent;
|
||||
use pocketmine\level\particle\PotionSplashParticle;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\level\sound\PotionSplashSound;
|
||||
use function mt_rand;
|
||||
|
||||
class ExperienceBottle extends Throwable{
|
||||
@ -39,7 +39,7 @@ class ExperienceBottle extends Throwable{
|
||||
|
||||
public function onHit(ProjectileHitEvent $event) : void{
|
||||
$this->level->addParticle($this, new PotionSplashParticle(PotionSplashParticle::DEFAULT_COLOR()));
|
||||
$this->level->broadcastLevelSoundEvent($this, LevelSoundEventPacket::SOUND_GLASS);
|
||||
$this->level->addSound($this, new PotionSplashSound());
|
||||
|
||||
$this->level->dropExperience($this, mt_rand(3, 11));
|
||||
}
|
||||
|
@ -33,8 +33,8 @@ use pocketmine\event\entity\ProjectileHitEntityEvent;
|
||||
use pocketmine\event\entity\ProjectileHitEvent;
|
||||
use pocketmine\item\Potion;
|
||||
use pocketmine\level\particle\PotionSplashParticle;
|
||||
use pocketmine\level\sound\PotionSplashSound;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\utils\Color;
|
||||
use function round;
|
||||
use function sqrt;
|
||||
@ -82,7 +82,7 @@ class SplashPotion extends Throwable{
|
||||
}
|
||||
|
||||
$this->level->addParticle($this, $particle);
|
||||
$this->level->broadcastLevelSoundEvent($this, LevelSoundEventPacket::SOUND_GLASS);
|
||||
$this->level->addSound($this, new PotionSplashSound());
|
||||
|
||||
if($hasEffects){
|
||||
if(!$this->willLinger()){
|
||||
|
Reference in New Issue
Block a user