aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0422-Expand-Pose-API.patch
blob: b6d907acb45d1865b432a06bc01c9a3a16a194d1 (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
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: SoSeDiK <mrsosedik@gmail.com>
Date: Wed, 11 Jan 2023 20:59:02 +0200
Subject: [PATCH] Expand Pose API


diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 8dcb9f17046ac5dc0301b5d4984b016514e19109..62e3793903905b94eb1a120345015149abb33713 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -836,6 +836,42 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
      * @param sneak true if the entity should be sneaking
      */
     void setSneaking(boolean sneak);
+
+    /**
+     * Sets the entity's current {@link Pose}.
+     *
+     * <p>Note: While poses affect some things like hitboxes, they do not change the entity's state
+     * (e.g. having {@link Pose#SNEAKING} does not guarantee {@link #isSneaking()} being {@code true}).
+     *
+     * <p>If applied to the {@link Player}, they might see a different pose client-side.
+     *
+     * @param pose a new {@link Pose}
+     * @see #setPose(Pose, boolean)
+     */
+    default void setPose(@NotNull Pose pose) {
+        setPose(pose, false);
+    }
+
+    /**
+     * Sets the entity's current {@link Pose}.
+     *
+     * <p>Note: While poses affect some things like hitboxes, they do not change the entity's state
+     * (e.g. having {@link Pose#SNEAKING} does not guarantee {@link #isSneaking()} being {@code true}).
+     *
+     * <p>If applied to the {@link Player}, they might see a different pose client-side.
+     *
+     * @param pose a new {@link Pose}
+     * @param fixed whether the new {@link Pose} should stay until manually changed
+     */
+    void setPose(@NotNull Pose pose, boolean fixed);
+
+    /**
+     * Checks whether the entity has a fixed {@link Pose}
+     *
+     * @see #setPose(Pose, boolean)
+     * @return whether the entity has a fixed {@link Pose}
+     */
+    boolean hasFixedPose();
     // Paper end
 
     /**