mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-14 15:35:31 +00:00
Possible fix for #2027, properly check Player onGround flag
This commit is contained in:
parent
cc2555bb88
commit
3eac08f5ba
@ -896,7 +896,20 @@ abstract class Entity extends Position implements Metadatable{
|
||||
if(!$this->setPosition($pos)){
|
||||
$this->boundingBox->setBB($axisalignedbb);
|
||||
}else{
|
||||
$this->onGround = ($movY != $dy and $movY < 0);
|
||||
|
||||
if($this instanceof Player){
|
||||
if(($this->onGround and $movY != 0) or (!$this->onGround and $movY <= 0)){
|
||||
if(count($this->getLevel()->getCollisionBlocks($this->boundingBox->getOffsetBoundingBox(0, $movY - 0.1, 0))) > 0){
|
||||
$isColliding = true;
|
||||
}else{
|
||||
$isColliding = false;
|
||||
}
|
||||
|
||||
$this->onGround = ($movY <= 0 and $isColliding);
|
||||
}
|
||||
}else{
|
||||
$this->onGround = ($movY != $dy and $movY < 0);
|
||||
}
|
||||
$this->updateFallState($dy, $this->onGround);
|
||||
|
||||
if($movX != $dx){
|
||||
|
Loading…
x
Reference in New Issue
Block a user