mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 09:10:00 +00:00
Fixed #2392
This commit is contained in:
parent
312e064b07
commit
2752393c42
@ -252,10 +252,14 @@ 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{
|
||||||
|
$block = $this->getLineOfSight($maxDistance, 1, $transparent)[0];
|
||||||
if($block instanceof Block){
|
if($block instanceof Block){
|
||||||
return $block;
|
return $block;
|
||||||
}
|
}
|
||||||
|
}catch (\ArrayOutOfBoundsException $e){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user