TGAM123

ItemTube

Apr 8th, 2011
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.72 KB | None | 0 0
  1. package net.minecraft.src;
  2. // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
  3. // Jad home page: http://www.kpdus.com/jad.html
  4. // Decompiler options: packimports(3) braces deadcode
  5.  
  6. import java.util.Random;
  7.  
  8. public class ItemTube extends Item
  9. {
  10.  
  11. public ItemTube(int i, int j)
  12. {
  13. super(i);
  14. maxStackSize = 1;
  15. isFull = j;
  16. }
  17.  
  18. public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
  19. {
  20. float f = 1.0F;
  21. float f1 = entityplayer.prevRotationPitch + (entityplayer.rotationPitch - entityplayer.prevRotationPitch) * f;
  22. float f2 = entityplayer.prevRotationYaw + (entityplayer.rotationYaw - entityplayer.prevRotationYaw) * f;
  23. double d = entityplayer.prevPosX + (entityplayer.posX - entityplayer.prevPosX) * (double)f;
  24. double d1 = (entityplayer.prevPosY + (entityplayer.posY - entityplayer.prevPosY) * (double)f + 1.6200000000000001D) - (double)entityplayer.yOffset;
  25. double d2 = entityplayer.prevPosZ + (entityplayer.posZ - entityplayer.prevPosZ) * (double)f;
  26. Vec3D vec3d = Vec3D.createVector(d, d1, d2);
  27. float f3 = MathHelper.cos(-f2 * 0.01745329F - 3.141593F);
  28. float f4 = MathHelper.sin(-f2 * 0.01745329F - 3.141593F);
  29. float f5 = -MathHelper.cos(-f1 * 0.01745329F);
  30. float f6 = MathHelper.sin(-f1 * 0.01745329F);
  31. float f7 = f4 * f5;
  32. float f8 = f6;
  33. float f9 = f3 * f5;
  34. double d3 = 5D;
  35. Vec3D vec3d1 = vec3d.addVector((double)f7 * d3, (double)f8 * d3, (double)f9 * d3);
  36. MovingObjectPosition movingobjectposition = world.rayTraceBlocks_do(vec3d, vec3d1, isFull == 0);
  37. if(movingobjectposition == null)
  38. {
  39. return itemstack;
  40. }
  41. if(movingobjectposition.typeOfHit == EnumMovingObjectType.TILE)
  42. {
  43. int i = movingobjectposition.blockX;
  44. int j = movingobjectposition.blockY;
  45. int k = movingobjectposition.blockZ;
  46. if(!world.func_6466_a(entityplayer, i, j, k))
  47. {
  48. return itemstack;
  49. }
  50. if(isFull == 0)
  51. {
  52. if(world.getBlockMaterial(i, j, k) == Material.water && world.getBlockMetadata(i, j, k) == 0)
  53. {
  54. world.setBlockWithNotify(i, j, k, 0);
  55. return new ItemStack(mod_Chemistry.ItemTubeWater);
  56. }
  57. if(world.getBlockMaterial(i, j, k) == Material.lava && world.getBlockMetadata(i, j, k) == 0)
  58. {
  59. world.setBlockWithNotify(i, j, k, 0);
  60. return new ItemStack(mod_Chemistry.ItemTubeLava);
  61. }
  62. } else
  63. {
  64. if(isFull < 0)
  65. {
  66. return new ItemStack(mod_Chemistry.ItemTube);
  67. }
  68. if(movingobjectposition.sideHit == 0)
  69. {
  70. j--;
  71. }
  72. if(movingobjectposition.sideHit == 1)
  73. {
  74. j++;
  75. }
  76. if(movingobjectposition.sideHit == 2)
  77. {
  78. k--;
  79. }
  80. if(movingobjectposition.sideHit == 3)
  81. {
  82. k++;
  83. }
  84. if(movingobjectposition.sideHit == 4)
  85. {
  86. i--;
  87. }
  88. if(movingobjectposition.sideHit == 5)
  89. {
  90. i++;
  91. }
  92. if(world.isAirBlock(i, j, k) || !world.getBlockMaterial(i, j, k).isSolid())
  93. {
  94. if(world.worldProvider.isHellWorld && isFull == Block.waterMoving.blockID)
  95. {
  96. world.playSoundEffect(d + 0.5D, d1 + 0.5D, d2 + 0.5D, "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
  97. for(int l = 0; l < 8; l++)
  98. {
  99. world.spawnParticle("largesmoke", (double)i + Math.random(), (double)j + Math.random(), (double)k + Math.random(), 0.0D, 0.0D, 0.0D);
  100. }
  101.  
  102. } else
  103. {
  104. world.setBlockAndMetadataWithNotify(i, j, k, isFull, 0);
  105. }
  106. return new ItemStack(mod_Chemistry.ItemTube);
  107. }
  108. }
  109. } else
  110. if(isFull == 0 && (movingobjectposition.entityHit instanceof EntityCow))
  111. {
  112. return new ItemStack(mod_Chemistry.ItemTubeMilk);
  113. }
  114. return itemstack;
  115. }
  116.  
  117. private int isFull;
  118. }
Advertisement
Add Comment
Please, Sign In to add comment