aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0802-Add-Entity-Body-Yaw-API.patch
blob: 4b118801d511d4bb05fac5ec2eecce6d3c600d14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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 3c1e199316ae283210529d4d27b4f9d70b4d9404..d8b1cdc78eb234023a42d740599009737201e70e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1181,6 +1181,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 195cbff1253ed864fb18984ff6db928aac2bf8aa..292e1701694b0cb0cb9103244e6e59e07b5838b2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -1162,4 +1162,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
 }