Skip to content

Commit

Permalink
fix: support MC 1.21.30
Browse files Browse the repository at this point in the history
  • Loading branch information
AIPTU committed Sep 23, 2024
1 parent 02336a1 commit 16c18dd
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/aiptu/smaccer/entity/trait/EmoteTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
use aiptu\smaccer\Smaccer;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\StringTag;
use pocketmine\network\mcpe\EntityEventBroadcaster;
use pocketmine\network\mcpe\NetworkBroadcastUtils;
use pocketmine\network\mcpe\protocol\EmotePacket;
use function microtime;

trait EmoteTrait {
Expand Down Expand Up @@ -123,10 +123,11 @@ public function performActionEmote(string $actionEmote, ?array $targets = null)
$this->broadcastEmote($event->getActionEmote()->getUuid(), $targets);
}

private function broadcastEmote(string $emote, ?array $targets = null) : void {
NetworkBroadcastUtils::broadcastPackets($targets ?? $this->getViewers(), [
EmotePacket::create($this->getId(), $emote, '', '', EmotePacket::FLAG_MUTE_ANNOUNCEMENT),
]);
private function broadcastEmote(string $emoteId, ?array $targets = null) : void {
NetworkBroadcastUtils::broadcastEntityEvent(
$targets ?? $this->getViewers(),
fn (EntityEventBroadcaster $broadcaster, array $recipients) => $broadcaster->onEmote($recipients, $this, $emoteId)
);
}

protected function entityBaseTick(int $tickDiff = 1) : bool {
Expand Down

0 comments on commit 16c18dd

Please sign in to comment.