holder = $holder; parent::__construct($items, $size, $title); } public function onOpen(Player $who) : void{ parent::onOpen($who); $pk = new ContainerOpenPacket(); $pk->windowId = $who->getWindowId($this); $pk->type = $this->getNetworkType(); $holder = $this->getHolder(); $pk->x = $pk->y = $pk->z = 0; $pk->entityUniqueId = -1; if($holder instanceof Entity){ $pk->entityUniqueId = $holder->getId(); }else{ $pk->x = $holder->getFloorX(); $pk->y = $holder->getFloorY(); $pk->z = $holder->getFloorZ(); } $who->dataPacket($pk); $this->sendContents($who); } public function onClose(Player $who) : void{ $pk = new ContainerClosePacket(); $pk->windowId = $who->getWindowId($this); $pk->server = $who->getClosingWindowId() !== $pk->windowId; $who->dataPacket($pk); parent::onClose($who); } /** * Returns the Minecraft PE inventory type used to show the inventory window to clients. */ abstract public function getNetworkType() : int; /** * @return Vector3 */ public function getHolder(){ return $this->holder; } }