Guest User

EntityNukePrimed

a guest
Feb 21st, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.16 KB | None | 0 0
  1. package TheMod;
  2.  
  3. import net.minecraft.entity.EntityLivingBase;
  4. import net.minecraft.entity.item.EntityTNTPrimed;
  5. import net.minecraft.util.EnumParticleTypes;
  6. import net.minecraft.world.World;
  7.  
  8. public class EntityNukePrimed extends EntityTNTPrimed {
  9.  
  10.     private EntityLivingBase tntPlacedBy;
  11.  
  12.     public EntityNukePrimed(World worldIn) {
  13.         super(worldIn);
  14.         this.preventEntitySpawning = true;
  15.         this.setSize(0.68F, 0.68F);
  16.     }
  17.     public EntityNukePrimed(World worldIn, double posX, double posY, double posZ, EntityLivingBase EntityYaw) {
  18.         this(worldIn);
  19.         this.setPosition(posX, posY, posZ);
  20.         float f = (float) (Math.random() * Math.PI * 2.0D);
  21.         this.motionX = (double) (-((float) Math.sin((double) f)) * 0.02F);
  22.         this.motionY = 0.20000000298023224D;
  23.         this.motionZ = (double) (-((float) Math.cos((double) f)) * 0.02F);
  24.         this.fuse = 100;
  25.         this.prevPosX = posX;
  26.         this.prevPosY = posY;
  27.         this.prevPosZ = posZ;
  28.         this.tntPlacedBy = EntityYaw;
  29.     }
  30.  
  31.     public void onUpdate() {
  32.         this.prevPosX = this.posX;
  33.         this.prevPosY = this.posY;
  34.         this.prevPosZ = this.posZ;
  35.         this.motionY -= 0.03999999910593033D;
  36.         this.moveEntity(this.motionX, this.motionY, this.motionZ);
  37.         this.motionX *= 0.9800000190734863D;
  38.         this.motionY *= 0.9800000190734863D;
  39.         this.motionZ *= 0.9800000190734863D;
  40.  
  41.         if (this.onGround) {
  42.             this.motionX *= 0.699999988079071D;
  43.             this.motionZ *= 0.699999988079071D;
  44.             this.motionY *= -0.5D;
  45.         }
  46.  
  47.         if (this.fuse-- <= 0) {
  48.             this.setDead();
  49.  
  50.             if (!this.worldObj.isRemote) {
  51.                 this.explode();
  52.             }
  53.         } else {
  54.             this.handleWaterMovement();
  55.             this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]);
  56.         }
  57.     }
  58.  
  59.     private void explode() {
  60.         float f = 16.0F;
  61.         this.worldObj.createExplosion(this, this.posX, this.posY + (double) (this.height / 7.0F), this.posZ, f, true);
  62.     }
  63.  
  64.  
  65. }
Add Comment
Please, Sign In to add comment