Guest User

t

a guest
Jun 19th, 2015
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. package com.svk.industrialGuns.entity;
  2.  
  3. import com.svk.industrialGuns.client.particle.ColoredParticleCube;
  4. import com.svk.industrialGuns.client.particle.ColoredParticleCubeHeap;
  5. import com.svk.industrialGuns.client.particle.ColoredParticleTrail;
  6.  
  7. import net.minecraft.client.Minecraft;
  8. import net.minecraft.entity.Entity;
  9. import net.minecraft.entity.EntityLivingBase;
  10. import net.minecraft.entity.player.EntityPlayer;
  11. import net.minecraft.entity.projectile.EntityThrowable;
  12. import net.minecraft.util.DamageSource;
  13. import net.minecraft.util.MathHelper;
  14. import net.minecraft.util.MovingObjectPosition;
  15. import net.minecraft.world.World;
  16.  
  17. public class EntityMezonShell extends EntityBullet
  18. {
  19.  
  20. public EntityMezonShell(World world, EntityLivingBase entity)
  21. {
  22. super(world, entity);
  23. super.render = true;
  24. }
  25.  
  26. @Override
  27. public void onUpdate()
  28. {
  29. super.onUpdate();
  30.  
  31. life++;
  32. if(life > 120)
  33. {
  34. this.setDead();
  35. }
  36.  
  37. this.motionX = this.bylletMotionX * getVelocity();
  38. this.motionY = this.bylletMotionY * getVelocity();
  39. this.motionZ = this.bylletMotionZ * getVelocity();
  40. this.setPosition(this.posX, this.posY, this.posZ);
  41.  
  42. if(this.worldObj.isRemote)
  43. {
  44. EntityMezonCollateral entity = new EntityMezonCollateral(this.worldObj, this.getThrower());
  45. entity.bylletMotionX = bylletMotionX;
  46. entity.bylletMotionY = bylletMotionY;
  47. entity.bylletMotionZ = bylletMotionZ;
  48. entity.setPosition(this.posX, this.posY, this.posZ);
  49. this.worldObj.spawnEntityInWorld(entity);
  50. }
  51.  
  52.  
  53. }
  54.  
  55. protected float getVelocity()
  56. {
  57. return speed;
  58. }
  59.  
  60. protected float getGravityVelocity()
  61. {
  62. return gravity;
  63. }
  64.  
  65. @Override
  66. protected void onImpact(MovingObjectPosition mop)
  67. {
  68. if(mop.entityHit != null && !(mop.entityHit instanceof EntityMezonShell))
  69. {
  70. mop.entityHit.hurtResistantTime = 0;
  71. mop.entityHit.attackEntityFrom(DamageSource.cactus, damage);
  72. this.setDead();
  73. }
  74. if(!(mop.hitInfo instanceof Entity))
  75. {
  76. this.setDead();
  77. }
  78. }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment