当前位置: 首页>>代码示例>>PHP>>正文


PHP level\Level类代码示例

本文整理汇总了PHP中pocketmine\level\Level的典型用法代码示例。如果您正苦于以下问题:PHP Level类的具体用法?PHP Level怎么用?PHP Level使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Level类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onActivate

 public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz)
 {
     $entity = null;
     $chunk = $level->getChunk($block->getX() >> 4, $block->getZ() >> 4);
     if (!$chunk instanceof FullChunk) {
         return false;
     }
     $nbt = new Compound("", ["Pos" => new Enum("Pos", [new Double("", $block->getX() + 0.5), new Double("", $block->getY()), new Double("", $block->getZ() + 0.5)]), "Motion" => new Enum("Motion", [new Double("", 0), new Double("", 0), new Double("", 0)]), "Rotation" => new Enum("Rotation", [new Float("", lcg_value() * 360), new Float("", 0)])]);
     $entity = Entity::createEntity($this->meta, $chunk, $nbt);
     if ($entity instanceof Entity) {
         if ($player->isSurvival()) {
             --$this->count;
         }
         $entity->spawnToAll();
         return true;
     }
     return false;
 }
开发者ID:mattiasaxelsson,项目名称:PocketMine-MP,代码行数:18,代码来源:SpawnEgg.php

示例2: setBlock

 private function setBlock(Vector3 $p, Level $lvl, ItemBlock $b, $meta)
 {
     $block = $b->getBlock();
     $block->setDamage($meta);
     $lvl->setBlock($p, $b);
     return true;
 }
开发者ID:Creeperface01,项目名称:ImagicalMine,代码行数:7,代码来源:FillCommand.php

示例3: onActivate

 public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz)
 {
     if ($this->meta === Item::AIR) {
         if ($target instanceof Liquid) {
             $level->setBlock($target, new Air(), true);
             if (($player->gamemode & 0x1) === 0) {
                 $this->meta = $target instanceof Water ? Item::WATER : Item::LAVA;
             }
             return true;
         }
     } elseif ($this->meta === Item::WATER) {
         //Support Make Non-Support Water to Support Water
         if ($block->getID() === self::AIR || $block instanceof Water && ($block->getDamage() & 0x7) != 0x0) {
             $water = new Water();
             $level->setBlock($block, $water, true);
             $water->place(clone $this, $block, $target, $face, $fx, $fy, $fz, $player);
             if (($player->gamemode & 0x1) === 0) {
                 $this->meta = 0;
             }
             return true;
         }
     } elseif ($this->meta === Item::LAVA) {
         if ($block->getID() === self::AIR) {
             $level->setBlock($block, new Lava(), true);
             if (($player->gamemode & 0x1) === 0) {
                 $this->meta = 0;
             }
             return true;
         }
     }
     return false;
 }
开发者ID:boybook,项目名称:PocketMine-MP,代码行数:32,代码来源:Bucket.php

示例4: isLevelCorrect

 public function isLevelCorrect(Level $level)
 {
     if ($this->world === "*") {
         return true;
     }
     return strtolower($level->getName()) === $this->world;
 }
开发者ID:gitter-badger,项目名称:DynamicHub,代码行数:7,代码来源:JoinMethod.php

示例5: onActivate

 public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz)
 {
     if ($target->getId() == Block::MONSTER_SPAWNER) {
         return true;
     } else {
         $entity = null;
         $chunk = $level->getChunk($block->getX() >> 4, $block->getZ() >> 4);
         if (!$chunk instanceof FullChunk) {
             return false;
         }
         $nbt = new CompoundTag("", ["Pos" => new EnumTag("Pos", [new DoubleTag("", $block->getX() + 0.5), new DoubleTag("", $block->getY()), new DoubleTag("", $block->getZ() + 0.5)]), "Motion" => new EnumTag("Motion", [new DoubleTag("", 0), new DoubleTag("", 0), new DoubleTag("", 0)]), "Rotation" => new EnumTag("Rotation", [new FloatTag("", lcg_value() * 360), new FloatTag("", 0)])]);
         if ($this->hasCustomName()) {
             $nbt->CustomName = new StringTag("CustomName", $this->getCustomName());
         }
         $entity = Entity::createEntity($this->meta, $chunk, $nbt);
         if ($entity instanceof Entity) {
             if ($player->isSurvival()) {
                 --$this->count;
             }
             $entity->spawnToAll();
             return true;
         }
     }
     return false;
 }
开发者ID:PepbookPvP,项目名称:Genisys,代码行数:25,代码来源:SpawnEgg.php

示例6: __construct

 public function __construct(Level $level)
 {
     $name = $level->getFolderName() . " - ";
     $this->mobSpawn = new TimingsHandler("** " . $name . "mobSpawn");
     $this->doChunkUnload = new TimingsHandler("** " . $name . "doChunkUnload");
     $this->doTickPending = new TimingsHandler("** " . $name . "doTickPending");
     $this->doTickTiles = new TimingsHandler("** " . $name . "doTickTiles");
     $this->doVillages = new TimingsHandler("** " . $name . "doVillages");
     $this->doChunkMap = new TimingsHandler("** " . $name . "doChunkMap");
     $this->doSounds = new TimingsHandler("** " . $name . "doSounds");
     $this->doChunkGC = new TimingsHandler("** " . $name . "doChunkGC");
     $this->doPortalForcer = new TimingsHandler("** " . $name . "doPortalForcer");
     $this->entityTick = new TimingsHandler("** " . $name . "entityTick");
     $this->tileEntityTick = new TimingsHandler("** " . $name . "tileEntityTick");
     $this->tileEntityPending = new TimingsHandler("** " . $name . "tileEntityPending");
     $this->syncChunkSendTimer = new TimingsHandler("** " . $name . "syncChunkSend");
     $this->syncChunkSendPrepareTimer = new TimingsHandler("** " . $name . "syncChunkSendPrepare");
     $this->syncChunkLoadTimer = new TimingsHandler("** " . $name . "syncChunkLoad");
     $this->syncChunkLoadDataTimer = new TimingsHandler("** " . $name . "syncChunkLoad - Data");
     $this->syncChunkLoadStructuresTimer = new TimingsHandler("** " . $name . "syncChunkLoad - Structures");
     $this->syncChunkLoadEntitiesTimer = new TimingsHandler("** " . $name . "syncChunkLoad - Entities");
     $this->syncChunkLoadTileEntitiesTimer = new TimingsHandler("** " . $name . "syncChunkLoad - TileEntities");
     $this->syncChunkLoadTileTicksTimer = new TimingsHandler("** " . $name . "syncChunkLoad - TileTicks");
     $this->syncChunkLoadPostTimer = new TimingsHandler("** " . $name . "syncChunkLoad - Post");
     $this->tracker = new TimingsHandler($name . "tracker");
     $this->doTick = new TimingsHandler($name . "doTick");
     $this->tickEntities = new TimingsHandler($name . "tickEntities");
 }
开发者ID:xHFx,项目名称:ImagicalMine,代码行数:28,代码来源:LevelTimings.php

示例7: __construct

 public function __construct(Level $level, FullChunk $chunk)
 {
     $this->state = true;
     $this->levelId = $level->getId();
     $this->chunk = $chunk->toFastBinary();
     $this->chunkClass = get_class($chunk);
 }
开发者ID:wsj7178,项目名称:PocketMine-MP,代码行数:7,代码来源:GenerationTask.php

示例8: getShield

 /**
  * @param Level $level
  * @return Shield|null
  */
 public function getShield(Level $level)
 {
     if (isset($this->shields[strtolower($level->getName())])) {
         return $this->shields[strtolower($level->getName())];
     }
     return null;
 }
开发者ID:NameNoOne100,项目名称:PocketMine-Plugins,代码行数:11,代码来源:ShieldStorage.php

示例9: __construct

 public function __construct(Level $level, Generator $generator)
 {
     $this->generator = get_class($generator);
     $this->settings = $generator->getSettings();
     $this->seed = $level->getSeed();
     $this->levelId = $level->getId();
 }
开发者ID:TexusDark,项目名称:Ananas-MP,代码行数:7,代码来源:GeneratorRegisterTask.php

示例10: isRegistered

 public static function isRegistered(Level $level)
 {
     if (isset(self::$registeredLevel[$level->getName()])) {
         return true;
     }
     return false;
 }
开发者ID:iTXTech,项目名称:Genisys,代码行数:7,代码来源:WeatherManager.php

示例11: __construct

 public function __construct(Level $level, Generator $generator)
 {
     $this->generator = get_class($generator);
     $this->waterHeight = $generator->getWaterHeight();
     $this->settings = serialize($generator->getSettings());
     $this->seed = $level->getSeed();
     $this->levelId = $level->getId();
 }
开发者ID:iTXTech,项目名称:Genisys,代码行数:8,代码来源:GeneratorRegisterTask.php

示例12: __construct

 public function __construct(Level $level, $duration = 1200)
 {
     $this->level = $level;
     $this->weatherNow = self::SUNNY;
     $this->duration = $duration;
     $this->lastUpdate = $level->getServer()->getTick();
     $this->temporalVector = new Vector3(0, 0, 0);
 }
开发者ID:AnonymousProjects,项目名称:PocketMine-MP-Original,代码行数:8,代码来源:Weather.php

示例13: getWorldLoadedData

 public function getWorldLoadedData(Level $level)
 {
     $temp_config = $this->getUserData();
     if (!isset($temp_config["worlds"][$level->getName()])) {
         $temp_config["worlds"][$level->getName()] = array("group" => $this->plugin->getDefaultGroup()->getName(), "permissions" => array());
         $this->setUserData($temp_config);
     }
     return $this->getUserData();
 }
开发者ID:BoysElCrack,项目名称:xPermissions,代码行数:9,代码来源:User.php

示例14: getWorldLoadedData

 public function getWorldLoadedData(Level $level)
 {
     $temp_config = $this->plugin->getGroupsData();
     if (!isset($temp_config[$this->groupName]["worlds"][$level->getName()])) {
         $this->plugin->getLogger()->warning("Permissions not set in " . $this->groupName . " in level: " . $level->getName() . ".");
         $temp_config[$this->groupName]["worlds"][$level->getName()] = array("permissions" => array());
         $this->plugin->setGroupsData($temp_config);
     }
     return $this->plugin->getGroupsData();
 }
开发者ID:BoysElCrack,项目名称:xPermissions,代码行数:10,代码来源:Group.php

示例15: onUnload

 public function onUnload(ChunkUnloadEvent $event)
 {
     if ($event->getLevel() === $this->level) {
         foreach ($this->locs[Level::chunkHash($event->getChunk()->getX(), $event->getChunk()->getZ())] as $id => $spawn) {
             if (isset($this->spawns[$spawn->getId()])) {
                 $this->level->removeEntity($this->spawns[$spawn->getId()]);
             }
         }
     }
 }
开发者ID:legoboy0215,项目名称:LegionPE-Theta-Base,代码行数:10,代码来源:CustomEntityManager.php


注:本文中的pocketmine\level\Level类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。