diff --git a/src/entity/Human.php b/src/entity/Human.php index 56da6570e..771696c41 100644 --- a/src/entity/Human.php +++ b/src/entity/Human.php @@ -161,6 +161,12 @@ class Human extends Living implements ProjectileSource, InventoryHolder{ } } + public function emote(string $emoteId) : void{ + foreach($this->getViewers() as $player){ + $player->getNetworkSession()->onEmote($this, $emoteId); + } + } + public function getHungerManager() : HungerManager{ return $this->hungerManager; } diff --git a/src/network/mcpe/NetworkSession.php b/src/network/mcpe/NetworkSession.php index 73be3bee5..f1faeb395 100644 --- a/src/network/mcpe/NetworkSession.php +++ b/src/network/mcpe/NetworkSession.php @@ -1046,7 +1046,7 @@ class NetworkSession{ $this->sendDataPacket(SetTitlePacket::setAnimationTimes($fadeIn, $stay, $fadeOut)); } - public function onEmote(Player $from, string $emoteId) : void{ + public function onEmote(Human $from, string $emoteId) : void{ $this->sendDataPacket(EmotePacket::create($from->getId(), $emoteId, EmotePacket::FLAG_SERVER)); } diff --git a/src/player/Player.php b/src/player/Player.php index 7cf4388d1..fd54f9a98 100644 --- a/src/player/Player.php +++ b/src/player/Player.php @@ -1841,9 +1841,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{ $event->call(); if(!$event->isCancelled()){ $emoteId = $event->getEmoteId(); - foreach($this->getViewers() as $player){ - $player->getNetworkSession()->onEmote($this, $emoteId); - } + parent::emote($emoteId); } } }