contractedCopy(0.025, 0, 0.025)->trimmedCopy(Facing::UP, 0.05)]; } public function getSupportType(Facing $facing) : SupportType{ return SupportType::NONE; } protected function isOpeningObstructed() : bool{ return !$this->getSide(Facing::UP)->isTransparent(); } protected function newMenu(Player $player, Position $position) : BlockInventoryWindow{ return new BlockInventoryWindow($player, $player->getEnderInventory(), $position); } public function getDropsForCompatibleTool(Item $item) : array{ return [ VanillaBlocks::OBSIDIAN()->asItem()->setCount(8) ]; } public function isAffectedBySilkTouch() : bool{ return true; } protected function getViewerCount() : int{ $enderChest = $this->position->getWorld()->getTile($this->position); if(!$enderChest instanceof TileEnderChest){ return 0; } return $enderChest->getViewerCount(); } private function updateViewerCount(int $amount) : void{ $enderChest = $this->position->getWorld()->getTile($this->position); if($enderChest instanceof TileEnderChest){ $enderChest->setViewerCount($enderChest->getViewerCount() + $amount); } } protected function getOpenSound() : Sound{ return new EnderChestOpenSound(); } protected function getCloseSound() : Sound{ return new EnderChestCloseSound(); } protected function playAnimationVisual(Position $position, bool $isOpen) : void{ //event ID is always 1 for a chest //TODO: we probably shouldn't be sending a packet directly here, but it doesn't fit anywhere into existing systems $position->getWorld()->broadcastPacketToViewers($position, BlockEventPacket::create(BlockPosition::fromVector3($position), 1, $isOpen ? 1 : 0)); } public function onViewerAdded() : void{ $this->updateViewerCount(1); $this->traitOnViewerAdded(); } public function onViewerRemoved() : void{ $this->traitOnViewerRemoved(); $this->updateViewerCount(-1); } }