Advertisement
DEv0on

Untitled

Nov 21st, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1.  
  2. public void processData(EntityPlayer entityPlayer, ByteBufInputStream bbis) throws IOException {
  3. ItemStack itemStack = entityPlayer.getHeldItem();
  4. if (itemStack != null) {
  5. boolean incDmg = bbis.readBoolean();
  6. int maxDmg = 15;
  7. int itemDmg = itemStack.getItemDamage();
  8. itemDmg += incDmg ? 1 : -1;
  9. if (itemDmg > maxDmg) {
  10. itemDmg = 0;
  11. } else if (itemDmg < 0) {
  12. itemDmg = maxDmg;
  13. }
  14.  
  15. itemStack.setItemDamage(itemDmg);
  16. }
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement