Inheritance: extends BaseInventory
 public function onClose(Player $who)
 {
     parent::onClose($who);
     for ($i = 0; $i < 2; ++$i) {
         $this->getHolder()->getLevel()->dropItem($this->getHolder()->add(0.5, 0.5, 0.5), $this->getItem($i));
         $this->clear($i);
     }
 }
Example #2
0
 public function onClose(Player $who)
 {
     $who->updateExperience();
     parent::onClose($who);
     $this->getHolder()->getLevel()->dropItem($this->getHolder()->add(0.5, 0.5, 0.5), $this->getItem(1));
     $this->getHolder()->getLevel()->dropItem($this->getHolder()->add(0.5, 0.5, 0.5), $this->getItem(0));
     $this->clear(0);
     $this->clear(1);
     $this->clear(2);
 }
Example #3
0
 public function onClose(Player $who)
 {
     if (count($this->getViewers()) === 1) {
         $pk = new TileEventPacket();
         $pk->x = $this->getHolder()->getX();
         $pk->y = $this->getHolder()->getY();
         $pk->z = $this->getHolder()->getZ();
         $pk->case1 = 1;
         $pk->case2 = 0;
         Server::broadcastPacket($this->getHolder()->getLevel()->getPlayers(), $pk);
     }
     parent::onClose($who);
 }
 public function onClose(Player $who)
 {
     if (count($this->getViewers()) === 1) {
         $pk = new TileEventPacket();
         $pk->x = $this->getHolder()->getX();
         $pk->y = $this->getHolder()->getY();
         $pk->z = $this->getHolder()->getZ();
         $pk->case1 = 1;
         $pk->case2 = 0;
         if (($level = $this->getHolder()->getLevel()) instanceof Level) {
             $level->addChunkPacket($this->getHolder()->getX() >> 4, $this->getHolder()->getZ() >> 4, $pk->setChannel(Network::CHANNEL_WORLD_EVENTS));
         }
     }
     parent::onClose($who);
 }
 public function onClose(Player $who)
 {
     if (count($this->getViewers()) === 1) {
         $pk = new BlockEventPacket();
         $pk->x = $this->getHolder()->getX();
         $pk->y = $this->getHolder()->getY();
         $pk->z = $this->getHolder()->getZ();
         $pk->case1 = 1;
         $pk->case2 = 0;
         if (($level = $this->getHolder()->getLevel()) instanceof Level) {
             $level->addChunkPacket($this->getHolder()->getX() >> 4, $this->getHolder()->getZ() >> 4, $pk);
         }
     }
     parent::onClose($who);
 }
 public function onClose(Player $who)
 {
     if (count($this->getViewers()) === 1) {
         $pk = new TileEventPacket();
         $pk->x = $this->getHolder()->getX();
         $pk->y = $this->getHolder()->getY();
         $pk->z = $this->getHolder()->getZ();
         $pk->case1 = 1;
         $pk->case2 = 0;
         if (($level = $this->getHolder()->getLevel()) instanceof Level) {
             Server::broadcastPacket($level->getUsingChunk($this->getHolder()->getX() >> 4, $this->getHolder()->getZ() >> 4), $pk);
         }
     }
     parent::onClose($who);
 }
Example #7
0
 public function onClose(Player $who)
 {
     if (count($this->getViewers()) === 1) {
         $pk = new BlockEventPacket();
         $pk->x = $this->getHolder()->getX();
         $pk->y = $this->getHolder()->getY();
         $pk->z = $this->getHolder()->getZ();
         $pk->case1 = 1;
         $pk->case2 = 0;
         if (($level = $this->getHolder()->getLevel()) instanceof Level) {
             $level->addChunkPacket($this->getHolder()->getX() >> 4, $this->getHolder()->getZ() >> 4, $pk);
         }
     }
     parent::onClose($who);
     /** @var TrappedChest $block */
     $block = $this->getHolder()->getBlock();
     if ($block instanceof TrappedChest) {
         if ($block->isActivated()) {
             $block->deactivate();
         }
     }
 }
Example #8
0
 public function onSlotChange($index, $before, $send)
 {
     parent::onSlotChange($index, $before, $send);
     $this->getHolder()->scheduleUpdate();
     $this->getHolder()->updateSurface();
 }
 public function onSlotChange($index, $before)
 {
     parent::onSlotChange($index, $before);
     $this->getHolder()->scheduleUpdate();
 }
Example #10
0
 public function onClose(Player $who)
 {
     parent::onClose($who);
     for ($i = 0; $i < 2; ++$i) {
         $this->getHolder()->getLevel()->dropItem($this->getHolder()->add(0.5, 0.5, 0.5), $this->getItem($i));
         $this->clear($i);
     }
     if (count($this->getViewers()) == 0) {
         $this->levels = null;
         $this->entries = null;
         $this->bookshelfAmount = 0;
     }
 }
Example #11
0
 public function onClose(Player $who)
 {
     parent::onClose($who);
 }
Example #12
0
 public function __construct(Hopper $tile)
 {
     parent::__construct($tile, InventoryType::get(InventoryType::HOPPER));
 }
Example #13
0
 public function __construct(Dispenser $tile)
 {
     parent::__construct($tile, InventoryType::get(InventoryType::DISPENSER));
 }