deactivate() public method

public deactivate ( array $ignore = [] )
$ignore array
示例#1
0
文件: Lever.php 项目: xpyctum/Genisys
 public function deactivate(array $ignore = [])
 {
     parent::deactivate($ignore);
     $side = $this->meta;
     if ($this->isActivated()) {
         $side ^= 0x8;
     }
     $faces = [5 => 0, 6 => 0, 3 => 2, 1 => 4, 4 => 3, 2 => 5, 0 => 1, 7 => 1];
     $block = $this->getSide($faces[$side])->getSide(Vector3::SIDE_UP);
     if (!$this->isRightPlace($this, $block)) {
         if (!$this->checkPower($block)) {
             if ($block instanceof Door or $block instanceof Trapdoor or $block instanceof FenceGate) {
                 if ($block->isOpened()) {
                     $block->onActivate(new Item(0));
                 }
             }
             /** @var ActiveRedstoneLamp $block */
             if ($block->getId() == Block::ACTIVE_REDSTONE_LAMP) {
                 $block->turnOff();
             }
         }
         if ($block->getId() == Block::REDSTONE_WIRE) {
             /** @var RedstoneWire $wire */
             $wire = $block;
             $wire->calcSignal(0, RedstoneWire::OFF);
         }
     }
     $this->checkTorchOff($this->getSide($faces[$side]), [$this->getOppositeSide($faces[$side])]);
 }
示例#2
0
 public function deactivate(array $ignore = [])
 {
     parent::deactivate($ignore = []);
     $faces = [0 => 1, 1 => 0, 2 => 3, 3 => 2, 4 => 5, 5 => 4];
     $side = $this->meta;
     if ($this->isActivated()) {
         $side ^= 0x8;
     }
     $block = $this->getSide($faces[$side])->getSide(Vector3::SIDE_UP);
     if (!$this->equals($block)) {
         $this->deactivateBlock($block);
     }
     if ($side != 1) {
         $this->deactivateBlock($this->getSide($faces[$side], 2));
     }
     $this->checkTorchOff($this->getSide($faces[$side]), [$this->getOppositeSide($faces[$side])]);
 }