Guest User

f

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