コード例 #1
0
 public function __construct(Player $p)
 {
     parent::__construct($p, InventoryType::get(2));
     $inv = $p->getInventory();
     $this->setContents($inv->getContents());
     $this->armor = $inv->getArmorContents();
     for ($i = 0; $i < 10; $i++) {
         $this->hotbar[$i] = $inv->getHotbarSlotIndex($i);
     }
 }
コード例 #2
0
 public function onClose(Player $who)
 {
     if (count($this->getViewers()) === 1) {
         $pk = new TileEventPacket();
         $pk->x = $this->main->getFakeTile()->x;
         $pk->y = $this->main->getFakeTile()->y;
         $pk->z = $this->main->getFakeTile()->z;
         $pk->case1 = 1;
         $pk->case2 = 0;
         if (($level = $this->main->getFakeTile()->getLevel()) instanceof Level) {
             Server::broadcastPacket($level->getChunkPlayers($this->main->getFakeTile()->x >> 4, $this->main->getFakeTile()->z >> 4), $pk->setChannel(Network::CHANNEL_WORLD_EVENTS));
         }
     }
     parent::onClose($who);
 }
コード例 #3
0
 public function __construct($holder, $client)
 {
     $this->client = $client;
     parent::__construct($holder, InventoryType::get(InventoryType::CHEST), [], null, "Trader Inventory");
 }
コード例 #4
0
 public function __construct(InventoryHolder $holder, $name = "Money Account")
 {
     parent::__construct($holder, clone InventoryType::get(InventoryType::CHEST), [], 36, $name);
 }