mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 03:47:16 +00:00
Allow use ConsumingItemAnimation with Living entities (#5897)
This commit is contained in:
parent
b399eda21e
commit
8c8794ec71
@ -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)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user