Paper/patches/api/0427-Expand-Pose-API.patch
Shane Freeder 7f85940143
Updated Upstream (Bukkit) (#10255)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
58ce1b0f Improve compatibility of new DamageSource API
2024-02-16 23:44:38 +01:00

54 lines
2.0 KiB
Diff

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 d6e6d7140de4588f6b9469988749bccbe848f3ef..d9929d9311e4b2b0ae13a8f6f13563257263f298 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -796,6 +796,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
/**