aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0504-Expose-LivingEntity-hurt-direction.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0504-Expose-LivingEntity-hurt-direction.patch')
-rw-r--r--patches/server/0504-Expose-LivingEntity-hurt-direction.patch57
1 files changed, 57 insertions, 0 deletions
diff --git a/patches/server/0504-Expose-LivingEntity-hurt-direction.patch b/patches/server/0504-Expose-LivingEntity-hurt-direction.patch
new file mode 100644
index 0000000000..4ff58cbd93
--- /dev/null
+++ b/patches/server/0504-Expose-LivingEntity-hurt-direction.patch
@@ -0,0 +1,57 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Mark Vainomaa <[email protected]>
+Date: Sun, 13 Dec 2020 05:32:05 +0200
+Subject: [PATCH] Expose LivingEntity hurt direction
+
+
+diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
+index fb3f65feab6f5febf58be71f0b9b1a4381958f1d..6c498338d3918afb4f7ad5bac013f6dbb43594c2 100644
+--- a/src/main/java/net/minecraft/world/entity/player/Player.java
++++ b/src/main/java/net/minecraft/world/entity/player/Player.java
+@@ -183,7 +183,7 @@ public abstract class Player extends LivingEntity {
+ private Optional<GlobalPos> lastDeathLocation;
+ @Nullable
+ public FishingHook fishing;
+- protected float hurtDir;
++ public float hurtDir; // Paper - protected -> public
+ // Paper start
+ public boolean affectsSpawning = true;
+ // Paper end
+diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+index d41e37afeab1e8bb098c6ed012b10b113c4a4715..408c23c8310c464baebfb1f4adafe56a01645a5a 100644
+--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+@@ -126,6 +126,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
+ }
+ }
+
++ // Paper start
++ @Override
++ public void setHurtDirection(float hurtDirection) {
++ this.getHandle().hurtDir = hurtDirection;
++ }
++ // Paper end
++
+ @Override
+ public int getSleepTicks() {
+ return this.getHandle().sleepCounter;
+diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+index a654f22a6c331cd69290b99e6c73f3ed611c58a5..810f06b3dc7148f9d71635981b3be79659fd0906 100644
+--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+@@ -932,5 +932,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
+ public void playPickupItemAnimation(org.bukkit.entity.Item item, int quantity) {
+ getHandle().take(((CraftItem) item).getHandle(), quantity);
+ }
++
++ @Override
++ public float getHurtDirection() {
++ return this.getHandle().getHurtDir();
++ }
++
++ @Override
++ public void setHurtDirection(float hurtDirection) {
++ throw new UnsupportedOperationException("Cannot set the hurt direction on a non player");
++ }
+ // Paper end
+ }