diff options
author | maxcom1 <[email protected]> | 2024-03-23 22:26:17 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2024-03-23 17:26:17 -0400 |
commit | b6001403e9703cadaa6e8c8558e732b91c3c6d6e (patch) | |
tree | a8c57bbc334a8ad48d4ad2b43db335667b142bee /patches/server/0467-Expose-LivingEntity-hurt-direction.patch | |
parent | 9ec7dfcbc41c6e625de0050b6997160a75df9f44 (diff) | |
download | Paper-b6001403e9703cadaa6e8c8558e732b91c3c6d6e.tar.gz Paper-b6001403e9703cadaa6e8c8558e732b91c3c6d6e.zip |
Add methods to change entity physics (#10334)
Diffstat (limited to 'patches/server/0467-Expose-LivingEntity-hurt-direction.patch')
-rw-r--r-- | patches/server/0467-Expose-LivingEntity-hurt-direction.patch | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/patches/server/0467-Expose-LivingEntity-hurt-direction.patch b/patches/server/0467-Expose-LivingEntity-hurt-direction.patch new file mode 100644 index 0000000000..73f36c0bb3 --- /dev/null +++ b/patches/server/0467-Expose-LivingEntity-hurt-direction.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mark Vainomaa <[email protected]> +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 + } |