Add API for item entity health

== AT ==
public net.minecraft.world.entity.item.ItemEntity health
This commit is contained in:
Jake Potrebic 2021-08-28 09:00:45 -07:00
parent 33f49c215c
commit 9d08734937

View File

@ -98,6 +98,21 @@ public class CraftItem extends CraftEntity implements Item {
public void setWillAge(boolean willAge) {
this.getHandle().age = willAge ? 0 : NO_AGE_TIME;
}
@Override
public int getHealth() {
return this.getHandle().health;
}
@Override
public void setHealth(int health) {
if (health <= 0) {
this.getHandle().getItem().onDestroyed(this.getHandle());
this.getHandle().discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.PLUGIN);
} else {
this.getHandle().health = health;
}
}
// Paper end
@Override