Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2013
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. @Override
  2. public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
  3. {
  4.  
  5. if(itemStack.stackTagCompound == null)
  6. {
  7.  
  8. createNBT(itemStack);
  9.  
  10. }
  11.  
  12. if(player.isSneaking())
  13. {
  14.  
  15. int mode = itemStack.stackTagCompound.getInteger("mode");
  16.  
  17. switch(mode)
  18. {
  19.  
  20. case(0):{itemStack.stackTagCompound.setInteger("mode", 1);InfoUtil.chat(player, "Switched mode to withdraw.");break;}
  21. case(1):{itemStack.stackTagCompound.setInteger("mode", 0);InfoUtil.chat(player, "Switched mode to deposit.");break;}
  22.  
  23. }
  24.  
  25. Random r = new Random();
  26.  
  27. player.playSound("random.orb", 0.1F, 0.5F * ((r.nextFloat() - r.nextFloat()) * 0.7F + 1.8F));
  28.  
  29. }
  30.  
  31. if(!player.isSneaking())
  32. {
  33.  
  34. int mode = itemStack.stackTagCompound.getInteger("mode");
  35.  
  36. switch(mode)
  37. {
  38.  
  39. case(0):
  40. {
  41.  
  42. float x = itemStack.stackTagCompound.getFloat("stored");
  43.  
  44. if(player.experienceLevel >= 1 && x != 30)
  45. {
  46.  
  47. player.experienceLevel--;
  48.  
  49. itemStack.stackTagCompound.setFloat("stored", x + 1);
  50.  
  51. Random r = new Random();
  52.  
  53. player.playSound("random.orb", 0.1F, 0.5F * ((r.nextFloat() - r.nextFloat()) * 0.7F + 1.8F));
  54.  
  55. player.attackEntityFrom(DamageSource.magic, 2.0F);
  56.  
  57. }
  58.  
  59. break;
  60.  
  61. }
  62.  
  63. case(1):
  64. {
  65.  
  66. float y = itemStack.stackTagCompound.getFloat("stored");
  67.  
  68. if(y >= 1)
  69. {
  70.  
  71. player.experienceLevel++;
  72.  
  73. float z = itemStack.stackTagCompound.getFloat("stored");
  74.  
  75. itemStack.stackTagCompound.setFloat("stored", z - 1);
  76.  
  77. Random r = new Random();
  78.  
  79. player.playSound("random.orb", 0.1F, 0.5F * ((r.nextFloat() - r.nextFloat()) * 0.7F + 1.8F));
  80.  
  81. player.attackEntityFrom(DamageSource.magic, 2.0F);
  82.  
  83. }
  84.  
  85. break;
  86.  
  87. }
  88.  
  89. }
  90.  
  91. }
  92.  
  93. return itemStack;
  94.  
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement