This commit is contained in:
Shoghi Cervantes 2014-12-12 12:05:15 +01:00
parent 312e064b07
commit 2752393c42

View File

@ -252,9 +252,13 @@ abstract class Living extends Entity implements Damageable{
* @return Block * @return Block
*/ */
public function getTargetBlock($maxDistance, array $transparent = []){ public function getTargetBlock($maxDistance, array $transparent = []){
$block = array_shift($this->getLineOfSight($maxDistance, 1, $transparent)); try{
if($block instanceof Block){ $block = $this->getLineOfSight($maxDistance, 1, $transparent)[0];
return $block; if($block instanceof Block){
return $block;
}
}catch (\ArrayOutOfBoundsException $e){
} }
return null; return null;