Guest User

Untitled

a guest
Aug 3rd, 2017
98
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.mod.drakania.ring;
  2.  
  3. import com.mod.drakania.init.ItemMod;
  4.  
  5. import net.minecraft.entity.Entity;
  6. import net.minecraft.entity.player.EntityPlayer;
  7. import net.minecraft.init.Items;
  8. import net.minecraft.item.Item;
  9. import net.minecraft.item.ItemStack;
  10. import net.minecraft.world.World;
  11.  
  12. public class smallring extends Item
  13. {
  14.  
  15. public smallring()
  16. {
  17. this.setMaxDamage(500);
  18. this.setMaxStackSize(1);
  19. }
  20.  
  21. public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean selected)
  22. {
  23. if(stack.getItem() == Items.diamond_boots || stack.getItem() == Items.diamond_leggings || stack.getItem() == Items.diamond_chestplate || stack.getItem() == Items.diamond_helmet);
  24. {
  25. EntityPlayer player = (EntityPlayer)entity;
  26. for(int i = 0; i < 4; i++)
  27. {
  28. ItemStack armor = player.getCurrentArmor(i);
  29. if(armor != null && armor.getItemDamage() > 0 && stack.getItemDamage() < stack.getMaxDamage())
  30. {
  31. stack.setItemDamage(stack.getItemDamage() + 1);
  32. armor.setItemDamage(armor.getItemDamage() - 1);
  33. }
  34. }
  35.  
  36. }
  37.  
  38. }
  39. }
RAW Paste Data