diff --git a/src/entity/Human.php b/src/entity/Human.php index ce4e308b0be..f2c4c7a7405 100644 --- a/src/entity/Human.php +++ b/src/entity/Human.php @@ -178,10 +178,10 @@ public function jump() : void{ } } - public function emote(string $emoteId, int $emoteLengthTicks = 0) : void{ + public function emote(string $emoteId) : void{ NetworkBroadcastUtils::broadcastEntityEvent( $this->getViewers(), - fn(EntityEventBroadcaster $broadcaster, array $recipients) => $broadcaster->onEmote($recipients, $this, $emoteId, $emoteLengthTicks) + fn(EntityEventBroadcaster $broadcaster, array $recipients) => $broadcaster->onEmote($recipients, $this, $emoteId) ); } diff --git a/src/network/mcpe/EntityEventBroadcaster.php b/src/network/mcpe/EntityEventBroadcaster.php index b38338ce32e..252563149cb 100644 --- a/src/network/mcpe/EntityEventBroadcaster.php +++ b/src/network/mcpe/EntityEventBroadcaster.php @@ -89,5 +89,5 @@ public function onPickUpItem(array $recipients, Entity $collector, Entity $picke /** * @param NetworkSession[] $recipients */ - public function onEmote(array $recipients, Human $from, string $emoteId, int $emoteLengthTicks) : void; + public function onEmote(array $recipients, Human $from, string $emoteId) : void; } diff --git a/src/network/mcpe/StandardEntityEventBroadcaster.php b/src/network/mcpe/StandardEntityEventBroadcaster.php index ceef33a6715..3e2df399483 100644 --- a/src/network/mcpe/StandardEntityEventBroadcaster.php +++ b/src/network/mcpe/StandardEntityEventBroadcaster.php @@ -141,7 +141,14 @@ public function onPickUpItem(array $recipients, Entity $collector, Entity $picke $this->sendDataPacket($recipients, TakeItemActorPacket::create($collector->getId(), $pickedUp->getId())); } - public function onEmote(array $recipients, Human $from, string $emoteId, int $emoteLengthTicks) : void{ - $this->sendDataPacket($recipients, EmotePacket::create($from->getId(), $emoteId, $emoteLengthTicks, "", "", EmotePacket::FLAG_SERVER | EmotePacket::FLAG_MUTE_ANNOUNCEMENT)); + public function onEmote(array $recipients, Human $from, string $emoteId) : void{ + $this->sendDataPacket($recipients, EmotePacket::create( + $from->getId(), + $emoteId, + 0, //seems to be irrelevant for the client, we cannot risk rebroadcasting random values received + "", + "", + EmotePacket::FLAG_SERVER | EmotePacket::FLAG_MUTE_ANNOUNCEMENT + )); } } diff --git a/src/network/mcpe/handler/InGamePacketHandler.php b/src/network/mcpe/handler/InGamePacketHandler.php index ca239ab1bc5..c92db313310 100644 --- a/src/network/mcpe/handler/InGamePacketHandler.php +++ b/src/network/mcpe/handler/InGamePacketHandler.php @@ -1021,7 +1021,7 @@ public function handleLevelSoundEvent(LevelSoundEventPacket $packet) : bool{ } public function handleEmote(EmotePacket $packet) : bool{ - $this->player->emote($packet->getEmoteId(), $packet->getEmoteLengthTicks()); + $this->player->emote($packet->getEmoteId()); return true; } } diff --git a/src/player/Player.php b/src/player/Player.php index 1cd19238ec4..d442c6a3b20 100644 --- a/src/player/Player.php +++ b/src/player/Player.php @@ -2013,7 +2013,7 @@ public function toggleSwim(bool $swim) : bool{ return true; } - public function emote(string $emoteId, int $emoteLengthTicks = 0) : void{ + public function emote(string $emoteId) : void{ $currentTick = $this->server->getTick(); if($currentTick - $this->lastEmoteTick > 5){ $this->lastEmoteTick = $currentTick; @@ -2021,7 +2021,7 @@ public function emote(string $emoteId, int $emoteLengthTicks = 0) : void{ $event->call(); if(!$event->isCancelled()){ $emoteId = $event->getEmoteId(); - parent::emote($emoteId, $emoteLengthTicks); + parent::emote($emoteId); } } }