Paper/patches/server/0993-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
2023-12-06 20:40:37 +01:00
index 23488823fe48f502c1f64ace79030bf0f7e85626..62bdce9516804942862b33667bc571e3bcac1a70 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
2023-12-06 17:34:54 +01:00
@@ -422,6 +422,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
2023-08-22 05:05:47 +02:00
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();
2023-12-06 17:34:54 +01:00
@@ -706,6 +707,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
// 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
2023-12-06 17:34:54 +01:00
index c4343cbdea19a0dd671ed136a6a19ebf831ce8ab..0349d9b6ad12e0a426cb1307be8633240b7426fe 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
2023-12-06 17:34:54 +01:00
@@ -1251,6 +1251,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