summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSenmori <thesenmori@gmail.com>2018-09-02 18:28:54 -0400
committermd_5 <git@md-5.net>2018-09-03 18:06:22 +1000
commit8ab814cd5c415258aa0ab7617051ee4ea9f4e7bd (patch)
tree018f86ccd0f30f26d3feba33d3939153dd8cac91
parent9e031b7b21da70f3ad1de193432143ad189797c8 (diff)
downloadbukkit-8ab814cd5c415258aa0ab7617051ee4ea9f4e7bd.tar
bukkit-8ab814cd5c415258aa0ab7617051ee4ea9f4e7bd.tar.gz
bukkit-8ab814cd5c415258aa0ab7617051ee4ea9f4e7bd.tar.lz
bukkit-8ab814cd5c415258aa0ab7617051ee4ea9f4e7bd.tar.xz
bukkit-8ab814cd5c415258aa0ab7617051ee4ea9f4e7bd.zip
Add getFacing method to get the current cardinal direction an entity is facing.
-rw-r--r--src/main/java/org/bukkit/entity/Entity.java18
1 files changed, 18 insertions, 0 deletions
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.
+ * <br>
+ * This will not return any non-cardinal directions such as
+ * {@link BlockFace#UP} or {@link BlockFace#DOWN}.
+ * <br>
+ * {@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();
}