mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 00:10:32 +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 603e003fbd39870a0e249151885b3b8f3e120afe..6fe21c29aa9d119490fbf1d69eb03c146674cde5 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
@@ -180,7 +180,7 @@ public abstract class Player extends LivingEntity {
|
|
private Optional<GlobalPos> lastDeathLocation;
|
|
@Nullable
|
|
public FishingHook fishing;
|
|
- protected float hurtDir;
|
|
+ public float hurtDir; // Paper - protected -> public
|
|
public boolean affectsSpawning = true; // Paper - Affects Spawning API
|
|
|
|
// CraftBukkit start
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
|
index 93644aefd2e6c97eca2735812b2b7b4bd039cfb5..40f848d117c1a4f4fc2f11861c5f142071d56977 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 aac0fb198fb912dc59dc56f449e586839600fa13..3b2d54d7a365e268107c4abc5a15c996954e5e9c 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
@@ -961,5 +961,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
|
|
}
|