aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0835-Add-API-for-item-entity-health.patch
diff options
context:
space:
mode:
authorJake Potrebic <[email protected]>2021-12-22 10:02:31 -0800
committerGitHub <[email protected]>2021-12-22 10:02:31 -0800
commit82eaf4ee15d77303cdd352cce9b33c2f3e5d14d7 (patch)
tree53e4a42978675fc17acc76b85dcb0c3569ab3e3b /patches/server/0835-Add-API-for-item-entity-health.patch
parent6e5ceb34eb2ef4d6c0a35c46d0eded9099bb2fee (diff)
downloadPaper-82eaf4ee15d77303cdd352cce9b33c2f3e5d14d7.tar.gz
Paper-82eaf4ee15d77303cdd352cce9b33c2f3e5d14d7.zip
Fix duplicated BlockPistonRetractEvent call (#7111)
Diffstat (limited to 'patches/server/0835-Add-API-for-item-entity-health.patch')
-rw-r--r--patches/server/0835-Add-API-for-item-entity-health.patch32
1 files changed, 32 insertions, 0 deletions
diff --git a/patches/server/0835-Add-API-for-item-entity-health.patch b/patches/server/0835-Add-API-for-item-entity-health.patch
new file mode 100644
index 0000000000..c475b8fda1
--- /dev/null
+++ b/patches/server/0835-Add-API-for-item-entity-health.patch
@@ -0,0 +1,32 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jake Potrebic <[email protected]>
+Date: Sat, 28 Aug 2021 09:00:45 -0700
+Subject: [PATCH] Add API for item entity health
+
+
+diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
+index 342345eb04d00efb58392ccf209e3c51c1064173..8d56f0ab748373e55c0166b92382c126fe8e5381 100644
+--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
+@@ -85,6 +85,21 @@ public class CraftItem extends CraftEntity implements Item {
+ public void setWillAge(boolean willAge) {
+ item.age = willAge ? 0 : NO_AGE_TIME;
+ }
++
++ @Override
++ public int getHealth() {
++ return item.health;
++ }
++
++ @Override
++ public void setHealth(int health) {
++ if (health <= 0) {
++ item.getItem().onDestroyed(item);
++ item.discard();
++ } else {
++ item.health = health;
++ }
++ }
+ // Paper End
+
+ @Override