mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 11:06:29 +01:00
47 lines
1.8 KiB
Diff
47 lines
1.8 KiB
Diff
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
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
index a112ee18b272e2d5a61ddbb2c884169b6c6d0aec..fcb07a5f8cac994b731e3345ba9e971faa482fa1 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
@@ -265,9 +265,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
|
|
@@ -761,4 +767,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|
this.getHandle().persistentInvisibility = invisible;
|
|
this.getHandle().setSharedFlag(5, invisible);
|
|
}
|
|
+
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public int getArrowsStuck() {
|
|
+ return this.getHandle().getArrowCount();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setArrowsStuck(final int arrows) {
|
|
+ this.getHandle().setArrowCount(arrows);
|
|
+ }
|
|
+ // Paper end
|
|
}
|