geforkt von Mirrors/Paper
275173e538
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: 0c5d8709 SPIGOT-7400: Downgrade maven-resolver due to issues resolving certain depends 255c4fdb SPIGOT-7380: Add PlayerInteractEvent#getClickedPosition and ChiseledBookshelf#getSlot CraftBukkit Changes: b6b514b7e SPIGOT-7400: Downgrade maven-resolver due to issues resolving certain depends fcff84de9 SPIGOT-7399: Revert null check in CraftMetaItem#safelyAdd 44a4b5649 SPIGOT-7380: Add PlayerInteractEvent#getClickedPosition and ChiseledBookshelf#getSlot 676969d01 SPIGOT-7389: Handle setting null items in ChiseledBookshelf Inventory
35 Zeilen
1.1 KiB
Diff
35 Zeilen
1.1 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:45 -0700
|
|
Subject: [PATCH] Add API for item entity health
|
|
|
|
== AT ==
|
|
public net.minecraft.world.entity.item.ItemEntity health
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
|
index 27e961653dc66fbe8d5421eef04260b91ca410f4..e9946edf568db010e4ccb9fe7755709ed7b8310f 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
|
@@ -102,6 +102,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
|