本文整理匯總了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;
}