public function activate(array $ignore = []) { parent::activate($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 ($block instanceof Door or $block instanceof Trapdoor) { if (!$block->isOpened()) { $block->onActivate(new Item(0)); } } if ($block->getId() == Block::TNT) { $block->onActivate(new Item(Item::FLINT_AND_STEEL)); } /** @var ActiveRedstoneLamp $block */ if ($block->getId() == Block::INACTIVE_REDSTONE_LAMP or $block->getId() == Block::ACTIVE_REDSTONE_LAMP) { $block->turnOn(); } if ($block->getId() == Block::REDSTONE_WIRE) { /** @var RedstoneWire $wire */ $wire = $block; $wire->calcSignal($this->maxStrength, RedstoneWire::ON); } } $this->checkTorchOn($this->getSide($faces[$side]), [$this->getOppositeSide($faces[$side])]); }
public function activate(array $ignore = []) { parent::activate($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)) { $this->activateBlock($block); } $this->checkTorchOn($this->getSide($faces[$side]), [$this->getOppositeSide($faces[$side])]); }
public function activate(array $ignore = []) { parent::activate($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->activateBlock($block); } if ($side != 1) { $block = $this->getSide($faces[$side], 2); $this->activateBlock($block); } $this->checkTorchOn($this->getSide($faces[$side]), [$this->getOppositeSide($faces[$side])]); }