本文整理汇总了PHP中pocketmine\math\Vector3::getX方法的典型用法代码示例。如果您正苦于以下问题:PHP Vector3::getX方法的具体用法?PHP Vector3::getX怎么用?PHP Vector3::getX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\math\Vector3
的用法示例。
在下文中一共展示了Vector3::getX方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ifjump
/**
* @param Level $level
* @param Vector3 $v3
* @param bool $hate
* @param bool $reason
* @return bool|float|string
* 判断某坐标是否可以行走
* 并给出原因
*/
public function ifjump(Level $level, Vector3 $v3, $hate = false, $reason = false)
{
//boybook Y轴算法核心函数
$x = floor($v3->getX());
$y = floor($v3->getY());
$z = floor($v3->getZ());
//echo ($y." ");
if ($this->whatBlock($level, new Vector3($x, $y, $z)) == "air") {
//echo "前方空气 ";
if ($this->whatBlock($level, new Vector3($x, $y - 1, $z)) == "block" or new Vector3($x, $y - 1, $z) == "climb") {
//方块
//echo "考虑向前 ";
if ($this->whatBlock($level, new Vector3($x, $y + 1, $z)) == "block" or $this->whatBlock($level, new Vector3($x, $y + 1, $z)) == "half" or $this->whatBlock($level, new Vector3($x, $y + 1, $z)) == "high") {
//上方一格被堵住了
//echo "上方卡住 \n";
if ($reason) {
return 'up!';
}
return false;
//上方卡住
} else {
//echo "GO向前走 \n";
if ($reason) {
return 'GO';
}
return $y;
//向前走
}
} elseif ($this->whatBlock($level, new Vector3($x, $y - 1, $z)) == "half") {
//半砖
//echo "下到半砖 \n";
if ($reason) {
return 'half';
}
return $y - 0.5;
//向下跳0.5格
} elseif ($this->whatBlock($level, new Vector3($x, $y - 1, $z)) == "lava") {
//岩浆
//echo "前方岩浆 \n";
if ($reason) {
return 'lava';
}
return false;
//前方岩浆
} elseif ($this->whatBlock($level, new Vector3($x, $y - 1, $z)) == "air") {
//空气
//echo "考虑向下跳 ";
if ($this->whatBlock($level, new Vector3($x, $y - 2, $z)) == "block") {
//echo "GO向下跳 \n";
if ($reason) {
return 'down';
}
return $y - 1;
//向下跳
} else {
//前方悬崖
//echo "前方悬崖 \n";
if ($reason) {
return 'fall';
}
/* if ($hate === false) {
return false;
}
else {
return $y-1; //向下跳
}*/
}
}
} elseif ($this->whatBlock($level, new Vector3($x, $y, $z)) == "half") {
//半砖
//echo "前方半砖 \n";
if ($this->whatBlock($level, new Vector3($x, $y + 1, $z)) == "block" or $this->whatBlock($level, new Vector3($x, $y + 1, $z)) == "half" or $this->whatBlock($level, new Vector3($x, $y + 1, $z)) == "high") {
//上方一格被堵住了
//return false; //上方卡住
} else {
if ($reason) {
return 'halfGO';
}
return $y + 0.5;
}
} elseif ($this->whatBlock($level, new Vector3($x, $y, $z)) == "lava") {
//岩浆
//echo "前方岩浆 \n";
if ($reason) {
return 'lava';
}
return false;
} elseif ($this->whatBlock($level, new Vector3($x, $y, $z)) == "high") {
//1.5格高方块
//echo "前方栅栏 \n";
if ($reason) {
//.........这里部分代码省略.........
示例2: onPlayerInteract
public function onPlayerInteract(PlayerInteractEvent $e)
{
// Implement the CompassTP thingie...
$pl = $e->getPlayer();
if (!$pl->hasPermission("toybox.compasstp")) {
return;
}
$hand = $pl->getInventory()->getItemInHand();
if ($hand->getID() != $this->item) {
return;
}
$pos = $pl->getPosition()->add(0, $pl->getEyeHeight(), 0);
$start = new Vector3($pos->getX(), $pos->getY(), $pos->getZ());
$lv = $pl->getLevel();
for ($start = new Vector3($pos->getX(), $pos->getY(), $pos->getZ()); $start->distance($pos) < 120; $pos = $pos->add($pl->getDirectionVector())) {
$block = $lv->getBlock($pos->floor());
if ($block->getId() != 0) {
break;
}
}
if ($block->getId() == 0) {
$pl->sendMessage(mc::_("Can not teleport to the void!"));
return;
}
$pos = $pos->subtract($pl->getDirectionVector());
$dist = $start->distance($pos);
if ($dist < 2.8) {
$pl->sendMessage(mc::_("Not teleporting..."));
$pl->sendMessage(mc::_("You could easily walk there!"));
return;
}
//echo "Block: ".$block->getName()." (".$block->getId().")\n";
//print_r($pos);
//echo "Distance: ".$start->distance($pos)."\n";
$pl->sendMessage(mc::_("Teleporting... %1%", intval($dist)));
$pos = $pos->add(0, 1, 0);
/*$cb = new CallbackTask([$this,"delayedTP"],[$pl->getName(),
$pos->getX(),
$pos->getY(),
$pos->getZ()]);
$this->owner->getServer()->getScheduler()->scheduleDelayedTask($cb,20);
//$pl->teleport($pos);
return;*/
$m = 5.0;
for ($f = 1.0; $f <= $m; $f++) {
$ticks = intval($f) * 5;
$x = ($pos->getX() - $start->getX()) * $f / $m + $start->getX();
$y = ($pos->getY() - $start->getY()) * $f / $m + $start->getY();
$z = ($pos->getZ() - $start->getZ()) * $f / $m + $start->getZ();
$c = new PluginCallbackTask($this->owner, [$this, "delayedTP"], [$pl->getName(), $x, $y, $z]);
$this->owner->getServer()->getScheduler()->scheduleDelayedTask($c, $ticks);
}
}
示例3: createEffectArrow
public static function createEffectArrow(Player $player, Vector3 $position, Vector3 $speed, $yaw, $pitch, $r, $g, $b, $critical)
{
$nbtTag = new Compound("", ["Pos" => new Enum("Pos", [new Double("", $position->getX()), new Double("", $position->getY()), new Double("", $position->getZ())]), "Rotation" => new Enum("Rotation", [new Float("", $yaw), new Float("", $pitch)])]);
$arrow = new EffectArrow($player->chunk, $nbtTag, $r, $g, $b, $player, $critical);
$arrow->setMotion($speed);
$launchEvent = new ProjectileLaunchEvent($arrow);
Server::getInstance()->getPluginManager()->callEvent($launchEvent);
if ($launchEvent->isCancelled()) {
$arrow->kill();
return null;
} else {
return $arrow;
}
}
示例4: __construct
public function __construct(Level $level, Vector3 $pos)
{
if (!($pos instanceof Vector3 && $level instanceof Level)) {
echo "this is not Floor!\n";
}
$this->vector = $pos;
$this->x = $pos->getX();
$this->y = $pos->getY();
$this->z = $pos->getZ();
$this->level = $level;
$this->block = $level->getBlock($pos);
$this->id = $this->block->getId();
$this->data = $this->block->getDamage();
$this->height = 128;
//$this->level->getHeightMap($this->x, $this->z);
echo "max height: {$this->height}\n";
if (!($this->isElevatorBlock($this->block) || $this->isExtensionFloorBlock($this->block))) {
echo "THIS IS NOT FLOOR!\n";
}
}
示例5: isInside
public function isInside(Vector3 $v)
{
$out = true;
$out = ($out and $this->baked0->getFloorX() <= $v->getX() and $v->getX() <= $this->baked1->getFloorX());
$out = ($out and $this->baked0->getFloorY() <= $v->getY() and $v->getY() <= $this->baked1->getFloorY());
$out = ($out and $this->baked0->getFloorZ() <= $v->getZ() and $v->getZ() <= $this->baked1->getFloorZ());
if ($v instanceof Position) {
$out = ($out and $this->baked0->getLevel()->getName() === $v->getLevel()->getName());
}
return $out;
}
示例6: getTextPacket
public function getTextPacket(Vector3 $pos, $text)
{
$eid = ++Entity::$entityCount;
return "{$eid};" . $pos->getX() . ";" . $pos->getY() . ";" . $pos->getZ() . ";{$text}";
}
示例7: SkeletonRandomWalkCalc
public function SkeletonRandomWalkCalc()
{
$this->dif = $this->plugin->getServer()->getDifficulty();
//$this->getLogger()->info("僵尸数量:".count($this->plugin->Skeleton));
foreach ($this->plugin->getServer()->getLevels() as $level) {
foreach ($level->getEntities() as $zo) {
if ($zo instanceof Skeleton) {
if ($this->plugin->willMove($zo)) {
if (!isset($this->plugin->Skeleton[$zo->getId()])) {
$this->plugin->Skeleton[$zo->getId()] = array('ID' => $zo->getId(), 'IsChasing' => false, 'motionx' => 0, 'motiony' => 0, 'motionz' => 0, 'hurt' => 10, 'time' => 10, 'x' => 0, 'y' => 0, 'z' => 0, 'oldv3' => $zo->getLocation(), 'yup' => 20, 'up' => 0, 'yaw' => $zo->yaw, 'pitch' => 0, 'level' => $zo->getLevel()->getName(), 'xxx' => 0, 'zzz' => 0, 'gotimer' => 10, 'swim' => 0, 'jump' => 0.01, 'canjump' => true, 'drop' => false, 'canAttack' => 0, 'shoot' => 20, 'knockBack' => false);
$zom =& $this->plugin->Skeleton[$zo->getId()];
$zom['x'] = $zo->getX();
$zom['y'] = $zo->getY();
$zom['z'] = $zo->getZ();
}
$zom =& $this->plugin->Skeleton[$zo->getId()];
if ($zom['IsChasing'] === false) {
//自由行走模式
if ($zom['gotimer'] == 0 or $zom['gotimer'] == 10) {
//限制转动幅度
$newmx = mt_rand(-5, 5) / 10;
while (abs($newmx - $zom['motionx']) >= 0.7) {
$newmx = mt_rand(-5, 5) / 10;
}
$zom['motionx'] = $newmx;
$newmz = mt_rand(-5, 5) / 10;
while (abs($newmz - $zom['motionz']) >= 0.7) {
$newmz = mt_rand(-5, 5) / 10;
}
$zom['motionz'] = $newmz;
} elseif ($zom['gotimer'] >= 20 and $zom['gotimer'] <= 24) {
$zom['motionx'] = 0;
$zom['motionz'] = 0;
//僵尸停止
}
$zom['gotimer'] += 0.5;
if ($zom['gotimer'] >= 22) {
$zom['gotimer'] = 0;
}
//重置走路计时器
//$zom['motionx'] = mt_rand(-10,10)/10;
//$zom['motionz'] = mt_rand(-10,10)/10;
$zom['yup'] = 0;
$zom['up'] = 0;
//boybook的y轴判断法
//$width = $this->width;
$pos = new Vector3($zom['x'] + $zom['motionx'], floor($zo->getY()) + 1, $zom['z'] + $zom['motionz']);
//目标坐标
$zy = $this->plugin->ifjump($zo->getLevel(), $pos);
if ($zy === false) {
//前方不可前进
$pos2 = new Vector3($zom['x'], $zom['y'], $zom['z']);
//目标坐标
if ($this->plugin->ifjump($zo->getLevel(), $pos2) === false) {
//原坐标依然是悬空
$pos2 = new Vector3($zom['x'], $zom['y'] - 1, $zom['z']);
//下降
$zom['up'] = 1;
$zom['yup'] = 0;
} else {
$zom['motionx'] = -$zom['motionx'];
$zom['motionz'] = -$zom['motionz'];
//转向180度,向身后走
$zom['up'] = 0;
}
} else {
$pos2 = new Vector3($zom['x'] + $zom['motionx'], $zy - 1, $zom['z'] + $zom['motionz']);
//目标坐标
if ($pos2->y - $zom['y'] < 0) {
$zom['up'] = 1;
} else {
$zom['up'] = 0;
}
}
if ($zom['motionx'] == 0 and $zom['motionz'] == 0) {
//僵尸停止
} else {
//转向计算
$yaw = $this->plugin->getyaw($zom['motionx'], $zom['motionz']);
//$zo->setRotation($yaw,0);
$zom['yaw'] = $yaw;
$zom['pitch'] = 0;
}
//更新僵尸坐标
if (!$zom['knockBack']) {
$zom['x'] = $pos2->getX();
$zom['z'] = $pos2->getZ();
$zom['y'] = $pos2->getY();
}
$zom['motiony'] = $pos2->getY() - $zo->getY();
//echo($zo->getY()."\n");
//var_dump($pos2);
//var_dump($zom['motiony']);
$zo->setPosition($pos2);
//echo "SetPosition \n";
}
}
}
}
}
//.........这里部分代码省略.........
示例8: randVector
protected static function randVector(Vector3 $center)
{
return new Vector3(self::randy($center->getX(), 0.5, -0.25), self::randy($center->getY(), 2, 0), self::randy($center->getZ(), 0.5, -0.25));
}
示例9: SpecialMobRandomWalkCalc
//.........这里部分代码省略.........
if ($zom['IsChasing'] == "0") {
//自由行走模式
if ($zom['gotimer'] == 0 or $zom['gotimer'] == 10) {
//限制转动幅度
$newmx = mt_rand(-5, 5) / 10;
while (abs($newmx - $zom['motionx']) >= 0.7) {
$newmx = mt_rand(-5, 5) / 10;
}
$zom['motionx'] = $newmx;
$newmz = mt_rand(-5, 5) / 10;
while (abs($newmz - $zom['motionz']) >= 0.7) {
$newmz = mt_rand(-5, 5) / 10;
}
$zom['motionz'] = $newmz;
} elseif ($zom['gotimer'] >= 20 and $zom['gotimer'] <= 24) {
$zom['motionx'] = 0;
$zom['motionz'] = 0;
//僵尸停止
}
$zom['gotimer'] += 0.5;
if ($zom['gotimer'] >= 22) {
$zom['gotimer'] = 0;
}
//重置走路计时器
//$zom['motionx'] = mt_rand(-10,10)/10;
//$zom['motionz'] = mt_rand(-10,10)/10;
$zom['yup'] = 0;
$zom['up'] = 0;
//boybook的y轴判断法
//$width = $this->width;
$pos = new Vector3($zom['x'] + $zom['motionx'], floor($zo->getY()) + 1, $zom['z'] + $zom['motionz']);
//目标坐标
$zy = $this->ifjump($zo->getLevel(), $pos);
if ($zy === false) {
//前方不可前进
$pos2 = new Vector3($zom['x'], $zom['y'], $zom['z']);
//目标坐标
if ($this->ifjump($zo->getLevel(), $pos2) === false) {
//原坐标依然是悬空
$pos2 = new Vector3($zom['x'], $zom['y'] - 1, $zom['z']);
//下降
$zom['up'] = 1;
$zom['yup'] = 0;
} else {
$zom['motionx'] = -$zom['motionx'];
$zom['motionz'] = -$zom['motionz'];
//转向180度,向身后走
$zom['up'] = 0;
}
} else {
$pos2 = new Vector3($zom['x'] + $zom['motionx'], $zy - 1, $zom['z'] + $zom['motionz']);
//目标坐标
if ($pos2->y - $zom['y'] < 0) {
$zom['up'] = 1;
} else {
$zom['up'] = 0;
}
}
if ($zom['motionx'] == 0 and $zom['motionz'] == 0) {
//僵尸停止
} else {
//转向计算
$yaw = $this->getyaw($zom['motionx'], $zom['motionz']);
//$zo->setRotation($yaw,0);
$zom['yaw'] = $yaw;
$zom['pitch'] = 0;
}
//更新僵尸坐标
$zom['x'] = $pos2->getX();
$zom['z'] = $pos2->getZ();
$zom['y'] = $pos2->getY();
$zom['motiony'] = $pos2->getY() - $zo->getY();
//echo($zo->getY()."\n");
//var_dump($pos2);
//var_dump($zom['motiony']);
$zo->setPosition($pos2);
$animal = $zom;
foreach ($this->getServer()->getOnlinePlayers() as $pl) {
$pk2 = new RemoveEntityPacket();
$pk2->eid = $animal['ID'];
$pk3 = new AddEntityPacket();
$pk3->eid = $animal['ID'];
$pk3->type = $animal['type'];
$pk3->x = $animal['x'];
$pk3->y = $animal['y'];
$pk3->z = $animal['z'];
$pk3->pitch = $animal['pitch'];
$pk3->yaw = $animal['yaw'];
$pk3->metadata = [];
$pl->dataPacket($pk2);
$pl->dataPacket($pk3);
}
//echo "SetPosition \n";
}
}
}
}
}
}
}
示例10: onRun
public function onRun($currentTick)
{
foreach ($this->getOwner()->getServer()->getOnlinePlayers() as $p) {
$name = strtolower($p->getName());
$welt = strtolower($p->getLevel()->getName());
if ($welt == $this->getOwner()->lobbyname) {
$pos1 = explode(",", $this->getOwner()->lobbyareapos1);
$pos2 = explode(",", $this->getOwner()->lobbyareapos2);
}
if ($welt == $this->getOwner()->arena1name) {
$pos1 = explode(",", $this->getOwner()->arena1areapos1);
$pos2 = explode(",", $this->getOwner()->arena1areapos2);
}
if ($welt == $this->getOwner()->arena2name) {
$pos1 = explode(",", $this->getOwner()->arena2areapos1);
$pos2 = explode(",", $this->getOwner()->arena2areapos2);
}
if ($welt == $this->getOwner()->arena3name) {
$pos1 = explode(",", $this->getOwner()->arena3areapos1);
$pos2 = explode(",", $this->getOwner()->arena3areapos2);
}
if ($welt == $this->getOwner()->arena4name) {
$pos1 = explode(",", $this->getOwner()->arena4areapos1);
$pos2 = explode(",", $this->getOwner()->arena4areapos2);
}
if ($welt == $this->getOwner()->arena5name) {
$pos1 = explode(",", $this->getOwner()->arena5areapos1);
$pos2 = explode(",", $this->getOwner()->arena5areapos2);
}
$ppos = new Vector3($p->x, $p->y, $p->z);
if (min($pos1[0], $pos2[0]) <= $ppos->getX() && max($pos1[0], $pos2[0]) >= $ppos->getX() && min($pos1[1], $pos2[1]) <= $ppos->getY() && max($pos1[1], $pos2[1]) >= $ppos->getY() && min($pos1[2], $pos2[2]) <= $ppos->getZ() && max($pos1[2], $pos2[2]) >= $ppos->getZ()) {
} else {
$knockback = 3.0;
if ($pos1[0] >= $pos2[0]) {
$minX = $pos2[0];
$maxX = $pos1[0];
} else {
$minX = $pos1[0];
$maxX = $pos2[0];
}
if ($pos1[2] >= $pos2[2]) {
$minZ = $pos2[2];
$maxZ = $pos1[2];
} else {
$minZ = $pos1[2];
$maxZ = $pos2[2];
}
$x = $p->getX();
$z = $p->getZ();
$y = $p->getY();
if ($x <= $minX) {
$x = $minX + $knockback;
} elseif ($x >= $maxX) {
$x = $maxX - $knockback;
}
if ($z <= $minZ) {
$z = $minZ + $knockback;
} elseif ($z >= $maxZ) {
$z = $maxZ - $knockback;
}
$p->teleport(new Vector3($x, $y, $z));
$p->sendMessage(MT::RED . 'End of World/Ende der Welt');
}
}
}
示例11: isInside
public function isInside(Vector3 $v)
{
$out = true;
switch ($this->axis) {
case self::X:
$out = ($out and $this->base->getX() <= $v->getX() and $v->getX() <= $this->base->getX() + $this->height);
$out = ($out and $v->distance(new Vector3($v->getX(), $this->base->getY(), $this->base->getZ())) <= $this->radius);
break;
case self::Y:
$out = ($out and $this->base->getY() <= $v->getY() and $v->getY() <= $this->base->getY() + $this->height);
$out = ($out and $v->distance(new Vector3($this->base->getX(), $v->getY(), $this->base->getZ())) <= $this->radius);
break;
case self::Z:
$out = ($out and $this->base->getZ() <= $v->getZ() and $v->getZ() <= $this->base->getZ() + $this->height);
$out = ($out and $v->distance(new Vector3($this->base->getX(), $this->base->getY(), $v->getZ())) <= $this->radius);
break;
}
if ($v instanceof Position) {
$out = ($out and $v->getLevel()->getName() === $this->base->getLevel()->getName());
}
return $out;
}
示例12: canPVP
public function canPVP(Vector3 $pp, Vector3 $p1, Vector3 $p2, $lv1, $lv2)
{
/*var_dump(min($p1->getX(),$p2->getX()) <= $pp->getX());
var_dump(max($p1->getX(),$p2->getX()) >= $pp->getX());
var_dump(min($p1->getY(),$p2->getY()) <= $pp->getY());
var_dump(max($p1->getY(),$p2->getY()) >= $pp->getY());//returns false
var_dump(max($p1->getY(),$p2->getY()).">=".$pp->getY());
var_dump(min($p1->getZ(),$p2->getZ()) <= $pp->getZ());
var_dump(max($p1->getZ(),$p2->getZ()) >= $pp->getZ());
var_dump($lv1 === $lv2);*/
return min($p1->getX(), $p2->getX()) <= $pp->getX() && max($p1->getX(), $p2->getX()) >= $pp->getX() && min($p1->getY(), $p2->getY()) <= $pp->getY() && max($p1->getY(), $p2->getY()) >= $pp->getY() && min($p1->getZ(), $p2->getZ()) <= $pp->getZ() && max($p1->getZ(), $p2->getZ()) >= $pp->getZ() && $lv1 === $lv2;
}
示例13: place
public function place()
{
for ($x = $this->start->getFloorX(); $x < $this->end->getFloorX(); $x++) {
$xOffset = ($this->chunk->getX() + $x + 0.5 - $this->target->getX()) / $this->horizontalSize;
for ($z = $this->start->getFloorZ(); $z < $this->end->getFloorZ(); $z++) {
$zOffset = ($this->chunk->getZ() + $z + 0.5 - $this->target->getZ()) / $this->horizontalSize;
if ($xOffset * $xOffset + $zOffset * $zOffset >= 1) {
continue;
}
for ($y = $this->end->getFloorY() - 1; $y >= $this->start->getFloorY(); $y--) {
$yOffset = ($y + 0.5 - $this->target->getY()) / $this->verticalSize;
if ($yOffset > -0.7 and $xOffset * $xOffset + $yOffset * $yOffset + $zOffset * $zOffset < 1) {
$xx = $this->chunk->getX() + $x;
$zz = $this->chunk->getZ() + $z;
$blockId = $this->level->getBlockIdAt($xx, $y, $zz);
if ($blockId == Block::STONE or $blockId == Block::DIRT or $blockId == Block::GRASS) {
if ($y < 10) {
$this->level->setBlockIdAt($xx, $y, $zz, Block::STILL_LAVA);
} else {
if ($blockId == Block::GRASS and $this->level->getBlockIdAt($xx, $y - 1, $zz) == Block::DIRT) {
$this->level->setBlockIdAt($xx, $y - 1, $zz, Block::GRASS);
}
$this->level->setBlockIdAt($xx, $y, $zz, Block::AIR);
}
}
}
}
}
}
}
示例14: calculateVector
public function calculateVector(Vector3 $vector, Position $position, $maxStep, $size, $yOffset)
{
$motionX = $vector->getX();
$motionY = $vector->getY();
$motionZ = $vector->getZ();
$x = $position->getX();
$y = $position->getY() + $yOffset;
$z = $position->getZ();
$return = ["stack" => array(), "final" => null];
$return["stack"] = array();
for ($i = 0; $i < $maxStep; $i++) {
$x += $motionX;
$y += $motionY;
$z += $motionZ;
$aabb = new AxisAlignedBB($x - $size, $y - $size, $z - $size, $x + $size, $y + $size, $z + $size);
$currentPos = new Position($x, $y, $z, $position->getLevel());
array_push($return["stack"], $currentPos);
$collidingEntities = $position->getLevel()->getCollidingEntities($aabb);
foreach ($collidingEntities as $entity) {
if ($entity instanceof Player && $this->getPlugin()->isEnemy($this->player->getName(), $entity->getName())) {
$return["final"] = $currentPos;
$this->processBazookaShoot($return);
return;
}
}
$block = $position->getLevel()->getBlock($currentPos);
if ($block->getId() !== 0 || $y < 0) {
$return["final"] = $currentPos;
$this->processBazookaShoot($return);
return;
}
}
$this->processBazookaShoot(null);
}
示例15: addExperienceOrb
public function addExperienceOrb(Vector3 $pos, $exp = 2)
{
$nbt = new Compound("", ["Pos" => new Enum("Pos", [new Double("", $pos->getX()), new Double("", $pos->getY()), new Double("", $pos->getZ())]), "Motion" => new Enum("Motion", [new Double("", 0), new Double("", 0), new Double("", 0)]), "Rotation" => new Enum("Rotation", [new Float("", 0), new Float("", 0)]), "Experience" => new Long("Experience", $exp)]);
$chunk = $this->getChunk($pos->x >> 4, $pos->z >> 4, false);
$expBall = new ExperienceOrb($chunk, $nbt);
//$expBall->setExperience($exp);
$expBall->spawnToAll();
}