/// <summary> /// Returns whether an in-progress EntityAIBase should continue executing /// </summary> public override bool ContinueExecuting() { if (!Field_48362_c.IsEntityAlive()) { return(false); } if (TheEntity.GetDistanceSqToEntity(Field_48362_c) > 225D) { return(false); } else { return(!TheEntity.GetNavigator().NoPath() || ShouldExecute()); } }
/// <summary> /// Returns whether the EntityAIBase should begin execution. /// </summary> public override bool ShouldExecute() { EntityLiving entityliving = Attacker.GetAttackTarget(); if (entityliving == null) { return(false); } if (ClassTarget != null && !ClassTarget.IsAssignableFrom(entityliving.GetType())) { return(false); } else { EntityTarget = entityliving; Field_48265_g = Attacker.GetNavigator().Func_48679_a(EntityTarget); return(Field_48265_g != null); } }
/// <summary> /// Updates look /// </summary> public virtual void OnUpdateLook() { Entity.RotationPitch = 0.0F; if (Field_46147_d) { Field_46147_d = false; double d = PosX - Entity.PosX; double d1 = PosY - (Entity.PosY + (double)Entity.GetEyeHeight()); double d2 = PosZ - Entity.PosZ; double d3 = MathHelper2.Sqrt_double(d * d + d2 * d2); float f1 = (float)((Math.Atan2(d2, d) * 180D) / Math.PI) - 90F; float f2 = (float)(-((Math.Atan2(d1, d3) * 180D) / Math.PI)); Entity.RotationPitch = UpdateRotation(Entity.RotationPitch, f2, Field_46150_c); Entity.RotationYawHead = UpdateRotation(Entity.RotationYawHead, f1, Field_46149_b); } else { Entity.RotationYawHead = UpdateRotation(Entity.RotationYawHead, Entity.RenderYawOffset, 10F); } float f; for (f = Entity.RotationYawHead - Entity.RenderYawOffset; f < -180F; f += 360F) { } for (; f >= 180F; f -= 360F) { } if (!Entity.GetNavigator().NoPath()) { if (f < -75F) { Entity.RotationYawHead = Entity.RenderYawOffset - 75F; } if (f > 75F) { Entity.RotationYawHead = Entity.RenderYawOffset + 75F; } } }
/// <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); }
/// <summary> /// Returns whether an in-progress EntityAIBase should continue executing /// </summary> public override bool ContinueExecuting() { return(ShouldExecute() || !EntityHost.GetNavigator().NoPath()); }
/// <summary> /// Execute a one shot task or start executing a continuous task /// </summary> public override void StartExecuting() { EatGrassTick = 40; TheWorld.SetEntityState(TheEntity, (sbyte)10); TheEntity.GetNavigator().ClearPathEntity(); }