13
0
geforkt von Mirrors/Paper

Add Entity Coordinate and Rotation API (#9461)

Dieser Commit ist enthalten in:
TonytheMacaroni 2023-08-21 03:35:05 -04:00 committet von GitHub
Ursprung 1259b93ba6
Commit 88891c37b1
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
5 geänderte Dateien mit 90 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -4,6 +4,54 @@ Date: Thu, 2 Feb 2023 16:40:11 +0100
Subject: [PATCH] Add Entity Body Yaw API 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 diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index f4c5ec3f7e5c29b1799eef6c4f76617e9f23c0d7..03490d35a24c056ed148e45eea27d1786a58c8fc 100644 index f4c5ec3f7e5c29b1799eef6c4f76617e9f23c0d7..03490d35a24c056ed148e45eea27d1786a58c8fc 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java --- a/src/main/java/org/bukkit/entity/LivingEntity.java

Datei anzeigen

@ -769,10 +769,10 @@ index 7bdac4b297e40383dd2ef4e2735fdfb086ecaa14..6b72eccdcb6f75534a4267a1dd0a4cc2
+ // Paper end - Folia region threading API + // 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 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 --- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/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); boolean wouldCollideUsing(@NotNull BoundingBox boundingBox);
// Paper End - Collision API // Paper End - Collision API

Datei anzeigen

@ -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. 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 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 --- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/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(); @NotNull io.papermc.paper.threadedregions.scheduler.EntityScheduler getScheduler();
// Paper end - Folia schedulers // Paper end - Folia schedulers

Datei anzeigen

@ -4,6 +4,42 @@ Date: Thu, 2 Feb 2023 16:40:41 +0100
Subject: [PATCH] Add Entity Body Yaw API Subject: [PATCH] Add Entity Body Yaw API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 1186ee7cc4671892346b7173d10125febcfbf88a..4c2818f2ab2c53a836622d0ef17b19ecd1762908 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1430,6 +1430,31 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
public boolean isInPowderedSnow() {
return getHandle().isInPowderSnow || getHandle().wasInPowderSnow; // depending on the location in the entity "tick" either could be needed.
}
+
+ @Override
+ public double getX() {
+ return this.entity.getX();
+ }
+
+ @Override
+ public double getY() {
+ return this.entity.getY();
+ }
+
+ @Override
+ public double getZ() {
+ return this.entity.getZ();
+ }
+
+ @Override
+ public float getPitch() {
+ return this.entity.getXRot();
+ }
+
+ @Override
+ public float getYaw() {
+ return this.entity.getBukkitYaw();
+ }
// Paper end
// Paper Start - Collision API
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 736eb990bec434729eb3f3432389ab135436b133..860de727f4eb220d5cce62d0850f240b900412ec 100644 index 736eb990bec434729eb3f3432389ab135436b133..860de727f4eb220d5cce62d0850f240b900412ec 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java

Datei anzeigen

@ -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. methods depending on the implementation of Entity you were working with.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 6e600f9d81178f4ad10967a1aba802c9ac853d82..975e2402cd1a2910043084957210c352329d42ae 100644 index 71ccd54245c2cfe5e75a53e5d6b2962961eccb6f..7e132298252d196a97c99b45e58a3ac9a1de7216 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1461,4 +1461,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -1486,4 +1486,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return !this.getHandle().level().noCollision(this.getHandle(), aabb); return !this.getHandle().level().noCollision(this.getHandle(), aabb);
} }
// Paper End - Collision API // Paper End - Collision API