mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-05 23:21:38 +01:00
Add API for item entity health
== AT == public net.minecraft.world.entity.item.ItemEntity health
This commit is contained in:
parent
33f49c215c
commit
9d08734937
@ -98,6 +98,21 @@ public class CraftItem extends CraftEntity implements Item {
|
|||||||
public void setWillAge(boolean willAge) {
|
public void setWillAge(boolean willAge) {
|
||||||
this.getHandle().age = willAge ? 0 : NO_AGE_TIME;
|
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
|
// Paper end
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user