2021-06-14 20:50:22 +02:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2023-03-14 23:13:41 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
2023-09-22 06:40:51 +02:00
|
|
|
index 00d9dd5affd62ceb35bb783d6bcc9e1e600c0fb4..c44f8ed810b0c9a510d7e1c07987323a8a620ca4 100644
|
2023-03-14 23:13:41 +01:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
2023-09-22 06:40:51 +02:00
|
|
|
@@ -183,7 +183,7 @@ public abstract class Player extends LivingEntity {
|
2023-03-14 23:13:41 +01:00
|
|
|
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
|
2023-09-22 06:40:51 +02:00
|
|
|
index 05d9a9968588381aaa3aeb06ef4d18fed4085229..c9f4f496a92ff8465a21f22f326dc025aa8bd169 100644
|
2023-03-14 23:13:41 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
2023-05-12 13:10:08 +02:00
|
|
|
@@ -126,6 +126,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
2023-03-14 23:13:41 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ @Override
|
|
|
|
+ public void setHurtDirection(float hurtDirection) {
|
|
|
|
+ this.getHandle().hurtDir = hurtDirection;
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
@Override
|
|
|
|
public int getSleepTicks() {
|
|
|
|
return this.getHandle().sleepCounter;
|
2021-06-14 20:50:22 +02:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
2023-09-22 06:40:51 +02:00
|
|
|
index 833c1d37fde5e726933da6ac0076c6ea072389ca..4d41a73281c851c1ff9506074f7590c06105efbb 100644
|
2021-06-14 20:50:22 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
2023-08-14 01:32:51 +02:00
|
|
|
@@ -932,5 +932,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
2021-06-14 20:50:22 +02:00
|
|
|
public void playPickupItemAnimation(org.bukkit.entity.Item item, int quantity) {
|
|
|
|
getHandle().take(((CraftItem) item).getHandle(), quantity);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public float getHurtDirection() {
|
2023-03-14 23:13:41 +01:00
|
|
|
+ return this.getHandle().getHurtDir();
|
2021-06-14 20:50:22 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void setHurtDirection(float hurtDirection) {
|
2023-03-14 23:13:41 +01:00
|
|
|
+ throw new UnsupportedOperationException("Cannot set the hurt direction on a non player");
|
2021-06-14 20:50:22 +02:00
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
}
|