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


PHP Block::getDrops方法代码示例

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


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

示例1: 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

示例2: __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->getDrops($item) : [];
     foreach ($drops as $i) {
         $this->blockDrops[] = Item::get($i[0], $i[1], $i[2]);
     }
 }
开发者ID:kazuemon,项目名称:NIGHTMARE,代码行数:11,代码来源:BlockBreakEvent.php

示例3: __construct

 public function __construct(Player $player, Block $block, Item $item, int $xpAmount = 0, bool $instaBreak = false, bool $speed = false)
 {
     $this->block = $block;
     $this->item = $item;
     $this->player = $player;
     $this->instaBreak = (bool) $instaBreak;
     $this->xpAmount = (int) $xpAmount;
     $this->blocked = (bool) $speed;
     $drops = $player->isSurvival() ? $block->getDrops($item) : [];
     foreach ($drops as $i) {
         $this->blockDrops[] = Item::get($i[0], $i[1], $i[2]);
     }
 }
开发者ID:Cecil107,项目名称:PocketMine-0.13.0,代码行数:13,代码来源:BlockBreakEvent.php

示例4: treeDetect

 public function treeDetect(Block $block, Player $player, $isdrop = true)
 {
     if ($block->getId() == Block::LOG or $block->getId() == Block::LEAVE) {
         $drops = $block->getDrops($player->getInventory()->getItemInHand());
         if ($isdrop == true) {
             foreach ($drops as $drop) {
                 if ($drop[2] > 0) {
                     $player->getInventory()->addItem(Item::get(...$drop));
                 }
             }
         }
         $block->getLevel()->setBlock($block, new Air(), false, false);
     }
     $id = $block->getLevel()->getBlockIdAt($block->x, $block->y - 1, $block->z);
     if ($id == Block::LOG or $id == Block::LEAVE) {
         $this->treeDetect($block->getLevel()->getBlock($block->add(0, -1, 0)), $player);
     }
     $id = $block->getLevel()->getBlockIdAt($block->x, $block->y + 1, $block->z);
     if ($id == Block::LOG or $id == Block::LEAVE) {
         $this->treeDetect($block->getLevel()->getBlock($block->add(0, 1, 0)), $player);
     }
     $id = $block->getLevel()->getBlockIdAt($block->x, $block->y, $block->z - 1);
     if ($id == Block::LOG or $id == Block::LEAVE) {
         $this->treeDetect($block->getLevel()->getBlock($block->add(0, 0, -1)), $player);
     }
     $id = $block->getLevel()->getBlockIdAt($block->x, $block->y, $block->z + 1);
     if ($id == Block::LOG or $id == Block::LEAVE) {
         $this->treeDetect($block->getLevel()->getBlock($block->add(0, 0, 1)), $player);
     }
     $id = $block->getLevel()->getBlockIdAt($block->x - 1, $block->y, $block->z);
     if ($id == Block::LOG or $id == Block::LEAVE) {
         $this->treeDetect($block->getLevel()->getBlock($block->add(-1, 0, 0)), $player);
     }
     $id = $block->getLevel()->getBlockIdAt($block->x + 1, $block->y, $block->z);
     if ($id == Block::LOG or $id == Block::LEAVE) {
         $this->treeDetect($block->getLevel()->getBlock($block->add(1, 0, 0)), $player);
     }
 }
开发者ID:EmreTr1,项目名称:rtr,代码行数:38,代码来源:TreeChopper.php


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