mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-09 11:31:49 +00:00
Entity: shift BB back down after trying to auto-step
this fixes bugs where the entity would jump in the air when walking on blocks like carpet. It also fixes a lot of the issues with stepping in the anti-cheat, allowing to reduce the error tolerance on movement processing.
This commit is contained in:
parent
2d77b1e364
commit
89fe8f7f10
@ -1637,13 +1637,20 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
|||||||
|
|
||||||
$this->boundingBox->offset(0, 0, $dz);
|
$this->boundingBox->offset(0, 0, $dz);
|
||||||
|
|
||||||
|
$reverseDY = -$dy;
|
||||||
|
foreach($list as $bb){
|
||||||
|
$reverseDY = $bb->calculateYOffset($this->boundingBox, $reverseDY);
|
||||||
|
}
|
||||||
|
$dy += $reverseDY;
|
||||||
|
$this->boundingBox->offset(0, $reverseDY, 0);
|
||||||
|
|
||||||
if(($cx ** 2 + $cz ** 2) >= ($dx ** 2 + $dz ** 2)){
|
if(($cx ** 2 + $cz ** 2) >= ($dx ** 2 + $dz ** 2)){
|
||||||
$dx = $cx;
|
$dx = $cx;
|
||||||
$dy = $cy;
|
$dy = $cy;
|
||||||
$dz = $cz;
|
$dz = $cz;
|
||||||
$this->boundingBox->setBB($axisalignedbb1);
|
$this->boundingBox->setBB($axisalignedbb1);
|
||||||
}else{
|
}else{
|
||||||
$this->ySize += 0.5; //FIXME: this should be the height of the block it walked up, not fixed 0.5
|
$this->ySize += $dy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user