From e1f54099c8d6ba708c2895803464a0b89cacd3b9 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Wed, 17 Dec 2014 18:50:18 -0600 Subject: Add alternatives for deprecated methods --- src/main/java/org/bukkit/entity/LivingEntity.java | 42 +++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'src') diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java index a0fefd85..48e25089 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -3,8 +3,10 @@ package org.bukkit.entity; import java.util.Collection; import java.util.HashSet; import java.util.List; +import java.util.Set; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.inventory.EntityEquipment; import org.bukkit.potion.PotionEffect; @@ -56,6 +58,21 @@ public interface LivingEntity extends Entity, Damageable, ProjectileSource { @Deprecated public List getLineOfSight(HashSet transparent, int maxDistance); + /** + * Gets all blocks along the living entity's line of sight. + *

+ * This list contains all blocks from the living entity's eye position to + * target inclusive. + * + * @param transparent HashSet containing all transparent block Materials (set to + * null for only air) + * @param maxDistance this is the maximum distance to scan (may be limited + * by server by at least 100 blocks, no less) + * @return list containing all blocks along the living entity's line of + * sight + */ + public List getLineOfSight(Set transparent, int maxDistance); + /** * Gets the block that the living entity has targeted. * @@ -69,6 +86,17 @@ public interface LivingEntity extends Entity, Damageable, ProjectileSource { @Deprecated public Block getTargetBlock(HashSet transparent, int maxDistance); + /** + * Gets the block that the living entity has targeted. + * + * @param transparent HashSet containing all transparent block Materials (set to + * null for only air) + * @param maxDistance this is the maximum distance to scan (may be limited + * by server by at least 100 blocks, no less) + * @return block that the living entity has targeted + */ + public Block getTargetBlock(Set transparent, int maxDistance); + /** * Gets the last two blocks along the living entity's line of sight. *

@@ -85,6 +113,20 @@ public interface LivingEntity extends Entity, Damageable, ProjectileSource { @Deprecated public List getLastTwoTargetBlocks(HashSet transparent, int maxDistance); + /** + * Gets the last two blocks along the living entity's line of sight. + *

+ * The target block will be the last block in the list. + * + * @param transparent HashSet containing all transparent block Materials (set to + * null for only air) + * @param maxDistance this is the maximum distance to scan. This may be + * further limited by the server, but never to less than 100 blocks + * @return list containing the last 2 blocks along the living entity's + * line of sight + */ + public List getLastTwoTargetBlocks(Set transparent, int maxDistance); + /** * Throws an egg from the living entity. * -- cgit v1.2.3