/** Updates the task */
@Override
    public void updateTask()
    {
        double distanceFromTarget = this.host.getDistanceSq(host.getAttackTarget().posX, host.getAttackTarget().boundingBox.minY, host.getAttackTarget().posZ);
        boolean canSeeTarget = true; //this.host.getEntitySenses().canSee(this.attackTarget);
        if (canSeeTarget)
        {
            ++this.targetTimeLost;
        }
        else
        {
            this.targetTimeLost = 0;
        }
        if (distanceFromTarget <= (double) this.followDistance && this.targetTimeLost >= 20)
        {
            this.host.getNavigator().clearPathEntity();
        }
        else
        {
            this.host.getNavigator().tryMoveToEntityLiving(host.getAttackTarget(), this.entityMoveSpeed);
        }
        this.host.getLookHelper().setLookPositionWithEntity(host.getAttackTarget(), 30.0F, 30.0F);
        float f;
        if (--this.rangedAttackTime == 0)
        {
            if (distanceFromTarget > (double) this.followDistance || !canSeeTarget)
            {
                return;
            }
            f = MathHelper.sqrt_double(distanceFromTarget) / this.attackRange;
            // TODO replace this.rangedAttackEntityHost.attackEntityWithRangedAttack(thost.getAttackTarget(), f);
            this.rangedAttackTime = MathHelper.floor_float(f * (float) (this.maxRangedAttackTime - this.minRangedAttackTime) + (float) this.minRangedAttackTime);
        }
        else if (this.rangedAttackTime < 0)
        {
            f = MathHelper.sqrt_double(distanceFromTarget) / this.attackRange;
            this.rangedAttackTime = MathHelper.floor_float(f * (float) (this.maxRangedAttackTime - this.minRangedAttackTime) + (float) this.minRangedAttackTime);
        }
    }
@Override
public void updateTask()
{
double distanceFromTarget = this.host.getDistanceSq(host.getAttackTarget().posX, host.getAttackTarget().boundingBox.minY, host.getAttackTarget().posZ);
boolean canSeeTarget = true; //this.host.getEntitySenses().canSee(this.attackTarget);
if (canSeeTarget)
{
++this.targetTimeLost;
}
else
{
this.targetTimeLost = 0;
}
if (distanceFromTarget <= (double) this.followDistance && this.targetTimeLost >= 20)
{
this.host.getNavigator().clearPathEntity();
}
else
{
this.host.getNavigator().tryMoveToEntityLiving(host.getAttackTarget(), this.entityMoveSpeed);
}
this.host.getLookHelper().setLookPositionWithEntity(host.getAttackTarget(), 30.0F, 30.0F);
float f;
if (--this.rangedAttackTime == 0)
{
if (distanceFromTarget > (double) this.followDistance || !canSeeTarget)
{
return;
}
f = MathHelper.sqrt_double(distanceFromTarget) / this.attackRange;
// TODO replace this.rangedAttackEntityHost.attackEntityWithRangedAttack(thost.getAttackTarget(), f);
this.rangedAttackTime = MathHelper.floor_float(f * (float) (this.maxRangedAttackTime - this.minRangedAttackTime) + (float) this.minRangedAttackTime);
}
else if (this.rangedAttackTime < 0)
{
f = MathHelper.sqrt_double(distanceFromTarget) / this.attackRange;
this.rangedAttackTime = MathHelper.floor_float(f * (float) (this.maxRangedAttackTime - this.minRangedAttackTime) + (float) this.minRangedAttackTime);
}
}
@Override
public void updateTask()
{
double distanceFromTarget = this.host.getDistanceSq(host.getAttackTarget().posX, host.getAttackTarget().boundingBox.minY, host.getAttackTarget().posZ);
boolean canSeeTarget = true; //this.host.getEntitySenses().canSee(this.attackTarget);
if (canSeeTarget)
{
++this.targetTimeLost;
}
else
{
this.targetTimeLost = 0;
}
if (distanceFromTarget <= (double) this.followDistance && this.targetTimeLost >= 20)
{
this.host.getNavigator().clearPathEntity();
}
else
{
this.host.getNavigator().tryMoveToEntityLiving(host.getAttackTarget(), this.entityMoveSpeed);
}
this.host.getLookHelper().setLookPositionWithEntity(host.getAttackTarget(), 30.0F, 30.0F);
float f;
if (--this.rangedAttackTime == 0)
{
if (distanceFromTarget > (double) this.followDistance || !canSeeTarget)
{
return;
}
f = MathHelper.sqrt_double(distanceFromTarget) / this.attackRange;
// TODO replace this.rangedAttackEntityHost.attackEntityWithRangedAttack(thost.getAttackTarget(), f);
this.rangedAttackTime = MathHelper.floor_float(f * (float) (this.maxRangedAttackTime - this.minRangedAttackTime) + (float) this.minRangedAttackTime);
}
else if (this.rangedAttackTime < 0)
{
f = MathHelper.sqrt_double(distanceFromTarget) / this.attackRange;
this.rangedAttackTime = MathHelper.floor_float(f * (float) (this.maxRangedAttackTime - this.minRangedAttackTime) + (float) this.minRangedAttackTime);
}
}
@Override
public void updateTask()
{
double distanceFromTarget = this.host.getDistanceSq(host.getAttackTarget().posX, host.getAttackTarget().boundingBox.minY, host.getAttackTarget().posZ);
boolean canSeeTarget = true; //this.host.getEntitySenses().canSee(this.attackTarget);
if (canSeeTarget)
{
++this.targetTimeLost;
}
else
{
this.targetTimeLost = 0;
}
if (distanceFromTarget <= (double) this.followDistance && this.targetTimeLost >= 20)
{
this.host.getNavigator().clearPathEntity();
}
else
{
this.host.getNavigator().tryMoveToEntityLiving(host.getAttackTarget(), this.entityMoveSpeed);
}
this.host.getLookHelper().setLookPositionWithEntity(host.getAttackTarget(), 30.0F, 30.0F);
float f;
if (--this.rangedAttackTime == 0)
{
if (distanceFromTarget > (double) this.followDistance || !canSeeTarget)
{
return;
}
f = MathHelper.sqrt_double(distanceFromTarget) / this.attackRange;
// TODO replace this.rangedAttackEntityHost.attackEntityWithRangedAttack(thost.getAttackTarget(), f);
this.rangedAttackTime = MathHelper.floor_float(f * (float) (this.maxRangedAttackTime - this.minRangedAttackTime) + (float) this.minRangedAttackTime);
}
else if (this.rangedAttackTime < 0)
{
f = MathHelper.sqrt_double(distanceFromTarget) / this.attackRange;
this.rangedAttackTime = MathHelper.floor_float(f * (float) (this.maxRangedAttackTime - this.minRangedAttackTime) + (float) this.minRangedAttackTime);
}
}