mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-17 03:08:58 +00:00
Fixed #1531
This commit is contained in:
parent
df68853c76
commit
a4593d4668
@ -821,8 +821,8 @@ abstract class Entity extends Position implements Metadatable{
|
|||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setPositionAndRotation(Vector3 $pos, $yaw, $pitch){
|
public function setPositionAndRotation(Vector3 $pos, $yaw, $pitch, $force = false){
|
||||||
if($this->setPosition($pos) === true){
|
if($this->setPosition($pos, $force) === true){
|
||||||
$this->setRotation($yaw, $pitch);
|
$this->setRotation($yaw, $pitch);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -837,14 +837,14 @@ abstract class Entity extends Position implements Metadatable{
|
|||||||
$this->scheduleUpdate();
|
$this->scheduleUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setPosition(Vector3 $pos){
|
public function setPosition(Vector3 $pos, $force = false){
|
||||||
if($pos instanceof Position and $pos->getLevel() instanceof Level and $pos->getLevel() !== $this->getLevel()){
|
if($pos instanceof Position and $pos->getLevel() instanceof Level and $pos->getLevel() !== $this->getLevel()){
|
||||||
if($this->switchLevel($pos->getLevel()) === false){
|
if($this->switchLevel($pos->getLevel()) === false){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$this->justCreated){
|
if(!$this->justCreated and $force !== true){
|
||||||
$ev = new EntityMoveEvent($this, $pos);
|
$ev = new EntityMoveEvent($this, $pos);
|
||||||
if($this instanceof Player){
|
if($this instanceof Player){
|
||||||
for($side = 2; $side <= 5; ++$side){
|
for($side = 2; $side <= 5; ++$side){
|
||||||
@ -936,7 +936,7 @@ abstract class Entity extends Position implements Metadatable{
|
|||||||
$pos = $ev->getTo();
|
$pos = $ev->getTo();
|
||||||
|
|
||||||
$this->setMotion(new Vector3(0, 0, 0));
|
$this->setMotion(new Vector3(0, 0, 0));
|
||||||
if($this->setPositionAndRotation($pos, $yaw === false ? $this->yaw : $yaw, $pitch === false ? $this->pitch : $pitch) !== false){
|
if($this->setPositionAndRotation($pos, $yaw === false ? $this->yaw : $yaw, $pitch === false ? $this->pitch : $pitch, true) !== false){
|
||||||
if($this instanceof Player){
|
if($this instanceof Player){
|
||||||
$this->airTicks = 300;
|
$this->airTicks = 300;
|
||||||
$this->fallDistance = 0;
|
$this->fallDistance = 0;
|
||||||
|
@ -210,7 +210,7 @@ abstract class BaseChunk implements Chunk{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getHighestBlockAt($x, $z){
|
public function getHighestBlockAt($x, $z){
|
||||||
for($Y = self::SECTION_COUNT; $Y >= 0; --$Y){
|
for($Y = self::SECTION_COUNT - 1; $Y >= 0; --$Y){
|
||||||
if(!$this->isSectionEmpty($Y)){
|
if(!$this->isSectionEmpty($Y)){
|
||||||
$column = $this->sections[$Y]->getBlockIdColumn($x, $z);
|
$column = $this->sections[$Y]->getBlockIdColumn($x, $z);
|
||||||
for($y = 15; $y >= 0; --$y){
|
for($y = 15; $y >= 0; --$y){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user