From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: SoSeDiK 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 d10c3c7e50a8972126e72a482c56394e11ed7d9f..c4d7d668bab1546c8196b2c570298038d767220a 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -421,6 +421,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @javax.annotation.Nullable private UUID originWorld; public boolean freezeLocked = false; // Paper - Freeze Tick Lock API + public boolean fixedPose = false; // Paper public void setOrigin(@javax.annotation.Nonnull Location location) { this.origin = location.toVector(); @@ -705,6 +706,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S 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 875f6380a03f030a45f63dbb3e1a2a3bbcbb9b6f..ed49b04d3918e46cd0769838b81cd0fae0d4e43a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -896,6 +896,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