/// <summary> /// Returns whether the EntityAIBase should begin execution. /// </summary> public override bool ShouldExecute() { LeapTarget = Leaper.GetAttackTarget(); if (LeapTarget == null) { return(false); } double d = Leaper.GetDistanceSqToEntity(LeapTarget); if (d < 4D || d > 16D) { return(false); } if (!Leaper.OnGround) { return(false); } return(Leaper.GetRNG().Next(5) == 0); }
/// <summary> /// Returns whether an in-progress EntityAIBase should continue executing /// </summary> public override bool ContinueExecuting() { EntityLiving entityliving = TaskOwner.GetAttackTarget(); if (entityliving == null) { return(false); } if (!entityliving.IsEntityAlive()) { return(false); } if (TaskOwner.GetDistanceSqToEntity(entityliving) > (double)(Field_48379_d * Field_48379_d)) { return(false); } if (Field_48380_e) { if (!TaskOwner.Func_48090_aM().CanSee(entityliving)) { if (++Field_48378_g > 60) { return(false); } } else { Field_48378_g = 0; } } return(true); }