Advertisement
riking

test

Oct 24th, 2011
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.60 KB | None | 0 0
  1. // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
  2. // Jad home page: http://www.kpdus.com/jad.html
  3. // Decompiler options: packimports(3) braces deadcode
  4.  
  5. package net.minecraft.src;
  6.  
  7. import java.io.PrintStream;
  8. import java.util.List;
  9. import java.util.Random;
  10.  
  11. import net.minecraft.client.Minecraft;
  12.  
  13. public class PaintballEntityClaymores extends PaintballEntityObjects
  14. {
  15. float anglerange;
  16. public PaintballEntityClaymores(World world)
  17. {
  18. super(world);
  19. setSize(0.5F, 0.5F);
  20. moveSpeed = 0.0F;
  21. health = 1;
  22. hasAttacked = false;
  23. isImmuneToFire = true;
  24. }
  25.  
  26. public PaintballEntityClaymores(World world, boolean color, double d, double d1, double d2)
  27. {
  28. this(world);
  29. setPosition(d, d1, d2);
  30. motionX = 0.0D;
  31. motionY = 0.0D;
  32. motionZ = 0.0D;
  33. prevPosX = d;
  34. prevPosY = d1;
  35. prevPosZ = d2;
  36. claymore_isRed = color;
  37. EntityPlayer entity = findPlayerToWub();
  38. if(entity != null)
  39. {
  40. faceEntity(entity, 180F, 180F);
  41. rotationYaw -= 180;
  42. renderYawOffset = rotationYaw;
  43. }
  44. }
  45.  
  46. protected EntityPlayer findPlayerToWub()
  47. {
  48. EntityPlayer entityplayer = worldObj.getClosestPlayerToEntity(this, 16D);
  49. if(entityplayer != null && canEntityBeSeen(entityplayer))
  50. {
  51. return entityplayer;
  52. } else
  53. {
  54. return null;
  55. }
  56. }
  57.  
  58. public void onUpdate()
  59. {
  60. super.onUpdate();
  61. List list1;
  62. if(!claymore_isRed)
  63. {
  64. texture = "/PaintballPics/blueclaymore.png";
  65. List list1 = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.expand(0.0D, 0.0D, 0.0D));
  66. } else {
  67. texture = "/PaintballPics/redclaymore.png";
  68. List list1 = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.expand(0.0D, 0.0D, 0.0D));
  69. }
  70. for(int x = 0; x < list1.size(); x++)
  71. {
  72. Entity entity1 = (Entity)list1.get(x);
  73. double playerangle=Math.toDegrees(Math.atan2(entity1.posZ-this.posZ,entity1.posX - this.posX)); //java.lang.Math
  74. playerangle = playerangle < 0 ? playerangle + 180F : playerangle; //justify both to > 0 just in case
  75. rotationYaw = rotationYaw < 0 ? rotationYaw + 180F : rotationYaw;
  76. if(playerangle < rotationYaw-anglerange) continue;
  77. if(playerangle > rotationYaw+anglerange) continue;
  78. if(entity1 instanceof EntityPlayer)
  79. {
  80.  
  81. EntityPlayer player = (EntityPlayer)entity1;
  82. boolean notsameteam = (claymore.isRed && (player.inventory.armorInventory[3] == null || player.inventory.armorInventory[3].itemID != mod_Paintball.RedHelmet.shiftedIndex
  83. || player.inventory.armorInventory[2] == null || player.inventory.armorInventory[2].itemID != mod_Paintball.RedPlate.shiftedIndex
  84. || player.inventory.armorInventory[1] == null || player.inventory.armorInventory[1].itemID != mod_Paintball.RedLegs.shiftedIndex
  85. || player.inventory.armorInventory[0] == null || player.inventory.armorInventory[0].itemID != mod_Paintball.RedBoots.shiftedIndex))
  86. ||
  87. (!claymore.isRed && (player.inventory.armorInventory[3] == null || player.inventory.armorInventory[3].itemID != mod_Paintball.BlueHelmet.shiftedIndex
  88. || player.inventory.armorInventory[2] == null || player.inventory.armorInventory[2].itemID != mod_Paintball.BluePlate.shiftedIndex
  89. || player.inventory.armorInventory[1] == null || player.inventory.armorInventory[1].itemID != mod_Paintball.BlueLegs.shiftedIndex
  90. || player.inventory.armorInventory[0] == null || player.inventory.armorInventory[0].itemID != mod_Paintball.BlueBoots.shiftedIndex));
  91. if(notsameteam)
  92. {
  93. entity1.attackEntityFrom(DamageSource.causePlayerDamage(player), 10);
  94. explode();
  95. }
  96. }
  97. else
  98. {
  99. entity1.attackEntityFrom(DamageSource.generic, 10);
  100. explode();
  101. }
  102. }
  103. }
  104.  
  105. private void explode()
  106. {
  107. for(int jack = 0; jack < 60; jack++)
  108. {
  109. double d1, d2, d3, d4, d5, d6;
  110. d1 = posX + ((rand.nextFloat() - rand.nextFloat()) * 0.125F);
  111. d2 = boundingBox.minY + 0.25F + ((rand.nextFloat() - rand.nextFloat()) * 0.125F);
  112. d3 = posZ + ((rand.nextFloat() - rand.nextFloat()) * 0.125F);
  113. double g1 = (double)jack * 0.25D;
  114. double g2 = 0.075D + ((double)jack * 0.01D);
  115. d4 = Math.sin(g1) * g2;
  116. d5 = (rand.nextFloat() - rand.nextFloat()) * 0.3D;
  117. d6 = Math.cos(g1) * g2;
  118. String stringy = (rand.nextInt(5) < 3 ? "explode" : "smoke");
  119. worldObj.spawnParticle(stringy, d1, d2, d3, d4, d5, d6);
  120. }
  121. worldObj.playSoundEffect(posX, posY, posZ, "random.explode", 1F, (1.0F + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2F) * 0.7F);
  122. setEntityDead();
  123. }
  124.  
  125. public void writeEntityToNBT(NBTTagCompound nbttagcompound)
  126. {
  127. nbttagcompound.setBoolean("Color", claymore_isRed);
  128. }
  129.  
  130. public void readEntityFromNBT(NBTTagCompound nbttagcompound)
  131. {
  132. claymore_isRed = nbttagcompound.getBoolean("Color");
  133. }
  134.  
  135. protected int getDropItemId()
  136. {
  137. if(claymore_isRed)
  138. {
  139. entityDropItem(new ItemStack(mod_Paintball.PaintballClaymoreRed), 0.0F);
  140. }
  141. else
  142. {
  143. entityDropItem(new ItemStack(mod_Paintball.PaintballClaymoreBlue), 0.0F);
  144. }
  145. return 0;
  146. }
  147.  
  148. public boolean claymore_isRed;
  149.  
  150. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement