ItemStack.setDamage and ItemStack.getDamage

This commit is contained in:
Dinnerbone 2011-01-04 19:54:41 +00:00
parent 9296dd3ca1
commit a7e432df19

View File

@ -7,6 +7,7 @@ package org.bukkit;
public class ItemStack { public class ItemStack {
private int type; private int type;
private int amount = 0; private int amount = 0;
private byte damage = 0;
public ItemStack(final int type) { public ItemStack(final int type) {
this.type = type; this.type = type;
@ -78,4 +79,30 @@ public class ItemStack {
public void setAmount(int amount) { public void setAmount(int amount) {
this.amount = amount; this.amount = amount;
} }
/**
* Sets the damage of this item<br /><br />
*
* 0x00 represents an item which cannot be damaged<br />
* 0x01 represents an item at maximum health<br />
* 0x32 represents an item with no health left
*
* @param damage Damage of this item
*/
public void setDamage(final byte damage) {
this.damage = damage;
}
/**
* Gets the damage of this item<br /><br />
*
* 0x00 represents an item which cannot be damaged<br />
* 0x01 represents an item at maximum health<br />
* 0x32 represents an item with no health left
*
* @return Damage of this item
*/
public byte getDamage() {
return damage;
}
} }