From b0439eea915e60e84b5a263cde09fd19cba86273 Mon Sep 17 00:00:00 2001 From: TonytheMacaroni Date: Mon, 21 Aug 2023 03:35:05 -0400 Subject: [PATCH] Add Entity Coordinate and Rotation API (#9461) --- patches/api/Add-Entity-Body-Yaw-API.patch | 48 ++++++++++++++++++++ patches/server/Add-Entity-Body-Yaw-API.patch | 36 +++++++++++++++ 2 files changed, 84 insertions(+) diff --git a/patches/api/Add-Entity-Body-Yaw-API.patch b/patches/api/Add-Entity-Body-Yaw-API.patch index 5a073854f3..bd6bee3823 100644 --- a/patches/api/Add-Entity-Body-Yaw-API.patch +++ b/patches/api/Add-Entity-Body-Yaw-API.patch @@ -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/entity/Entity.java ++++ b/src/main/java/org/bukkit/entity/Entity.java +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java diff --git a/patches/server/Add-Entity-Body-Yaw-API.patch b/patches/server/Add-Entity-Body-Yaw-API.patch index 3ef620b828..a6ed4f3022 100644 --- a/patches/server/Add-Entity-Body-Yaw-API.patch +++ b/patches/server/Add-Entity-Body-Yaw-API.patch @@ -4,6 +4,42 @@ Date: Thu, 2 Feb 2023 16:40:41 +0100 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +@@ -0,0 +0,0 @@ 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 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java