Advertisement
gegy1000

Untitled

Jan 22nd, 2015
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. public void onUsingTick(ItemStack stack, EntityPlayer player, int count)
  2. {
  3. int duration = this.getMaxItemUseDuration(stack) - count;
  4.  
  5. if (player.inventory.hasItem(TFItems.energonCrystalPiece) || player.capabilities.isCreativeMode)
  6. {
  7. if (duration > 1 && duration < 80)
  8. {
  9. Random rand = new Random();
  10.  
  11. double cos = Math.cos(player.rotationYaw * Math.PI / 180.0f);
  12. double sin = Math.sin(player.rotationYaw * Math.PI / 180.0f);
  13.  
  14. double motionX = -sin * 0.5;
  15. double motionZ = cos * 0.5;
  16.  
  17. for (int i = 0; i < 20; i++)
  18. {
  19. float randFloatX = rand.nextFloat() / 4;
  20.  
  21. if(rand.nextInt(2) == 0)
  22. {
  23. randFloatX = -randFloatX;
  24. }
  25.  
  26. float randFloatY = rand.nextFloat() / 4;
  27.  
  28. if(rand.nextInt(2) == 0)
  29. {
  30. randFloatY = -randFloatY;
  31. }
  32.  
  33. float randFloatZ = rand.nextFloat() / 4;
  34.  
  35. if(rand.nextInt(2) == 0)
  36. {
  37. randFloatZ = -randFloatZ;
  38. }
  39.  
  40. player.worldObj.spawnParticle("flame", (motionX * 2) + player.posX + randFloatX, player.posY + randFloatY, (motionZ * 2) + player.posZ + randFloatZ, motionX + rand.nextFloat() / 4, randFloatY, motionZ + randFloatZ / 4);
  41. }
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement