Advertisement
Guest User

Untitled

a guest
Oct 1st, 2014
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1. package fr.elias.adminweapons.common;
  2.  
  3. import java.util.List;
  4.  
  5. import net.minecraft.entity.Entity;
  6. import net.minecraft.entity.EntityCreature;
  7. import net.minecraft.entity.EntityLivingBase;
  8. import net.minecraft.entity.effect.EntityLightningBolt;
  9. import net.minecraft.entity.monster.EntityEnderman;
  10. import net.minecraft.entity.projectile.EntityThrowable;
  11. import net.minecraft.util.AxisAlignedBB;
  12. import net.minecraft.util.DamageSource;
  13. import net.minecraft.util.MovingObjectPosition;
  14. import net.minecraft.world.World;
  15. import cpw.mods.fml.relauncher.Side;
  16. import cpw.mods.fml.relauncher.SideOnly;
  17.  
  18. public class EntityLightningStaffProjectile extends EntityThrowable {
  19.  
  20. public EntityLightningStaffProjectile(World p_i1782_1_)
  21. {
  22. super(p_i1782_1_);
  23. }
  24.  
  25. public EntityLightningStaffProjectile(World p_i1783_1_, EntityLivingBase p_i1783_2_, double x, double y, double z)
  26. {
  27. super(p_i1783_1_, p_i1783_2_);
  28. this.setPositionAndRotation(x, y + 1.5D, z, p_i1783_2_.rotationYaw, p_i1783_2_.rotationPitch);
  29. }
  30.  
  31. @SideOnly(Side.CLIENT)
  32. public EntityLightningStaffProjectile(World p_i1784_1_, double p_i1784_2_, double p_i1784_4_, double p_i1784_6_)
  33. {
  34. super(p_i1784_1_, p_i1784_2_, p_i1784_4_, p_i1784_6_);
  35. }
  36.  
  37. /**
  38. * Called when this EntityThrowable hits a block or entity.
  39. */
  40. protected void onImpact(MovingObjectPosition p_70184_1_)
  41. {
  42. if (p_70184_1_.entityHit != null)
  43. {
  44. worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, posX + rand.nextDouble(), posY, posZ + rand.nextDouble()));
  45. p_70184_1_.entityHit.attackEntityFrom(DamageSource.generic, Float.MAX_VALUE);
  46. if(!worldObj.isRemote)
  47. {
  48. if(rand.nextInt(20) == 0)
  49. {
  50. setDead();
  51. }
  52. }
  53. }
  54. if(p_70184_1_.typeOfHit == p_70184_1_.typeOfHit.BLOCK)
  55. {
  56. if(!worldObj.isRemote)
  57. {
  58. if(rand.nextInt(20) == 0)
  59. {
  60. setDead();
  61. }
  62. worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, posX, posY, posZ));
  63. if(AdminWeapons.allowWeaponsGriefing)
  64. {
  65. worldObj.setBlockToAir(p_70184_1_.blockX, p_70184_1_.blockY, p_70184_1_.blockZ);
  66. }
  67. }
  68. }
  69. if(p_70184_1_.entityHit instanceof EntityEnderman)
  70. {
  71. p_70184_1_.entityHit.worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, p_70184_1_.entityHit.posX, p_70184_1_.entityHit.posY, p_70184_1_.entityHit.posZ));
  72. }
  73. }
  74. protected float getGravityVelocity()
  75. {
  76. return 0.0001F;
  77. }
  78.  
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement