本文整理汇总了PHP中pocketmine\block\Block::turnOn方法的典型用法代码示例。如果您正苦于以下问题:PHP Block::turnOn方法的具体用法?PHP Block::turnOn怎么用?PHP Block::turnOn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\block\Block
的用法示例。
在下文中一共展示了Block::turnOn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: activateBlockWithoutWire
public function activateBlockWithoutWire(Block $block)
{
if ($block instanceof Door or $block instanceof Trapdoor or $block instanceof FenceGate) {
if (!$block->isOpened()) {
$block->onActivate(new Item(0));
}
}
if ($block->getId() == Block::TNT) {
$block->onActivate(new Item(Item::FLINT_AND_STEEL));
}
/** @var InactiveRedstoneLamp $block */
if ($block->getId() == Block::INACTIVE_REDSTONE_LAMP) {
$block->turnOn();
}
/** @var Dropper|Dispenser $block */
if ($block->getId() == Block::DROPPER or $block->getId() == Block::DISPENSER) {
$block->activate();
}
/** @var PoweredRepeater $block */
if ($block->getId() == Block::UNPOWERED_REPEATER_BLOCK) {
if ($this->equals($block->getSide($block->getDirection()))) {
$block->activate();
}
}
}
示例2: activateBlock
public function activateBlock(Block $block)
{
if ($block instanceof Door or $block instanceof Trapdoor or $block instanceof FenceGate) {
if (!$block->isOpened()) {
$block->onActivate(new Item(0));
}
}
if ($block->getId() == Block::TNT) {
$block->onActivate(new Item(Item::FLINT_AND_STEEL));
}
/** @var InactiveRedstoneLamp $block*/
if ($block->getId() == Block::INACTIVE_REDSTONE_LAMP) {
$block->turnOn();
}
if ($block->getId() == Block::REDSTONE_WIRE) {
/** @var RedstoneWire $wire */
$wire = $block;
$wire->calcSignal($this->maxStrength, RedstoneWire::ON);
}
/** @var Dropper|Dispenser $block */
if ($block->getId() == Block::DROPPER or $block->getId() == Block::DISPENSER) {
$block->activate();
}
}