Paper/patches/server/0063-Add-methods-for-working-with-arrows-stuck-in-living-.patch

47 lines
1.8 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: mrapple <tony@oc.tc>
Date: Sun, 25 Nov 2012 13:43:39 -0600
Subject: [PATCH] Add methods for working with arrows stuck in living entities
Upstream added methods for this, original methods are now
deprecated
2021-06-11 14:02:28 +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-03-14 19:36:39 +01:00
index 1f67ac4484e3ee2e0a25030e0080a671f34e1a58..3084fa8000b36f06e8d432bff124a5af4ea675ea 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -266,9 +266,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
}
@Override
- public void setArrowsInBody(int count) {
+ public void setArrowsInBody(final int count, final boolean fireEvent) { // Paper
Preconditions.checkArgument(count >= 0, "New arrow amount must be >= 0");
+ if (!fireEvent) { // Paper
this.getHandle().getEntityData().set(net.minecraft.world.entity.LivingEntity.DATA_ARROW_COUNT_ID, count);
+ // Paper start
+ } else {
+ this.getHandle().setArrowCount(count);
+ }
+ // Paper end
}
@Override
@@ -764,4 +770,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
2021-06-12 02:57:04 +02:00
this.getHandle().persistentInvisibility = invisible;
this.getHandle().setSharedFlag(5, invisible);
2021-06-11 14:02:28 +02:00
}
+
+ // Paper start
+ @Override
+ public int getArrowsStuck() {
+ return this.getHandle().getArrowCount();
2021-06-11 14:02:28 +02:00
+ }
+
+ @Override
+ public void setArrowsStuck(final int arrows) {
+ this.getHandle().setArrowCount(arrows);
2021-06-11 14:02:28 +02:00
+ }
+ // Paper end
}