mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 12:36:07 +01:00
58 lines
2.6 KiB
Diff
58 lines
2.6 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/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
index a8731cf957da9aad7ed6f5d372500bc34afd32ca..b36492efc3d6338e0099988c1ff31e7211b7d010 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
@@ -182,7 +182,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 f4cda5fbf12c59dc1ecec4aac6719837444382e2..8d1bbc1ac3dbc10e940a0715ebfa1d5a2674b303 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 fa6b00e3055224a53eb6ec93431d70df27b6c6d1..eae5d75cd93416235690196cf2c88e7a17e1b97a 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
|
|
}
|