Remove remaining direct protocol usages for particles

This commit is contained in:
Dylan K. Taylor
2019-03-26 17:00:00 +00:00
parent 1bf0802275
commit 37b5ad8350
5 changed files with 102 additions and 10 deletions

View File

@ -24,9 +24,8 @@ declare(strict_types=1);
namespace pocketmine\entity\projectile;
use pocketmine\event\entity\ProjectileHitEvent;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
use pocketmine\level\particle\PotionSplashParticle;
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
use pocketmine\utils\Color;
use function mt_rand;
class ExperienceBottle extends Throwable{
@ -39,7 +38,7 @@ class ExperienceBottle extends Throwable{
}
public function onHit(ProjectileHitEvent $event) : void{
$this->level->broadcastLevelEvent($this, LevelEventPacket::EVENT_PARTICLE_SPLASH, (new Color(0x38, 0x5d, 0xc6))->toARGB());
$this->level->addParticle($this, new PotionSplashParticle(PotionSplashParticle::DEFAULT_COLOR()));
$this->level->broadcastLevelSoundEvent($this, LevelSoundEventPacket::SOUND_GLASS);
$this->level->dropExperience($this, mt_rand(3, 11));