/// <summary> /// Updates the task /// </summary> public override void UpdateTask() { TheEntity.GetLookHelper().SetLookPositionWithEntity(Field_48362_c, 30F, 30F); double d = TheEntity.Width * 2.0F * (TheEntity.Width * 2.0F); double d1 = TheEntity.GetDistanceSq(Field_48362_c.PosX, Field_48362_c.BoundingBox.MinY, Field_48362_c.PosZ); float f = 0.23F; if (d1 > d && d1 < 16D) { f = 0.4F; } else if (d1 < 225D) { f = 0.18F; } TheEntity.GetNavigator().Func_48667_a(Field_48362_c, f); Field_48360_d = Math.Max(Field_48360_d - 1, 0); if (d1 > d) { return; } if (Field_48360_d > 0) { return; } else { Field_48360_d = 20; TheEntity.AttackEntityAsMob(Field_48362_c); return; } }
/// <summary> /// Updates the task /// </summary> public override void UpdateTask() { Attacker.GetLookHelper().SetLookPositionWithEntity(EntityTarget, 30F, 30F); if ((Field_48264_f || Attacker.Func_48090_aM().CanSee(EntityTarget)) && --Field_48269_i <= 0) { Field_48269_i = 4 + Attacker.GetRNG().Next(7); Attacker.GetNavigator().Func_48667_a(EntityTarget, Field_48266_e); } Field_46091_d = Math.Max(Field_46091_d - 1, 0); double d = Attacker.Width * 2.0F * (Attacker.Width * 2.0F); if (Attacker.GetDistanceSq(EntityTarget.PosX, EntityTarget.BoundingBox.MinY, EntityTarget.PosZ) > d) { return; } if (Field_46091_d > 0) { return; } else { Field_46091_d = 20; Attacker.AttackEntityAsMob(EntityTarget); return; } }
/// <summary> /// Updates the task /// </summary> public override void UpdateTask() { double d = 100D; double d1 = EntityHost.GetDistanceSq(AttackTarget.PosX, AttackTarget.BoundingBox.MinY, AttackTarget.PosZ); bool flag = EntityHost.Func_48090_aM().CanSee(AttackTarget); if (flag) { Field_48367_f++; } else { Field_48367_f = 0; } if (d1 > d || Field_48367_f < 20) { EntityHost.GetNavigator().Func_48667_a(AttackTarget, Field_48370_e); } else { EntityHost.GetNavigator().ClearPathEntity(); } EntityHost.GetLookHelper().SetLookPositionWithEntity(AttackTarget, 30F, 30F); RangedAttackTime = Math.Max(RangedAttackTime - 1, 0); if (RangedAttackTime > 0) { return; } if (d1 > d || !flag) { return; } else { DoRangedAttack(); RangedAttackTime = MaxRangedAttackTime; return; } }
/// <summary> /// Returns whether the EntityAIBase should begin execution. /// </summary> public override bool ShouldExecute() { if (!TheEntity.IsCollidedHorizontally) { return(false); } PathNavigate pathnavigate = TheEntity.GetNavigator(); PathEntity pathentity = pathnavigate.GetPath(); if (pathentity == null || pathentity.IsFinished() || !pathnavigate.Func_48665_b()) { return(false); } for (int i = 0; i < Math.Min(pathentity.GetCurrentPathIndex() + 2, pathentity.GetCurrentPathLength()); i++) { PathPoint pathpoint = pathentity.GetPathPointFromIndex(i); EntityPosX = pathpoint.XCoord; EntityPosY = pathpoint.YCoord + 1; EntityPosZ = pathpoint.ZCoord; if (TheEntity.GetDistanceSq(EntityPosX, TheEntity.PosY, EntityPosZ) > 2.25D) { continue; } TargetDoor = Func_48318_a(EntityPosX, EntityPosY, EntityPosZ); if (TargetDoor != null) { return(true); } } EntityPosX = MathHelper2.Floor_double(TheEntity.PosX); EntityPosY = MathHelper2.Floor_double(TheEntity.PosY + 1.0D); EntityPosZ = MathHelper2.Floor_double(TheEntity.PosZ); TargetDoor = Func_48318_a(EntityPosX, EntityPosY, EntityPosZ); return(TargetDoor != null); }