From 8ab814cd5c415258aa0ab7617051ee4ea9f4e7bd Mon Sep 17 00:00:00 2001 From: Senmori Date: Sun, 2 Sep 2018 18:28:54 -0400 Subject: Add getFacing method to get the current cardinal direction an entity is facing. --- src/main/java/org/bukkit/entity/Entity.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java index 62bf70f5..2cc60fe9 100644 --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java @@ -5,7 +5,9 @@ import org.bukkit.EntityEffect; import org.bukkit.Nameable; import org.bukkit.Server; import org.bukkit.World; +import org.bukkit.block.BlockFace; import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.material.Directional; import org.bukkit.metadata.Metadatable; import org.bukkit.util.Vector; @@ -508,4 +510,20 @@ public interface Entity extends Metadatable, CommandSender, Nameable { * @return reaction */ PistonMoveReaction getPistonMoveReaction(); + + /** + * Get the closest cardinal {@link BlockFace} direction an entity is + * currently facing. + *
+ * This will not return any non-cardinal directions such as + * {@link BlockFace#UP} or {@link BlockFace#DOWN}. + *
+ * {@link Hanging} entities will override this call and thus their behavior + * may be different. + * + * @return the entity's current cardinal facing. + * @see Hanging + * @see Directional#getFacing() + */ + BlockFace getFacing(); } -- cgit v1.2.3