/** Updates the task */ public void updateTask() { --this.timeToNextAttack; EntityLivingBase entitylivingbase = this.spirit.getAttackTarget(); double d0 = this.spirit.getDistanceSqToEntity(entitylivingbase); if (d0 < 256.0D) { if (this.timeToNextAttack <= 0) { double fireballMotionX = entitylivingbase.posX - this.spirit.posX; double fireballMotionY = entitylivingbase.getEntityBoundingBox().minY + (double) (entitylivingbase.height / 2.0F) - (this.spirit.posY + (double) (this.spirit.height / 2.0F)); double fireballMotionZ = entitylivingbase.posZ - this.spirit.posZ; this.timeToNextAttack = 50; float f = MathHelper.sqrt_float(MathHelper.sqrt_double(d0)) * 0.5F; this.spirit.worldObj.playAuxSFXAtEntity( null, 1009, new BlockPos((int) this.spirit.posX, (int) this.spirit.posY, (int) this.spirit.posZ), 0); for (int i = 0; i < 1; ++i) { EntitySmallFireball entitysmallfireball = new EntitySmallFireball( this.spirit.worldObj, this.spirit, fireballMotionX + this.spirit.getRNG().nextGaussian() * (double) f, fireballMotionY, fireballMotionZ + this.spirit.getRNG().nextGaussian() * (double) f); entitysmallfireball.posY = this.spirit.posY + (double) (this.spirit.height / 2.0F) + 0.5D; this.spirit.worldObj.spawnEntityInWorld(entitysmallfireball); } } this.spirit.getLookHelper().setLookPositionWithEntity(entitylivingbase, 10.0F, 10.0F); } else { this.spirit.getNavigator().clearPathEntity(); this.spirit .getMoveHelper() .setMoveTo(entitylivingbase.posX, entitylivingbase.posY, entitylivingbase.posZ, 1.0D); } super.updateTask(); }
public void func_46080_e() { super.func_46080_e(); }
public void func_46077_d() { super.func_46077_d(); }
public void func_46079_a(int i) { super.func_46079_a(i); }
/** Execute a one shot task or start executing a continuous task */ public void startExecuting() { this.field_179442_b.setAttackTarget(this.field_179441_e); super.startExecuting(); }
/** Resets the task */ public void resetTask() { this.field_179442_b.setAttackTarget((EntityLivingBase) null); super.startExecuting(); }