本文整理汇总了PHP中pocketmine\block\Block::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Block::getName方法的具体用法?PHP Block::getName怎么用?PHP Block::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\block\Block
的用法示例。
在下文中一共展示了Block::getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
示例2: __construct
public function __construct(Block $block, $meta = 0, $count = 1)
{
$this->block = $block;
parent::__construct($block->getId(), $block->getDamage(), $count, $block->getName());
}