46 use AnimatedContainerLikeTrait {
50 use MenuAccessorTrait;
51 use FacesOppositePlacingPlayerTrait;
59 return [
AxisAlignedBB::one()->contractedCopy(0.025, 0, 0.025)->trimmedCopy(
Facing::UP, 0.05)];
63 return SupportType::NONE;
67 return !$this->getSide(
Facing::UP)->isTransparent();
84 protected function getViewerCount() : int{
85 $enderChest = $this->position->getWorld()->getTile($this->position);
86 if(!$enderChest instanceof TileEnderChest){
89 return $enderChest->getViewerCount();
92 private function updateViewerCount(
int $amount) : void{
93 $enderChest = $this->position->getWorld()->getTile($this->position);
94 if($enderChest instanceof TileEnderChest){
95 $enderChest->setViewerCount($enderChest->getViewerCount() + $amount);
99 protected function getOpenSound() : Sound{
100 return new EnderChestOpenSound();
103 protected function getCloseSound() : Sound{
104 return new EnderChestCloseSound();
107 protected function playAnimationVisual(Position $position,
bool $isOpen) : void{
110 $position->getWorld()->broadcastPacketToViewers($position, BlockEventPacket::create(BlockPosition::fromVector3($position), 1, $isOpen ? 1 : 0));
114 $this->updateViewerCount(1);
115 $this->traitOnViewerAdded();
119 $this->traitOnViewerRemoved();
120 $this->updateViewerCount(-1);