Add Entity Coordinate and Rotation API (#9461)

This commit is contained in:
TonytheMacaroni 2023-08-21 03:35:05 -04:00 committed by GitHub
parent 1259b93ba6
commit 88891c37b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 90 additions and 6 deletions

View file

@ -4,6 +4,54 @@ Date: Thu, 2 Feb 2023 16:40:11 +0100
Subject: [PATCH] Add Entity Body Yaw API
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index a2a423d4e4c2702ba5967223cab0432dd7d04732..7b944a4fde359e169da9188fa63cf937f5329091 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -931,6 +931,43 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
* @return true if in powdered snow.
*/
boolean isInPowderedSnow();
+
+ /**
+ * Gets the x-coordinate of this entity
+ *
+ * @return x-coordinate
+ */
+ double getX();
+
+ /**
+ * Gets the y-coordinate of this entity
+ *
+ * @return y-coordinate
+ */
+ double getY();
+
+ /**
+ * Gets the z-coordinate of this entity
+ *
+ * @return z-coordinate
+ */
+ double getZ();
+
+ /**
+ * Gets this entity's pitch
+ *
+ * @see Location#getPitch()
+ * @return the entity's pitch
+ */
+ float getPitch();
+
+ /**
+ * Gets this entity's yaw
+ *
+ * @see Location#getYaw()
+ * @return the entity's yaw
+ */
+ float getYaw();
// Paper end
// Paper Start - Collision API
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index f4c5ec3f7e5c29b1799eef6c4f76617e9f23c0d7..03490d35a24c056ed148e45eea27d1786a58c8fc 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java

View file

@ -769,10 +769,10 @@ index 7bdac4b297e40383dd2ef4e2735fdfb086ecaa14..6b72eccdcb6f75534a4267a1dd0a4cc2
+ // Paper end - Folia region threading API
}
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index a2a423d4e4c2702ba5967223cab0432dd7d04732..6b842453589cf148ab32c1507cf374056826316e 100644
index 7b944a4fde359e169da9188fa63cf937f5329091..da943955496c1bbd767cbf17150b3ad79313e57d 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -954,4 +954,15 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
@@ -991,4 +991,15 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
*/
boolean wouldCollideUsing(@NotNull BoundingBox boundingBox);
// Paper End - Collision API

View file

@ -7,10 +7,10 @@ Was obtainable through different methods, but you had to use different
methods depending on the implementation of Entity you were working with.
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 6b842453589cf148ab32c1507cf374056826316e..75664470303a6e0cbd393c0db32b78b3af818cb6 100644
index da943955496c1bbd767cbf17150b3ad79313e57d..4669037e4dc9d7bb283e0e2fb4c955bec31b916d 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -965,4 +965,15 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
@@ -1002,4 +1002,15 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
*/
@NotNull io.papermc.paper.threadedregions.scheduler.EntityScheduler getScheduler();
// Paper end - Folia schedulers