mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Clean up some AnimatePacket boilerplate code
This commit is contained in:
@ -63,6 +63,7 @@ use pocketmine\nbt\tag\FloatTag;
|
||||
use pocketmine\nbt\tag\ListTag;
|
||||
use pocketmine\nbt\tag\StringTag;
|
||||
use pocketmine\network\mcpe\protocol\AddEntityPacket;
|
||||
use pocketmine\network\mcpe\protocol\AnimatePacket;
|
||||
use pocketmine\network\mcpe\protocol\EntityEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\MoveEntityAbsolutePacket;
|
||||
use pocketmine\network\mcpe\protocol\RemoveEntityPacket;
|
||||
@ -2118,6 +2119,13 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
$this->server->broadcastPacket($players ?? $this->getViewers(), $pk);
|
||||
}
|
||||
|
||||
public function broadcastAnimation(?array $players, int $animationId) : void{
|
||||
$pk = new AnimatePacket();
|
||||
$pk->entityRuntimeId = $this->id;
|
||||
$pk->action = $animationId;
|
||||
$this->server->broadcastPacket($players ?? $this->getViewers(), $pk);
|
||||
}
|
||||
|
||||
public function __destruct(){
|
||||
$this->close();
|
||||
}
|
||||
|
Reference in New Issue
Block a user