Added item-in-hand related API.

By: sk89q <the.sk89q@gmail.com>
This commit is contained in:
CraftBukkit/Spigot 2011-01-15 19:33:28 -08:00
parent dbc9e0eb55
commit 88cf954f4e
2 changed files with 12 additions and 0 deletions

View file

@ -40,6 +40,10 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
return getInventory().getItemInHand();
}
public void setItemInHand(ItemStack item) {
getInventory().setItemInHand(item);
}
@Override
public String toString() {
return "CraftHumanEntity{" + "id=" + getEntityId() + "name=" + getName() + '}';

View file

@ -22,6 +22,14 @@ public class CraftInventoryPlayer extends CraftInventory implements PlayerInvent
return new CraftItemStack( getInventory().e() );
}
public void setItemInHand(ItemStack stack) {
setItem( getHeldItemSlot(), stack );
}
public int getHeldItemSlot() {
return getInventory().c;
}
public CraftItemStack getHelmet() {
return getItem( getSize() + 0 );
}