42 use AnimatedBlockInventoryTrait {
43 onClose as animatedBlockInventoryTrait_onClose;
46 public function __construct(
50 parent::__construct($inventory);
51 $this->holder = $holder;
55 return $this->inventory;
58 public function getViewerCount() :
int{
59 $enderChest = $this->getHolder()->getWorld()->getTile($this->getHolder());
63 return $enderChest->getViewerCount();
66 protected function getOpenSound() :
Sound{
70 protected function getCloseSound() :
Sound{
74 protected function animateBlock(
bool $isOpen) :
void{
75 $holder = $this->getHolder();
78 $holder->
getWorld()->broadcastPacketToViewers($holder, BlockEventPacket::create(BlockPosition::fromVector3($holder), 1, $isOpen ? 1 : 0));
81 public function onClose(
Player $who) :
void{
82 $this->animatedBlockInventoryTrait_onClose($who);
83 $enderChest = $this->getHolder()->getWorld()->getTile($this->getHolder());
85 $enderChest->setViewerCount($enderChest->getViewerCount() - 1);