Check the entity is actually inside a block before trying to shove it out, fix #271

This commit is contained in:
Dylan K. Taylor 2017-05-26 17:11:51 +01:00
parent 3446f68c74
commit 4c764072b2

View File

@ -862,6 +862,10 @@ abstract class Entity extends Location implements Metadatable{
} }
protected function checkObstruction($x, $y, $z){ protected function checkObstruction($x, $y, $z){
if(count($this->level->getCollisionCubes($this, $this->getBoundingBox(), false)) === 0){
return false;
}
$i = Math::floorFloat($x); $i = Math::floorFloat($x);
$j = Math::floorFloat($y); $j = Math::floorFloat($y);
$k = Math::floorFloat($z); $k = Math::floorFloat($z);