Skip to content

Commit b1b0a64

Browse files
committed
Fix collision bug
1 parent 9f5ced2 commit b1b0a64

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/entity/Entity.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,13 @@ protected function entityBaseTick(int $tickDiff = 1) : bool{
660660
$hasUpdate = true;
661661
}elseif($this->isOnGround()){
662662
$block = $this->getWorld()->getBlock($this->getLocation()->subtract(0, 1, 0));
663-
$block->onEntityCollide($this);
663+
$entityBox = $this->getBoundingBox()->addCoord(0, -0.00001, 0);
664+
foreach ($block->getCollisionBoxes() as $blockBox) {
665+
if ($entityBox->intersectsWith($blockBox)) {
666+
$block->onEntityCollide($this);
667+
break;
668+
}
669+
}
664670
}
665671

666672
if($this->isOnFire() && $this->doOnFireTick($tickDiff)){

0 commit comments

Comments
 (0)