本文整理汇总了PHP中pocketmine\level\Location::getLevel方法的典型用法代码示例。如果您正苦于以下问题:PHP Location::getLevel方法的具体用法?PHP Location::getLevel怎么用?PHP Location::getLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\level\Location
的用法示例。
在下文中一共展示了Location::getLevel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build
public function build()
{
$materialMaxKey = count($this->floorMaterials) - 1;
$level = $this->playerPrepLoc->getLevel();
// $level->getServer()->getLogger()->debug("Start rebuilding of spleef $this->name");
for ($floor = 0; $floor < $this->floors; $floor++) {
$y = $this->lowestY + $floor * $this->floorHeight;
for ($x = $this->fromx; $x <= $this->tox; $x++) {
for ($z = $this->fromz; $z <= $this->toz; $z++) {
$level->setBlock(new Vector3($x, $y, $z), $this->floorMaterials[mt_rand(0, $materialMaxKey)], false, false);
}
}
}
// $level->getServer()->getLogger()->debug("Finished rebuilding of spleef $this->name");
}
示例2: createTouchEffect
public function createTouchEffect(Location $position, $entityHeight, Location $damagerPosition, $damagerHeight)
{
if (isset($this->config["NU_EFFECT"]) && !$this->config["NU_EFFECT"]) {
$position->getLevel()->addSound(new DoorSound($position));
for ($i = 0; $i < 50; $i++) {
$position->getLevel()->addParticle(new HeartParticle($position->add(mt_rand(-1, 1), mt_rand(-1, 1) + $entityHeight, mt_rand(-1, 1))));
}
for ($i = 0; $i < 50; $i++) {
$damagerPosition->getLevel()->addParticle(new HeartParticle($damagerPosition->add(mt_rand(-1, 1), mt_rand(-1, 1) + $damagerHeight, mt_rand(-1, 1))));
}
} else {
$position->getLevel()->addSound(new DoorSound($position));
for ($i = 0; $i < 50; $i++) {
$position->getLevel()->addParticle(new DustParticle($position->add(mt_rand(-1, 1) / 2, mt_rand(-1, 1) / 2 + $entityHeight, mt_rand(-1, 1) / 2), 153, 51, 255));
}
for ($i = 0; $i < 50; $i++) {
$damagerPosition->getLevel()->addParticle(new DustParticle($damagerPosition->add(mt_rand(-1, 1) / 2, mt_rand(-1, 1) / 2 + $damagerHeight, mt_rand(-1, 1) / 2), 153, 51, 255));
}
}
}
示例3: fromPosition
public static function fromPosition($name, Location $pos)
{
return new BaseLocation($name, $pos->getX(), $pos->getY(), $pos->getZ(), $pos->getLevel(), $pos->getYaw(), $pos->getPitch());
}
示例4: setHome
/**
* @param $home
* @param Location $pos
* @return bool
*/
public function setHome($home, Location $pos)
{
if (!$this->getPlugin()->validateName($home, false)) {
return false;
}
$this->homes[$home] = new BaseLocation($home, $pos->getX(), $pos->getY(), $pos->getZ(), $pos->getLevel(), $pos->getYaw(), $pos->getPitch());
return true;
}