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(); }elseif($holder instanceof Vector3){ $pk->x = (int) $holder->getX(); $pk->y = (int) $holder->getY(); $pk->z = (int) $holder->getZ(); } $who->dataPacket($pk); $this->sendContents($who); } public function onClose(Player $who) : void{ $pk = new ContainerClosePacket(); $pk->windowId = $who->getWindowId($this); $who->dataPacket($pk); parent::onClose($who); } /** * Returns the Minecraft PE inventory type used to show the inventory window to clients. * @return int */ abstract public function getNetworkType() : int; }