Paper/patches/api/0337-Add-API-for-item-entity-health.patch
Jake Potrebic 5730a94208
Updated Upstream (Bukkit/CraftBukkit) (#8991)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
2b4582fb SPIGOT-5916: getLastColors does not work with the rgb colors

CraftBukkit Changes:
f7707086d SPIGOT-7299: Fix indirect/anvil damage events and minor improvements
2023-03-18 10:05:04 -07:00

36 lines
1.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sat, 28 Aug 2021 09:00:35 -0700
Subject: [PATCH] Add API for item entity health
diff --git a/src/main/java/org/bukkit/entity/Item.java b/src/main/java/org/bukkit/entity/Item.java
index 48858e1c58c13d786bbc935abedb0f059837833c..d0bef15785493b512ff0f7414c1d58d38fead581 100644
--- a/src/main/java/org/bukkit/entity/Item.java
+++ b/src/main/java/org/bukkit/entity/Item.java
@@ -133,5 +133,24 @@ public interface Item extends Entity {
* @param willAge True if the item should age
*/
public void setWillAge(boolean willAge);
+
+ /**
+ * Gets the health of item stack.
+ * <p>
+ * Currently the default max health is 5.
+ *
+ * @return the health
+ */
+ public int getHealth();
+
+ /**
+ * Sets the health of the item stack. If the value is non-positive
+ * the itemstack's normal "on destroy" functionality will be run.
+ * <p>
+ * Currently, the default max health is 5.
+ *
+ * @param health the health, a non-positive value will destroy the entity
+ */
+ public void setHealth(int health);
// Paper end
}