本文整理汇总了PHP中pocketmine\math\AxisAlignedBB::setBounds方法的典型用法代码示例。如果您正苦于以下问题:PHP AxisAlignedBB::setBounds方法的具体用法?PHP AxisAlignedBB::setBounds怎么用?PHP AxisAlignedBB::setBounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\math\AxisAlignedBB
的用法示例。
在下文中一共展示了AxisAlignedBB::setBounds方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recalculateBoundingBox
protected function recalculateBoundingBox()
{
$f = 0.1875;
$damage = $this->getFullDamage();
$bb = new AxisAlignedBB($this->x, $this->y, $this->z, $this->x + 1, $this->y + 2, $this->z + 1);
$j = $damage & 0x3;
$isOpen = ($damage & 0x4) > 0;
$isRight = ($damage & 0x10) > 0;
if ($j === 0) {
if ($isOpen) {
if (!$isRight) {
$bb->setBounds($this->x, $this->y, $this->z, $this->x + 1, $this->y + 1, $this->z + $f);
} else {
$bb->setBounds($this->x, $this->y, $this->z + 1 - $f, $this->x + 1, $this->y + 1, $this->z + 1);
}
} else {
$bb->setBounds($this->x, $this->y, $this->z, $this->x + $f, $this->y + 1, $this->z + 1);
}
} elseif ($j === 1) {
if ($isOpen) {
if (!$isRight) {
$bb->setBounds($this->x + 1 - $f, $this->y, $this->z, $this->x + 1, $this->y + 1, $this->z + 1);
} else {
$bb->setBounds($this->x, $this->y, $this->z, $this->x + $f, $this->y + 1, $this->z + 1);
}
} else {
$bb->setBounds($this->x, $this->y, $this->z, $this->x + 1, $this->y + 1, $this->z + $f);
}
} elseif ($j === 2) {
if ($isOpen) {
if (!$isRight) {
$bb->setBounds($this->x, $this->y, $this->z + 1 - $f, $this->x + 1, $this->y + 1, $this->z + 1);
} else {
$bb->setBounds($this->x, $this->y, $this->z, $this->x + 1, $this->y + 1, $this->z + $f);
}
} else {
$bb->setBounds($this->x + 1 - $f, $this->y, $this->z, $this->x + 1, $this->y + 1, $this->z + 1);
}
} elseif ($j === 3) {
if ($isOpen) {
if (!$isRight) {
$bb->setBounds($this->x, $this->y, $this->z, $this->x + $f, $this->y + 1, $this->z + 1);
} else {
$bb->setBounds($this->x + 1 - $f, $this->y, $this->z, $this->x + 1, $this->y + 1, $this->z + 1);
}
} else {
$bb->setBounds($this->x, $this->y, $this->z + 1 - $f, $this->x + 1, $this->y + 1, $this->z + 1);
}
}
return $bb;
}
示例2: recalculateBoundingBox
protected function recalculateBoundingBox()
{
$damage = $this->getDamage();
$f = 0.1875;
if (($damage & 0x8) > 0) {
$bb = new AxisAlignedBB($this->x, $this->y + 1 - $f, $this->z, $this->x + 1, $this->y + 1, $this->z + 1);
} else {
$bb = new AxisAlignedBB($this->x, $this->y, $this->z, $this->x + 1, $this->y + $f, $this->z + 1);
}
if (($damage & 0x4) > 0) {
if (($damage & 0x3) === 0) {
$bb->setBounds($this->x, $this->y, $this->z + 1 - $f, $this->x + 1, $this->y + 1, $this->z + 1);
} elseif (($damage & 0x3) === 1) {
$bb->setBounds($this->x, $this->y, $this->z, $this->x + 1, $this->y + 1, $this->z + $f);
}
if (($damage & 0x3) === 2) {
$bb->setBounds($this->x + 1 - $f, $this->y, $this->z, $this->x + 1, $this->y + 1, $this->z + 1);
}
if (($damage & 0x3) === 3) {
$bb->setBounds($this->x, $this->y, $this->z, $this->x + $f, $this->y + 1, $this->z + 1);
}
}
return $bb;
}
示例3: recalculateBoundingBox
protected function recalculateBoundingBox()
{
$damage = $this->getDamage();
$f = 0.1875;
if (($damage & self::MASK_UPPER) > 0) {
$bb = new AxisAlignedBB($this->x, $this->y + 1 - $f, $this->z, $this->x + 1, $this->y + 1, $this->z + 1);
} else {
$bb = new AxisAlignedBB($this->x, $this->y, $this->z, $this->x + 1, $this->y + $f, $this->z + 1);
}
if (($damage & self::MASK_OPENED) > 0) {
if (($damage & 0x3) === self::MASK_SIDE_NORTH) {
$bb->setBounds($this->x, $this->y, $this->z + 1 - $f, $this->x + 1, $this->y + 1, $this->z + 1);
} elseif (($damage & 0x3) === self::MASK_SIDE_SOUTH) {
$bb->setBounds($this->x, $this->y, $this->z, $this->x + 1, $this->y + 1, $this->z + $f);
}
if (($damage & 0x3) === self::MASK_SIDE_WEST) {
$bb->setBounds($this->x + 1 - $f, $this->y, $this->z, $this->x + 1, $this->y + 1, $this->z + 1);
}
if (($damage & 0x3) === self::MASK_SIDE_EAST) {
$bb->setBounds($this->x, $this->y, $this->z, $this->x + $f, $this->y + 1, $this->z + 1);
}
}
return $bb;
}
示例4: setPosition
public function setPosition(Vector3 $pos)
{
if ($this->closed) {
return false;
}
if ($pos instanceof Position and $pos->level !== null and $pos->level !== $this->level) {
if ($this->switchLevel($pos->getLevel()) === false) {
return false;
}
}
$this->x = $pos->x;
$this->y = $pos->y;
$this->z = $pos->z;
$radius = $this->width / 2;
$this->boundingBox->setBounds($pos->x - $radius, $pos->y, $pos->z - $radius, $pos->x + $radius, $pos->y + $this->height, $pos->z + $radius);
$this->checkChunks();
return true;
}
示例5: setPosition
public function setPosition(Vector3 $pos)
{
if ($this->closed) {
return \false;
}
if ($pos instanceof Position and $pos->level !== \null and $pos->level !== $this->level) {
if ($this->switchLevel($pos->getLevel()) === \false) {
return \false;
}
}
$this->x = $pos->x;
$this->y = $pos->y;
$this->z = $pos->z;
$radius = $this->width / 2;
$this->boundingBox->setBounds($pos->x - $radius, $pos->y, $pos->z - $radius, $pos->x + $radius, $pos->y + $this->height, $pos->z + $radius);
if ($this->chunk === \null or $this->chunkX !== $this->x >> 4 and $this->chunkZ !== $this->z >> 4) {
if ($this->chunk !== \null) {
$this->chunk->removeEntity($this);
}
$this->level->loadChunk($this->x >> 4, $this->z >> 4);
$this->chunk = $this->level->getChunk($this->x >> 4, $this->z >> 4, \true);
$this->chunkX = $this->chunk->getX();
$this->chunkZ = $this->chunk->getZ();
if (!$this->justCreated) {
$newChunk = $this->level->getUsingChunk($this->x >> 4, $this->z >> 4);
foreach ($this->hasSpawned as $player) {
if (!isset($newChunk[$player->getId()])) {
$this->despawnFrom($player);
} else {
unset($newChunk[$player->getId()]);
}
}
foreach ($newChunk as $player) {
$this->spawnTo($player);
}
}
$this->chunk->addEntity($this);
}
return \true;
}
示例6: setPosition
public function setPosition(Vector3 $pos, $force = false)
{
if ($pos instanceof Position and $pos->getLevel() instanceof Level and $pos->getLevel() !== $this->getLevel()) {
if ($this->switchLevel($pos->getLevel()) === false) {
return false;
}
}
if (!$this->justCreated and $force !== true) {
$ev = new EntityMoveEvent($this, $pos);
$this->server->getPluginManager()->callEvent($ev);
if ($ev->isCancelled()) {
return false;
}
}
$this->x = $pos->x;
$this->y = $pos->y;
$this->z = $pos->z;
$radius = $this->width / 2;
$this->boundingBox->setBounds($pos->x - $radius, $pos->y + $this->ySize, $pos->z - $radius, $pos->x + $radius, $pos->y + $this->height + $this->ySize, $pos->z + $radius);
if ($this->chunk === null or $this->chunk->getX() !== $this->x >> 4 and $this->chunk->getZ() !== $this->z >> 4) {
if ($this->chunk instanceof FullChunk) {
$this->chunk->removeEntity($this);
}
$this->getLevel()->loadChunk($this->x >> 4, $this->z >> 4);
$this->chunk = $this->getLevel()->getChunkAt($this->x >> 4, $this->z >> 4);
if (!$this->justCreated) {
$newChunk = $this->getLevel()->getUsingChunk($this->x >> 4, $this->z >> 4);
foreach ($this->hasSpawned as $player) {
if (!isset($newChunk[$player->getID()])) {
$this->despawnFrom($player);
} else {
unset($newChunk[$player->getID()]);
}
}
foreach ($newChunk as $player) {
$this->spawnTo($player);
}
}
$this->chunk->addEntity($this);
}
return true;
}