本文整理汇总了PHP中pocketmine\level\Level::scheduleUpdate方法的典型用法代码示例。如果您正苦于以下问题:PHP Level::scheduleUpdate方法的具体用法?PHP Level::scheduleUpdate怎么用?PHP Level::scheduleUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\level\Level
的用法示例。
在下文中一共展示了Level::scheduleUpdate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onActivate
//.........这里部分代码省略.........
$x_min_y++;
}
$y_max = min($x_max_y, $x_min_y) - 1;
//y最大值
$count_y = $y_max - $ty + 2;
//方向方块
//Server::getInstance()->broadcastMessage("$y_max $x_max_y $x_min_y $x_max $x_min");
if ($count_y >= 5 and $count_y <= 23) {
//5 23
$count_up = 0;
//上面
for ($ux = $x_min; $level->getBlock($this->temporalVector->setComponents($ux, $y_max, $tz))->getId() == Block::OBSIDIAN and $ux <= $x_max; $ux++) {
$count_up++;
}
//Server::getInstance()->broadcastMessage("$count_up $count_x");
if ($count_up == $count_x) {
for ($px = $x_min + 1; $px < $x_max; $px++) {
for ($py = $ty + 1; $py < $y_max; $py++) {
$level->setBlock($this->temporalVector->setComponents($px, $py, $tz), new Portal());
}
}
if ($player->isSurvival()) {
$this->useOn($block, 2);
$player->getInventory()->setItemInHand($this);
}
return true;
}
}
}
//z方向
$z_max = $tz;
//z最大值
$z_min = $tz;
//z最小值
$count_z = 0;
//z方向方块
for ($z = $tz + 1; $level->getBlock($this->temporalVector->setComponents($tx, $ty, $z))->getId() == Block::OBSIDIAN; $z++) {
$z_max++;
}
for ($z = $tz - 1; $level->getBlock($this->temporalVector->setComponents($tx, $ty, $z))->getId() == Block::OBSIDIAN; $z--) {
$z_min--;
}
$count_z = $z_max - $z_min + 1;
if ($count_z >= 4 and $count_z <= 23) {
//4 23
$z_max_y = $ty;
//z最大值时的y最大值
$z_min_y = $ty;
//z最小值时的y最大值
for ($y = $ty; $level->getBlock($this->temporalVector->setComponents($tx, $y, $z_max))->getId() == Block::OBSIDIAN; $y++) {
$z_max_y++;
}
for ($y = $ty; $level->getBlock($this->temporalVector->setComponents($tx, $y, $z_min))->getId() == Block::OBSIDIAN; $y++) {
$z_min_y++;
}
$y_max = min($z_max_y, $z_min_y) - 1;
//y最大值
$count_y = $y_max - $ty + 2;
//方向方块
if ($count_y >= 5 and $count_y <= 23) {
//5 23
$count_up = 0;
//上面
for ($uz = $z_min; $level->getBlock($this->temporalVector->setComponents($tx, $y_max, $uz))->getId() == Block::OBSIDIAN and $uz <= $z_max; $uz++) {
$count_up++;
}
//Server::getInstance()->broadcastMessage("$count_up $count_z");
if ($count_up == $count_z) {
for ($pz = $z_min + 1; $pz < $z_max; $pz++) {
for ($py = $ty + 1; $py < $y_max; $py++) {
$level->setBlock($this->temporalVector->setComponents($tx, $py, $pz), new Portal());
}
}
if ($player->isSurvival()) {
$this->useOn($block, 2);
$player->getInventory()->setItemInHand($this);
}
return true;
}
}
}
//return true;
}
if ($block->getId() === self::AIR and $target instanceof Solid) {
$level->setBlock($block, new Fire(), true);
/** @var Fire $block */
$block = $level->getBlock($block);
if ($block->getSide(Vector3::SIDE_DOWN)->isTopFacingSurfaceSolid() or $block->canNeighborBurn()) {
$level->scheduleUpdate($block, $block->getTickRate() + mt_rand(0, 10));
// return true;
}
if ($player->isSurvival()) {
$this->useOn($block, 2);
//耐久跟报废分别写在 tool 跟 level 了
$player->getInventory()->setItemInHand($this);
}
return true;
}
return false;
}