Paper/patches/server/0940-Expand-Pose-API.patch

52 lines
2.3 KiB
Diff
Raw Normal View History

2023-08-22 05:05:47 +02:00
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 c709049deccc8218d603382e4f628e493a99c5ae..633a709d3f7768dce644affc4ce9b75711e971f1 100644
2023-08-22 05:05:47 +02:00
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -420,6 +420,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@javax.annotation.Nullable
2023-08-22 05:05:47 +02:00
private UUID originWorld;
public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
+ public boolean fixedPose = false; // Paper - Expand Pose API
2023-08-22 05:05:47 +02:00
public void setOrigin(@javax.annotation.Nonnull Location location) {
this.origin = location.toVector();
@@ -672,6 +673,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
2023-08-22 05:05:47 +02:00
public void onClientRemoval() {}
public void setPose(net.minecraft.world.entity.Pose pose) {
+ if (this.fixedPose) return; // Paper - Expand Pose API
2023-08-22 05:05:47 +02:00
// 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 cc14e635a5f2f8afe593afc676c718c431361dfb..395476ab15a04f95710c671c9a896a9a37daa9b4 100644
2023-08-22 05:05:47 +02:00
--- 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 {
2023-08-22 05:05:47 +02:00
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