Changed getHeldItem and setHeldItem in enderman and flagwatcher to setItemInHand

This commit is contained in:
libraryaddict 2013-12-05 21:27:46 +13:00
parent 40694c5030
commit a759cfaa59
2 changed files with 22 additions and 0 deletions

View File

@ -167,7 +167,12 @@ public class FlagWatcher {
return ((Byte) getValue(0, (byte) 0) & 1 << i) != 0; return ((Byte) getValue(0, (byte) 0) & 1 << i) != 0;
} }
@Deprecated
public org.bukkit.inventory.ItemStack getHeldItem() { public org.bukkit.inventory.ItemStack getHeldItem() {
return getItemInHand();
}
public org.bukkit.inventory.ItemStack getItemInHand() {
return getItemStack(SlotType.HELD_ITEM); return getItemStack(SlotType.HELD_ITEM);
} }
@ -272,7 +277,12 @@ public class FlagWatcher {
} }
} }
@Deprecated
public void setHeldItem(org.bukkit.inventory.ItemStack itemstack) { public void setHeldItem(org.bukkit.inventory.ItemStack itemstack) {
setItemInHand(itemstack);
}
public void setItemInHand(org.bukkit.inventory.ItemStack itemstack) {
setItemStack(SlotType.HELD_ITEM, itemstack); setItemStack(SlotType.HELD_ITEM, itemstack);
} }

View File

@ -21,7 +21,13 @@ public class EndermanWatcher extends LivingWatcher {
} }
@Override @Override
@Deprecated
public ItemStack getHeldItem() { public ItemStack getHeldItem() {
return getItemInHand();
}
@Override
public ItemStack getItemInHand() {
return new ItemStack((Byte) getValue(16, (byte) 0), 1, ((Byte) getValue(17, (byte) 0))); return new ItemStack((Byte) getValue(16, (byte) 0), 1, ((Byte) getValue(17, (byte) 0)));
} }
@ -49,7 +55,13 @@ public class EndermanWatcher extends LivingWatcher {
} }
@Override @Override
@Deprecated
public void setHeldItem(ItemStack itemstack) { public void setHeldItem(ItemStack itemstack) {
setItemInHand(itemstack);
}
@Override
public void setItemInHand(ItemStack itemstack) {
setValue(16, (byte) (itemstack.getTypeId() & 255)); setValue(16, (byte) (itemstack.getTypeId() & 255));
setValue(17, (byte) (itemstack.getDurability() & 255)); setValue(17, (byte) (itemstack.getDurability() & 255));
} }