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


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 77d87dcd39147bd617b30a47140852dda750431f..d435d04ab50b2f64e6438c6c26639b6048322013 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -417,6 +417,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
     private UUID originWorld;
     public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
     public boolean collidingWithWorldBorder; // Paper
+    public boolean fixedPose = false; // Paper
 
     public void setOrigin(@javax.annotation.Nonnull Location location) {
         this.origin = location.toVector();
@@ -701,6 +702,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
     public void onClientRemoval() {}
 
     public void setPose(net.minecraft.world.entity.Pose pose) {
+        if (this.fixedPose) return; // Paper
         // CraftBukkit start
         if (pose == this.getPose()) {
             return;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index d57856bee23cd0fd22d0c2141c77c978dae7f8c6..90b04377088fcaf128cb35843702d2f5ead4b7f6 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1243,6 +1243,20 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
     public boolean isSneaking() {
         return this.getHandle().isShiftKeyDown();
     }
+
+    @Override
+    public void setPose(Pose pose, boolean fixed) {
+        Preconditions.checkNotNull(pose, "Pose cannot be null");
+        final Entity handle = this.getHandle();
+        handle.fixedPose = false;
+        handle.setPose(net.minecraft.world.entity.Pose.values()[pose.ordinal()]);
+        handle.fixedPose = fixed;
+    }
+
+    @Override
+    public boolean hasFixedPose() {
+        return this.getHandle().fixedPose;
+    }
     // Paper end
 
     @Override