Advertisement
Guest User

Blessed Pick class

a guest
Mar 1st, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. //String namE = "blessedPick";
  2. String toggle = "Enabled";
  3.  
  4. //adds tooltip(duh?)
  5. @Override
  6. public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
  7. {
  8. tooltip.add("Right Click " + toggle);
  9. }
  10.  
  11. @Override
  12. public void onUpdate(ItemStack itemstack, World world, Entity entity, int metadata, boolean bool)
  13. {
  14. if (itemstack.getTagCompound() == null)
  15. {
  16. itemstack.setTagCompound(new NBTTagCompound());
  17. String toggle = "Enabled";
  18. itemstack.getTagCompound().setBoolean("state", true);
  19. }
  20. /*
  21. if(itemstack.getTagCompound().getBoolean("state")==true)
  22. {
  23. String namE = "blessedPick";
  24. }
  25. if(itemstack.getTagCompound().getBoolean("state")==false)
  26. {
  27. String namE = "blessedPick1";
  28. String toggle = "Disabled";
  29. }
  30. */
  31. }
  32.  
  33.  
  34.  
  35. //So when you hold right click you get haste, last 1 second after clicking
  36. @Override
  37. public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer player)
  38. {
  39. if(!worldIn.isRemote)
  40. {
  41. if(player.isSneaking())
  42. {
  43. if(itemStackIn.getTagCompound().getBoolean("state")==true)
  44. {
  45. itemStackIn.getTagCompound().setBoolean("state", false);
  46. }
  47. if(itemStackIn.getTagCompound().getBoolean("state")==false)
  48. {
  49. itemStackIn.getTagCompound().setBoolean("state", true);
  50. }
  51.  
  52. }
  53. if(!player.isSneaking())
  54. {
  55. if(itemStackIn.getTagCompound().getBoolean("state")==true)
  56. {
  57. player.addPotionEffect((new PotionEffect(Potion.digSpeed.getId(), 400, 1)));
  58. player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 300, 1)));
  59. player.addPotionEffect((new PotionEffect(Potion.fireResistance.getId(), 60, 1)));
  60. itemStackIn.damageItem(5, player);
  61. }
  62. }
  63. }
  64. return itemStackIn;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement