mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 04:17:07 +00:00
Entity: avoid double-checking block intersections for moving entities
fixes #1824
This commit is contained in:
parent
b5dc72b0ee
commit
56fbd45dd5
@ -115,6 +115,8 @@ abstract class Entity{
|
|||||||
/** @var Block[]|null */
|
/** @var Block[]|null */
|
||||||
protected $blocksAround;
|
protected $blocksAround;
|
||||||
|
|
||||||
|
private bool $checkBlockIntersectionsNextTick = true;
|
||||||
|
|
||||||
/** @var Location */
|
/** @var Location */
|
||||||
protected $location;
|
protected $location;
|
||||||
/** @var Location */
|
/** @var Location */
|
||||||
@ -649,7 +651,10 @@ abstract class Entity{
|
|||||||
|
|
||||||
$hasUpdate = false;
|
$hasUpdate = false;
|
||||||
|
|
||||||
$this->checkBlockIntersections();
|
if($this->checkBlockIntersectionsNextTick){
|
||||||
|
$this->checkBlockIntersections();
|
||||||
|
}
|
||||||
|
$this->checkBlockIntersectionsNextTick = true;
|
||||||
|
|
||||||
if($this->location->y <= World::Y_MIN - 16 && $this->isAlive()){
|
if($this->location->y <= World::Y_MIN - 16 && $this->isAlive()){
|
||||||
$ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_VOID, 10);
|
$ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_VOID, 10);
|
||||||
@ -1308,6 +1313,7 @@ abstract class Entity{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function checkBlockIntersections() : void{
|
protected function checkBlockIntersections() : void{
|
||||||
|
$this->checkBlockIntersectionsNextTick = false;
|
||||||
$vectors = [];
|
$vectors = [];
|
||||||
|
|
||||||
foreach($this->getBlocksAroundWithEntityInsideActions() as $block){
|
foreach($this->getBlocksAroundWithEntityInsideActions() as $block){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user