mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
This commit is contained in:
parent
7af4e70f64
commit
03e8cd3ed4
@ -1370,9 +1370,16 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
if($this->isSpectator()){
|
if($this->isSpectator()){
|
||||||
$this->setFlying(true);
|
$this->setFlying(true);
|
||||||
$this->keepMovement = true;
|
$this->keepMovement = true;
|
||||||
|
$this->onGround = false;
|
||||||
|
|
||||||
|
//TODO: HACK! this syncs the onground flag with the client so that flying works properly
|
||||||
|
//this is a yucky hack but we don't have any other options :(
|
||||||
|
$this->sendPosition($this, null, null, MovePlayerPacket::MODE_TELEPORT);
|
||||||
|
|
||||||
$this->despawnFromAll();
|
$this->despawnFromAll();
|
||||||
}else{
|
}else{
|
||||||
$this->keepMovement = $this->allowMovementCheats;
|
$this->keepMovement = $this->allowMovementCheats;
|
||||||
|
$this->checkGroundState(0, 0, 0, 0, 0, 0);
|
||||||
if($this->isSurvival()){
|
if($this->isSurvival()){
|
||||||
$this->setFlying(false);
|
$this->setFlying(false);
|
||||||
}
|
}
|
||||||
@ -1493,11 +1500,15 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function checkGroundState(float $movX, float $movY, float $movZ, float $dx, float $dy, float $dz) : void{
|
protected function checkGroundState(float $movX, float $movY, float $movZ, float $dx, float $dy, float $dz) : void{
|
||||||
$bb = clone $this->boundingBox;
|
if($this->isSpectator()){
|
||||||
$bb->minY = $this->y - 0.2;
|
$this->onGround = false;
|
||||||
$bb->maxY = $this->y + 0.2;
|
}else{
|
||||||
|
$bb = clone $this->boundingBox;
|
||||||
|
$bb->minY = $this->y - 0.2;
|
||||||
|
$bb->maxY = $this->y + 0.2;
|
||||||
|
|
||||||
$this->onGround = $this->isCollided = count($this->level->getCollisionBlocks($bb, true)) > 0;
|
$this->onGround = $this->isCollided = count($this->level->getCollisionBlocks($bb, true)) > 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canBeMovedByCurrents() : bool{
|
public function canBeMovedByCurrents() : bool{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user