@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;
        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;
           
            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; 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; 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); } }