Paper/patches/unapplied/server/0793-Add-Entity-Body-Yaw-API.patch
2024-10-22 19:28:57 +02:00

66 lines
2.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: TheTuso <piotrekpasztor@gmail.com>
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 ac513d3162a0794f226abc80bff21c799fe5802c..7c7501b4b21530d0641774f64e87d7d1ca71a33c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1183,6 +1183,33 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
}
// Paper end - entity powdered snow API
+ // Paper start - entity body yaw API
+ @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 - entity body yaw API
+
// Paper start - missing entity api
@Override
public boolean isInvisible() { // Paper - moved up from LivingEntity
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 516ea1ec9ae5069c3c0e4708f62164a91960b627..a50803a9b41cf3c0b081eb6b786f952dd0ed284f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -1192,4 +1192,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
this.getHandle().frictionState = state;
}
// Paper end - friction API
+
+ // Paper start - body yaw API
+ @Override
+ public float getBodyYaw() {
+ return this.getHandle().getVisualRotationYInDegrees();
+ }
+
+ @Override
+ public void setBodyYaw(final float bodyYaw) {
+ this.getHandle().setYBodyRot(bodyYaw);
+ }
+ // Paper end - body yaw API
}