mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 04:17:07 +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;
|
namespace pocketmine\entity\animation;
|
||||||
|
|
||||||
use pocketmine\entity\Human;
|
use pocketmine\entity\Living;
|
||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
use pocketmine\network\mcpe\convert\TypeConverter;
|
use pocketmine\network\mcpe\convert\TypeConverter;
|
||||||
use pocketmine\network\mcpe\protocol\ActorEventPacket;
|
use pocketmine\network\mcpe\protocol\ActorEventPacket;
|
||||||
@ -32,7 +32,7 @@ use pocketmine\network\mcpe\protocol\types\ActorEvent;
|
|||||||
final class ConsumingItemAnimation implements Animation{
|
final class ConsumingItemAnimation implements Animation{
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private Human $human, //TODO: maybe this can be expanded to more than just player entities?
|
private Living $entity,
|
||||||
private Item $item
|
private Item $item
|
||||||
){}
|
){}
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ final class ConsumingItemAnimation implements Animation{
|
|||||||
[$netId, $netData] = TypeConverter::getInstance()->getItemTranslator()->toNetworkId($this->item);
|
[$netId, $netData] = TypeConverter::getInstance()->getItemTranslator()->toNetworkId($this->item);
|
||||||
return [
|
return [
|
||||||
//TODO: need to check the data values
|
//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