本文整理汇总了PHP中pocketmine\level\Position::getSide方法的典型用法代码示例。如果您正苦于以下问题:PHP Position::getSide方法的具体用法?PHP Position::getSide怎么用?PHP Position::getSide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\level\Position
的用法示例。
在下文中一共展示了Position::getSide方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onEnable
public function onEnable()
{
if (!file_exists($this->getDataFolder())) {
mkdir($this->getDataFolder());
}
$this->saveDefaultConfig();
$provider = $this->getConfig()->get("data-provider");
switch (strtolower($provider)) {
case "yaml":
$this->provider = new YamlDataProvider($this->getDataFolder() . "Shops.yml", $this->getConfig()->get("auto-save"));
break;
default:
$this->getLogger()->critical("Invalid data provider was given. EconomyShop will be terminated.");
return;
}
$this->getLogger()->notice("Data provider was set to: " . $this->provider->getProviderName());
$levels = [];
foreach ($this->provider->getAll() as $shop) {
if ($shop[9] !== -2) {
if (!isset($levels[$shop[3]])) {
$levels[$shop[3]] = $this->getServer()->getLevelByName($shop[3]);
}
$pos = new Position($shop[0], $shop[1], $shop[2], $levels[$shop[3]]);
$display = $pos;
if ($shop[9] !== -1) {
$display = $pos->getSide($shop[9]);
}
$this->items[$shop[3]][] = new ItemDisplayer($display, Item::get($shop[4], $shop[5]), $pos);
}
}
$this->getServer()->getPluginManager()->registerEvents($this, $this);
$this->lang = json_decode(stream_get_contents($rsc = $this->getResource("lang_en.json")), true);
// TODO: Language preferences
@fclose($rsc);
}
示例2: onEnable
public function onEnable()
{
$this->saveDefaultConfig();
if (!$this->selectLang()) {
$this->getLogger()->warning("Invalid language option was given.");
}
$provider = $this->getConfig()->get("data-provider");
switch (strtolower($provider)) {
case "yaml":
$this->provider = new YamlDataProvider($this->getDataFolder() . "Sells.yml", $this->getConfig()->get("auto-save"));
break;
default:
$this->getLogger()->critical("Invalid data provider was given. EconomySell will be terminated.");
return;
}
$this->getLogger()->notice("Data provider was set to: " . $this->provider->getProviderName());
$levels = [];
foreach ($this->provider->getAll() as $sell) {
if ($sell[9] !== -2) {
if (!isset($levels[$sell[3]])) {
$levels[$sell[3]] = $this->getServer()->getLevelByName($sell[3]);
}
$pos = new Position($sell[0], $sell[1], $sell[2], $levels[$sell[3]]);
$display = $pos;
if ($sell[9] !== -1) {
$display = $pos->getSide($sell[9]);
}
$this->items[$sell[3]][] = new ItemDisplayer($display, Item::get($sell[4], $sell[5]), $pos);
}
}
$this->getServer()->getPluginManager()->registerEvents($this, $this);
}
示例3: getSide
/**
* Returns a side Vector
*
* @param int $side
* @param int $step
*
* @return WeakPosition
*
* @throws LevelException
*/
public function getSide($side, $step = 1)
{
assert($this->isValid());
return WeakPosition::fromObject(parent::getSide($side, $step), $this->level);
}
示例4: getSide
/**
* Returns the Block on the side $side, works like Vector3::side()
*
* @param int $side
* @param int $step
*
* @return Block
*/
public function getSide($side, $step = 1)
{
$v = parent::getSide($side, $step);
if ($this->isValid()) {
return $this->getLevel()->getBlock($v);
}
return Block::get(Item::AIR, 0, $v);
}