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