PaperMC/patches/server-remapped/0616-Expose-LivingEntity-hurt-direction.patch
2021-06-11 14:02:28 +02:00

39 lines
1.9 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/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 57b933afdbb2136ed48170da6945eb2b92edb4db..02ddb84c563b3149c4f1b0e24899ce8a21ad61bb 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -160,7 +160,7 @@ public abstract class LivingEntity extends Entity {
public int removeStingerTime;
public int hurtTime;
public int hurtDuration;
- public float hurtDir;
+ public float hurtDir; public final float getHurtDirection() { return hurtDir; } public final void setHurtDirection(float hurtDirection) { this.hurtDir = hurtDirection; } // Paper - OBFHELPER
public int deathTime;
public float oAttackAnim;
public float attackAnim;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 170bb1124ee396a85dd64baed8110e39823ad849..a8d21382d5859edfd12e01a48924ce780790b4b7 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -818,5 +818,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 getHandle().getHurtDirection();
+ }
+
+ @Override
+ public void setHurtDirection(float hurtDirection) {
+ getHandle().setHurtDirection(hurtDirection);
+ }
// Paper end
}