From d3bf76da9de67e7cd6e97d80086f2aa907930fb7 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Wed, 21 Mar 2012 16:30:35 +0100 Subject: Add LivingEntity.hasLineOfSight. Addresses BUKKIT-1255 --- src/main/java/org/bukkit/entity/LivingEntity.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/main') diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java index 6787d79a..e93453a3 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -269,4 +269,13 @@ public interface LivingEntity extends Entity { * @return A collection of {@link PotionEffect}s */ public Collection getActivePotionEffects(); + + /** + * Checks whether the entity has block line of sight to another.
+ * This uses the same algorithm that hostile mobs use to find the closest player. + * + * @param other The entity to determine line of sight to. + * @return true if there is a line of sight, false if not. + */ + public boolean hasLineOfSight(Entity other); } -- cgit v1.2.3