Guest User

Untitled

a guest
May 17th, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. package net.minecraft.src;
  2.  
  3. import java.util.Random;
  4.  
  5. public class ItemAmethystBow extends Item
  6. {
  7.  
  8. public ItemAmethystBow(int i)
  9. {
  10. super(i);
  11. maxStackSize = 1;
  12. setMaxDamage(384);
  13. }
  14.  
  15. public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag)
  16. {
  17. EntityPlayer entityplayer = (EntityPlayer)entity;
  18. ItemStack itemstack1 = entityplayer.inventory.getCurrentItem();
  19. if(entityplayer.isUsingItem() && itemstack1.itemID == mod_LEM.AmethystBow.shiftedIndex)
  20. {
  21. int k = itemstack.getMaxItemUseDuration() - entityplayer.func_35205_Y();
  22. if(k >= 18)
  23. {
  24. iconIndex = mod_LEM.AmethystBow4;
  25. }else
  26. if(k > 13)
  27. {
  28. iconIndex = mod_LEM.AmethystBow3;
  29. }else
  30. if(k > 0)
  31. {
  32. iconIndex = mod_LEM.AmethystBow2;
  33. }else
  34. iconIndex = mod_LEM.AmethystBow1;
  35. }
  36. }
  37.  
  38. public void onPlayerStoppedUsing(ItemStack itemstack, World world, EntityPlayer entityplayer, int i)
  39. {
  40. int j = getMaxItemUseDuration(itemstack) - i;
  41. float f = (float)j / 20F;
  42. f = (f * f + f * 2.0F) / 3F;
  43. if((double)f < 0.10000000000000001D)
  44. {
  45. return;
  46. }
  47. if(f > 1.0F)
  48. {
  49. f = 1.0F;
  50. }
  51. EntityAmethystArrow entityamethystarrow = new EntityAmethystArrow(world, entityplayer, f * 2.0F);
  52. itemstack.damageItem(1, entityplayer);
  53. world.playSoundAtEntity(entityplayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
  54. world.entityJoinedWorld(entityamethystarrow);
  55. }
  56.  
  57. public ItemStack onFoodEaten(ItemStack itemstack, World world, EntityPlayer entityplayer)
  58. {
  59. return itemstack;
  60. }
  61.  
  62. public int getMaxItemUseDuration(ItemStack itemstack)
  63. {
  64. return 0x11940;
  65. }
  66.  
  67. public EnumAction getItemUseAction(ItemStack itemstack)
  68. {
  69. return EnumAction.bow;
  70. }
  71.  
  72. public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
  73. {
  74. entityplayer.setItemInUse(itemstack, getMaxItemUseDuration(itemstack));
  75. return itemstack;
  76. }
  77. }
Add Comment
Please, Sign In to add comment