Skip to content

Commit

Permalink
Merge upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
dries-c committed Oct 6, 2024
1 parent 211887c commit b844fa8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/entity/Human.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ public function jump() : void{
}
}

public function emote(string $emoteId, int $emoteLengthTicks) : 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)
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/network/mcpe/EntityEventBroadcaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
3 changes: 1 addition & 2 deletions src/network/mcpe/handler/InGamePacketHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
use pocketmine\network\mcpe\protocol\PlayerHotbarPacket;
use pocketmine\network\mcpe\protocol\PlayerInputPacket;
use pocketmine\network\mcpe\protocol\PlayerSkinPacket;
use pocketmine\network\mcpe\protocol\ProtocolInfo;
use pocketmine\network\mcpe\protocol\RequestChunkRadiusPacket;
use pocketmine\network\mcpe\protocol\ServerSettingsRequestPacket;
use pocketmine\network\mcpe\protocol\SetActorMotionPacket;
Expand Down Expand Up @@ -1031,7 +1030,7 @@ public function handleLevelSoundEvent(LevelSoundEventPacket $packet) : bool{
}

public function handleEmote(EmotePacket $packet) : bool{
$this->player->emote($packet->getEmoteId(), $this->session->getProtocolId() >= ProtocolInfo::PROTOCOL_1_21_30 ? $packet->getEmoteLengthTicks() : 0);
$this->player->emote($packet->getEmoteId());
return true;
}
}
2 changes: 2 additions & 0 deletions src/network/mcpe/handler/ResourcePacksPacketHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,11 @@ public function setUp() : void{
//TODO: support forcing server packs
$this->session->sendDataPacket(ResourcePacksInfoPacket::create(
resourcePackEntries: $resourcePackEntries,
behaviorPackEntries: [],
mustAccept: $this->mustAccept,
hasAddons: false,
hasScripts: false,
forceServerPacks: false,
cdnUrls: []
));
$this->session->getLogger()->debug("Waiting for client to accept resource packs");
Expand Down
4 changes: 2 additions & 2 deletions src/player/Player.php
Original file line number Diff line number Diff line change
Expand Up @@ -2019,15 +2019,15 @@ public function toggleSwim(bool $swim) : bool{
return true;
}

public function emote(string $emoteId, int $emoteLengthTicks) : void{
public function emote(string $emoteId) : void{
$currentTick = $this->server->getTick();
if($currentTick - $this->lastEmoteTick > 5){
$this->lastEmoteTick = $currentTick;
$event = new PlayerEmoteEvent($this, $emoteId);
$event->call();
if(!$event->isCancelled()){
$emoteId = $event->getEmoteId();
parent::emote($emoteId, $emoteLengthTicks);
parent::emote($emoteId);
}
}
}
Expand Down

0 comments on commit b844fa8

Please sign in to comment.