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


PHP Block::getLevel方法代码示例

本文整理汇总了PHP中pocketmine\block\Block::getLevel方法的典型用法代码示例。如果您正苦于以下问题:PHP Block::getLevel方法的具体用法?PHP Block::getLevel怎么用?PHP Block::getLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pocketmine\block\Block的用法示例。


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

示例1: isFreezable

 /**
  * @param Block $block
  * @return bool
  */
 public function isFreezable(Block $block)
 {
     if (isset($this->configs[$ilevel = strtolower($block->getLevel()->getName())])) {
         return $this->configs[$ilevel]->exists($block->getId() . ":" . $block->getDamage(), true);
     }
     return false;
 }
开发者ID:NameNoOne100,项目名称:PocketMine-Plugins,代码行数:11,代码来源:BlockFreezer.php

示例2: sendBlockInfo

 /**
  * @param CommandSender $sender
  * @param Block $block
  */
 public function sendBlockInfo(CommandSender $sender, Block $block)
 {
     $sender->sendMessage("Name: " . $block->getName());
     $sender->sendMessage("XYZ: " . $block->getFloorX() . ":" . $block->getFloorY() . ":" . $block->getFloorZ());
     $sender->sendMessage("Level: " . $block->getLevel()->getName());
     $sender->sendMessage("Block-id: " . $block->getId() . ":" . $block->getDamage());
     $sender->sendMessage("Hardness: " . $block->getHardness());
     $sender->sendMessage("Resistance: " . $block->getResistance());
     $sender->sendMessage("Tool-type: " . $block->getToolType());
     $sender->sendMessage("Friction: " . $block->getFrictionFactor());
     $sender->sendMessage("Light-level: " . $block->getLightLevel());
     //$sender->sendMessage("Is-placeable: ".($block->canBePlaced() ? TextFormat::GREEN."yes" : TextFormat::RED."no"));
     $sender->sendMessage("Is-replaceable: " . ($block->canBeReplaced() ? TextFormat::GREEN . "yes" : TextFormat::RED . "no"));
     $sender->sendMessage("Is-transparent: " . ($block->isTransparent() ? TextFormat::GREEN . "yes" : TextFormat::RED . "no"));
     $sender->sendMessage("Is-solid: " . ($block->isSolid() ? TextFormat::GREEN . "yes" : TextFormat::RED . "no"));
     //$sender->sendMessage("Is-flowable: ".($block->canBeFlowedInto() ? TextFormat::GREEN."yes" : TextFormat::RED."no"));
     //$sender->sendMessage("Is-activateable: ".($block->canBeActivated() ? TextFormat::GREEN."yes" : TextFormat::RED."no"));
     $sender->sendMessage("Is-passable: " . ($block->canPassThrough() ? TextFormat::GREEN . "yes" : TextFormat::RED . "no"));
     $dropCount = 0;
     $dropNames = "";
     foreach ($block->getDrops() as $drop) {
         $dropNames .= $drop->getName() . ", ";
         $dropCount++;
     }
     $sender->sendMessage("Drops (" . $dropCount . "): " . substr($dropNames, 0, -2));
 }
开发者ID:happyexceed,项目名称:PocketMine-Plugins-1,代码行数:30,代码来源:InfoFetcher.php

示例3: isBlockSpecified

 /**
  * @param Block $block
  * @return bool
  */
 private function isBlockSpecified(Block $block)
 {
     $key = array_change_key_case($this->getConfig()->getNested("level." . $block->getLevel()->getName()), CASE_LOWER);
     if (is_array($key)) {
         return in_array($block->getId() . ":" . $block->getDamage(), $key);
     }
 }
开发者ID:pomee4,项目名称:PocketMine-Plugins,代码行数:11,代码来源:BlockFreezer.php

示例4: isBlockSpecified

 /**
  * @param Block $block
  * @return bool
  */
 public function isBlockSpecified(Block $block)
 {
     $key = array_change_key_case($this->getConfig()->get("level"), CASE_LOWER);
     $levelKey = $key[strtolower($block->getLevel()->getName())];
     if (is_array($levelKey)) {
         return in_array($block->getId() . ":" . $block->getDamage(), $levelKey);
     }
 }
开发者ID:happyexceed,项目名称:PocketMine-Plugins-1,代码行数:12,代码来源:BlockFreezer.php

示例5: __construct

 public function __construct(Player $player, Block $block, Item $item, $instaBreak = false)
 {
     $this->block = $block;
     $this->item = $item;
     $this->player = $player;
     $this->instaBreak = (bool) $instaBreak;
     $drops = $player->isSurvival() ? $block->getLevel()->getGameRule("doTileDrops") ? $block->getDrops($item) : [] : [];
     foreach ($drops as $i) {
         $this->blockDrops[] = Item::get($i[0], $i[1], $i[2]);
     }
 }
开发者ID:ClearSkyTeam,项目名称:ClearSky,代码行数:11,代码来源:BlockBreakEvent.php

示例6: addEntry

 /**
  * @param Block $sourceBlock a Block with the absolute X, Y and Z from the original level
  */
 public function addEntry(Block $sourceBlock)
 {
     if (!$this->isWritable) {
         throw new \InvalidStateException("This clip is not writable");
     }
     if (!$sourceBlock->isValid()) {
         throw new \InvalidArgumentException("Source block must contain a level and absolute coords");
     }
     if ($sourceBlock->getLevel()->getName() !== $this->levelName) {
         throw new \InvalidStateException("Block is not from the level clip is being written in");
     }
     $delta = $sourceBlock->subtract($this->anchor);
     $insert = Block::get($sourceBlock->getId(), $sourceBlock->getDamage(), Position::fromObject($delta->subtract($this->anchor)));
     $this->entries[] = $insert;
 }
开发者ID:Ad5001,项目名称:WorldEditArt,代码行数:18,代码来源:Clip.php

示例7: getDispenserId

 public function getDispenserId(Block $block)
 {
     return $block->getX() . ":" . $block->getY() . ":" . $block->getZ() . ":" . $block->getLevel()->getFolderName();
 }
开发者ID:sJimin,项目名称:EconomyPotionShop,代码行数:4,代码来源:Dispenser.php

示例8: getTreetop

 /**
  * @param Block $stump
  * @return int
  */
 public function getTreetop(Block $stump)
 {
     $level = $stump->getLevel();
     $floor = $level->getBlock($stump->getSide(0));
     if (!in_array($floor->getId(), self::FLOORS)) {
         return -1;
     }
     $found = null;
     $maxHeight = $this->getConfig()->get("maxWorldHeight") - $stump->getY();
     for ($height = 0; $height < $maxHeight; $height++) {
         $block = $level->getBlock($stump->add(0, $height, 0));
         if (in_array($block->getId(), self::WOODS)) {
             if ($found === null) {
                 $found = [$block->getId(), $block->getDamage()];
             } elseif ($found[0] !== $block->getId() or $found[1] !== $block->getDamage()) {
                 return -1;
             }
         } elseif ($found !== null and in_array($block->getId(), self::LEAVES)) {
             return $height;
         } else {
             return -1;
         }
     }
     return -1;
 }
开发者ID:nesgohood,项目名称:PMMP-Plugins,代码行数:29,代码来源:ChopTree.php

示例9: rotateBlockByOne

 private static function rotateBlockByOne(Block $block)
 {
     return Block::get($block->getID(), $block->getDamage(), new Position($block->getZ(), $block->getY(), -$block->getX(), $block->getLevel()));
 }
开发者ID:barnseyminesuk,项目名称:Small-ZC-Plugins,代码行数:4,代码来源:WorldEditArt.php

示例10: addChest

 /**
  * Adds a resettable chest
  * @param Block $chest
  */
 public function addChest(Block $chest)
 {
     $chests = $this->config->chests;
     $chests[count($this->chests)] = ['id' => $chest->getId(), 'x' => $chest->getX(), 'y' => $chest->getY(), 'z' => $chest->getZ(), 'level' => $chest->getLevel()->getId()];
     $this->config->set("chests", $chests);
     $this->config->save();
     array_push($this->chests, $chest);
 }
开发者ID:TuffDev,项目名称:HungerGames,代码行数:12,代码来源:ArenaManager.php

示例11: destroyTrunk

 private function destroyTrunk(Block $bl)
 {
     $damage = 0;
     if ($bl->getId() != Block::WOOD) {
         return $damage;
     }
     $down = $bl->getSide(Vector3::SIDE_DOWN);
     if ($down->getId() == Block::WOOD) {
         return $damage;
     }
     $l = $bl->getLevel();
     for ($y = $bl->getY() + 1; $y < 128; ++$y) {
         $x = $bl->getX();
         $z = $bl->getZ();
         $bl = $l->getBlock(new Vector3($x, $y, $z));
         if ($bl->getId() != Block::WOOD) {
             break;
         }
         ++$damage;
         $l->dropItem($bl, new ItemBlock($bl));
         $l->setBlockIdAt($x, $y, $z, 0);
         $l->setBlockDataAt($x, $y, $z, 0);
     }
     return $damage;
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:25,代码来源:TreeCapitator.php

示例12: replaceBlock

 public function replaceBlock($startX, $startY, $startZ, $endX, $endY, $endZ, Block $block, Block $target, Player $player = null)
 {
     $count = 0;
     $x = $startX;
     $y = $startY;
     $z = $startZ;
     if (is_array($y)) {
         $startY = $y[1];
         $y = $y[0];
     }
     if (is_array($z)) {
         $startZ = $z[1];
         $z = $z[0];
     }
     while (true) {
         if ($count < $this->getData("limit-block", 130)) {
             $chunk = $block->getLevel()->getChunk($x >> 4, $z >> 4, true);
             if ($chunk !== null) {
                 $id = $chunk->getBlockId($x & 0xf, $y & 0x7f, $z & 0xf);
                 $meta = $chunk->getBlockData($x & 0xf, $y & 0x7f, $z & 0xf);
                 if ($id === $block->getId() && $meta === $block->getDamage()) {
                     ++$count;
                     $this->saveUndo($block, $pos = new Vector3($x, $y, $z));
                     $this->set($target, $pos);
                 }
             }
             if ($z < $endZ) {
                 $z++;
             } else {
                 $z = $startZ;
                 if ($y < $endY) {
                     $y++;
                 } else {
                     $y = $startY;
                     if ($x < $endX) {
                         $x++;
                     } else {
                         break;
                     }
                 }
             }
         } else {
             self::core()->getScheduler()->scheduleDelayedTask(new WorldEditorTask([$this, "replaceBlock"], [$x, [$y, $startY], [$z, $startZ], $endX, $endY, $endZ, $block, $target, $player], $this), 1);
             return;
         }
     }
     if ($player !== null) {
         $player->sendMessage("[WorldEditor]모든 블럭을 변경했어요");
     }
     if ($this->getData("debug", false)) {
         $name = $player === null ? "" : "{$player->getName()}님이 ";
         self::core()->getLogger()->info("[WorldEditor]{$name}블럭변경을 끝냈어요");
     }
 }
开发者ID:TDMGamingMC,项目名称:WorldEditor,代码行数:54,代码来源:WorldEditor.php

示例13: removeRocketPad

 /** 
  * @param Block $block 
  */
 public function removeRocketPad(Block $block)
 {
     $this->pads->remove($block->getFloorX() . ":" . $block->getFloorY() . ":" . $block->getFloorZ() . ":" . strtolower($block->getLevel()->getName()));
     $this->pads->save();
 }
开发者ID:Evarettedavis,项目名称:PocketMine-Plugins,代码行数:8,代码来源:RocketPads.php


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