Introduce some (not great) API for entity animations

while this API is a bit yucky, it's a step forward for protocol isolation and offers the possibility of controlling animations by adding events.
This commit is contained in:
Dylan K. Taylor
2020-05-01 13:57:26 +01:00
parent 9615186afd
commit 8682ea35f7
17 changed files with 471 additions and 48 deletions

View File

@@ -23,12 +23,12 @@ declare(strict_types=1);
namespace pocketmine\entity;
use pocketmine\entity\animation\SquidInkCloudAnimation;
use pocketmine\event\entity\EntityDamageByEntityEvent;
use pocketmine\event\entity\EntityDamageEvent;
use pocketmine\item\VanillaItems;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\network\mcpe\protocol\ActorEventPacket;
use pocketmine\network\mcpe\protocol\types\entity\EntityLegacyIds;
use function atan2;
use function mt_rand;
@@ -71,7 +71,7 @@ class Squid extends WaterAnimal{
$this->swimDirection = $this->location->subtract($e->location)->normalize();
}
$this->broadcastEntityEvent(ActorEventPacket::SQUID_INK_CLOUD);
$this->broadcastAnimation(new SquidInkCloudAnimation($this));
}
}