aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0853-Expand-Pose-API.patch
blob: 39335a84abb9db5b9df22808c78c0c9d77944530 (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 c7292ddae2a2cb11434a6962706bc2a8dd5d2cdc..aa317a143e2c38a0385a83651a78403401a75d9e 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -428,6 +428,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
     @javax.annotation.Nullable
     private UUID originWorld;
     public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
+    public boolean fixedPose = false; // Paper - Expand Pose API
 
     public void setOrigin(@javax.annotation.Nonnull Location location) {
         this.origin = location.toVector();
@@ -626,6 +627,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
     public void onRemoval(Entity.RemovalReason reason) {}
 
     public void setPose(net.minecraft.world.entity.Pose pose) {
+        if (this.fixedPose) return; // Paper - Expand Pose API
         // 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 56a3c69bb37b90b7af6590027a80d20f4812bef4..27c8850f874040ba00fa4c226ca0662261451826 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -895,6 +895,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