Possible fix for #2027, properly check Player onGround flag

This commit is contained in:
Shoghi Cervantes 2014-09-01 02:32:16 +02:00
parent cc2555bb88
commit 3eac08f5ba

View File

@ -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){