mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 22:45:28 +00:00
Improved player movement event firing & corrections
This commit is contained in:
parent
464afb949e
commit
6e8144d5d9
@ -1121,7 +1121,11 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
|||||||
$revert = true;
|
$revert = true;
|
||||||
//$this->server->getLogger()->warning($this->getName()." moved wrongly!");
|
//$this->server->getLogger()->warning($this->getName()." moved wrongly!");
|
||||||
}elseif($diff > 0){
|
}elseif($diff > 0){
|
||||||
$revert = !$this->setPosition($this->newPosition);
|
$this->x = $this->newPosition->x;
|
||||||
|
$this->y = $this->newPosition->y;
|
||||||
|
$this->z = $this->newPosition->z;
|
||||||
|
$radius = $this->width / 2;
|
||||||
|
$this->boundingBox->setBounds($this->x - $radius, $this->y + $this->ySize, $this->z - $radius, $this->x + $radius, $this->y + $this->height + $this->ySize, $this->z + $radius);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1037,7 +1037,7 @@ abstract class Entity extends Position implements Metadatable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function setPosition(Vector3 $pos, $force = false){
|
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->level instanceof Level and $pos->level !== $this->level){
|
||||||
if($this->switchLevel($pos->getLevel()) === false){
|
if($this->switchLevel($pos->getLevel()) === false){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user