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
|
|
|
|
|
2023-02-07 16:43:20 +01:00
|
|
|
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
|
2024-04-06 21:53:39 +02:00
|
|
|
index 844a97b0eb396835ec72b4d14c9362a2ea2a8709..75dccbdde0d116ef194aa2ced328ad3c3992204e 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
|
2024-04-06 21:53:39 +02:00
|
|
|
@@ -283,10 +283,29 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
2023-02-07 16:43:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@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
|
2024-02-09 21:56:13 +01:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Paper start - Add methods for working with arrows stuck in living entities
|
|
|
|
+ @Override
|
|
|
|
+ public void setNextArrowRemoval(final int ticks) {
|
|
|
|
+ Preconditions.checkArgument(ticks >= 0, "New amount of ticks before next arrow removal must be >= 0");
|
|
|
|
+ this.getHandle().removeArrowTime = ticks;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int getNextArrowRemoval() {
|
|
|
|
+ return this.getHandle().removeArrowTime;
|
2023-02-07 16:43:20 +01:00
|
|
|
}
|
2024-02-09 21:56:13 +01:00
|
|
|
+ // Paper end - Add methods for working with arrows stuck in living entities
|
2023-02-07 16:43:20 +01:00
|
|
|
|
|
|
|
@Override
|
2024-02-09 21:56:13 +01:00
|
|
|
public void damage(double amount) {
|
2024-04-06 21:53:39 +02:00
|
|
|
@@ -815,4 +834,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() {
|
2023-02-07 16:43:20 +01:00
|
|
|
+ return this.getHandle().getArrowCount();
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
2023-02-07 16:43:20 +01:00
|
|
|
+ public void setArrowsStuck(final int arrows) {
|
|
|
|
+ this.getHandle().setArrowCount(arrows);
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|