コード例 #1
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);
     }
 }
コード例 #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);
 }
コード例 #3
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);
 }
コード例 #4
0
 public function onSlotChange($index, $before)
 {
     parent::onSlotChange($index, $before);
     $this->getHolder()->scheduleUpdate();
 }