PaperMC/Spigot-Server-Patches/0620-Expose-LivingEntity-hurt-direction.patch
Riley Park 4e958e229f
We're going on an Adventure! (#4842)
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: zml <zml@stellardrift.ca>
Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
2021-02-21 20:45:33 +01:00

39 lines
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
Date: Sun, 13 Dec 2020 05:32:05 +0200
Subject: [PATCH] Expose LivingEntity hurt direction
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 2a1b17717b37e5f839e357c2196287a4024852e9..3c23a8ab3fe5e4b58816cf051dbe237530bff4a0 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -69,7 +69,7 @@ public abstract class EntityLiving extends Entity {
public int am;
public int hurtTicks;
public int hurtDuration;
- public float ap;
+ public float ap; public final float getHurtDirection() { return ap; } public final void setHurtDirection(float hurtDirection) { this.ap = hurtDirection; } // Paper - OBFHELPER
public int deathTicks;
public float ar;
public float as;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 1fc356d0b74c1cbb19bf7527088f1f61b6da5422..16e69cfd4994fd6850ee3635ea819379412351c9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -815,5 +815,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public void playPickupItemAnimation(org.bukkit.entity.Item item, int quantity) {
getHandle().receive(((CraftItem) item).getHandle(), quantity);
}
+
+ @Override
+ public float getHurtDirection() {
+ return getHandle().getHurtDirection();
+ }
+
+ @Override
+ public void setHurtDirection(float hurtDirection) {
+ getHandle().setHurtDirection(hurtDirection);
+ }
// Paper end
}