Allow use ConsumingItemAnimation with Living entities (#5897)

This commit is contained in:
IvanCraft623 2023-07-14 11:41:46 -05:00 committed by GitHub
parent b399eda21e
commit 8c8794ec71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,7 +23,7 @@ declare(strict_types=1);
namespace pocketmine\entity\animation;
use pocketmine\entity\Human;
use pocketmine\entity\Living;
use pocketmine\item\Item;
use pocketmine\network\mcpe\convert\TypeConverter;
use pocketmine\network\mcpe\protocol\ActorEventPacket;
@ -32,7 +32,7 @@ use pocketmine\network\mcpe\protocol\types\ActorEvent;
final class ConsumingItemAnimation implements Animation{
public function __construct(
private Human $human, //TODO: maybe this can be expanded to more than just player entities?
private Living $entity,
private Item $item
){}
@ -40,7 +40,7 @@ final class ConsumingItemAnimation implements Animation{
[$netId, $netData] = TypeConverter::getInstance()->getItemTranslator()->toNetworkId($this->item);
return [
//TODO: need to check the data values
ActorEventPacket::create($this->human->getId(), ActorEvent::EATING_ITEM, ($netId << 16) | $netData)
ActorEventPacket::create($this->entity->getId(), ActorEvent::EATING_ITEM, ($netId << 16) | $netData)
];
}
}