From 0c3311c3b287c5902df5c9381936df4b53a61d57 Mon Sep 17 00:00:00 2001 From: Piotr Pasztor <86690614+TheTuso@users.noreply.github.com> Date: Thu, 9 Feb 2023 18:31:51 +0100 Subject: [PATCH] Add Entity Body Yaw API (#8822) --- .../api/0429-Add-Entity-Body-Yaw-API.patch | 32 +++++++++++++++++++ .../server/0961-Add-Entity-Body-Yaw-API.patch | 27 ++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 patches/api/0429-Add-Entity-Body-Yaw-API.patch create mode 100644 patches/server/0961-Add-Entity-Body-Yaw-API.patch diff --git a/patches/api/0429-Add-Entity-Body-Yaw-API.patch b/patches/api/0429-Add-Entity-Body-Yaw-API.patch new file mode 100644 index 0000000000..5049319f60 --- /dev/null +++ b/patches/api/0429-Add-Entity-Body-Yaw-API.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: TheTuso +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/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index ead90b002034c463983af948a4fb882109b8d3a2..653905bd33025310e5c5136b119f5a7cea075359 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -1106,5 +1106,21 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + * @param amount the amount of damage to do + */ + void damageItemStack(org.bukkit.inventory.@NotNull EquipmentSlot slot, int amount); ++ ++ /** ++ * Gets entity body yaw ++ * ++ * @return entity body yaw ++ * @see Location#getYaw() ++ */ ++ float getBodyYaw(); ++ ++ /** ++ * Sets entity body yaw ++ * ++ * @param bodyYaw new entity body yaw ++ * @see Location#setYaw(float) ++ */ ++ void setBodyYaw(float bodyYaw); + // Paper end + } diff --git a/patches/server/0961-Add-Entity-Body-Yaw-API.patch b/patches/server/0961-Add-Entity-Body-Yaw-API.patch new file mode 100644 index 0000000000..2dc9647d71 --- /dev/null +++ b/patches/server/0961-Add-Entity-Body-Yaw-API.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: TheTuso +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/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +index 09da9d3c85e36c2a78663f58a97963dbc795a367..47c4b5bb5790e9de8a3ad9674393b5fd9a7d6611 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +@@ -1028,6 +1028,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { + this.damageItemStack0(this.getHandle().getItemBySlot(nmsSlot), amount, nmsSlot); + } + ++ @Override ++ public float getBodyYaw() { ++ return this.getHandle().getVisualRotationYInDegrees(); ++ } ++ ++ @Override ++ public void setBodyYaw(float bodyYaw) { ++ this.getHandle().setYBodyRot(bodyYaw); ++ } ++ + private void damageItemStack0(net.minecraft.world.item.ItemStack nmsStack, int amount, net.minecraft.world.entity.EquipmentSlot slot) { + nmsStack.hurtAndBreak(amount, this.getHandle(), livingEntity -> { + if (slot != null) {