mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +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()){
|
||||
$this->setFlying(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();
|
||||
}else{
|
||||
$this->keepMovement = $this->allowMovementCheats;
|
||||
$this->checkGroundState(0, 0, 0, 0, 0, 0);
|
||||
if($this->isSurvival()){
|
||||
$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{
|
||||
$bb = clone $this->boundingBox;
|
||||
$bb->minY = $this->y - 0.2;
|
||||
$bb->maxY = $this->y + 0.2;
|
||||
if($this->isSpectator()){
|
||||
$this->onGround = false;
|
||||
}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{
|
||||
|
Loading…
x
Reference in New Issue
Block a user