/// <summary> /// Returns whether the EntityAIBase should begin execution. /// </summary> public override bool ShouldExecute() { TargetEntity = TheEntity.GetAttackTarget(); if (TargetEntity == null) { return(false); } if (TargetEntity.GetDistanceSqToEntity(TheEntity) > (double)(Field_48331_g * Field_48331_g)) { return(false); } Vec3D vec3d = RandomPositionGenerator.Func_48620_a(TheEntity, 16, 7, Vec3D.CreateVector(TargetEntity.PosX, TargetEntity.PosY, TargetEntity.PosZ)); if (vec3d == null) { return(false); } else { MovePosX = vec3d.XCoord; MovePosY = vec3d.YCoord; MovePosZ = vec3d.ZCoord; return(true); } }
/// <summary> /// Execute a one shot task or start executing a continuous task /// </summary> public override void StartExecuting() { InsidePosX = -1; if (EntityObj.GetDistanceSq(DoorInfo.GetInsidePosX(), DoorInfo.PosY, DoorInfo.GetInsidePosZ()) > 256D) { Vec3D vec3d = RandomPositionGenerator.Func_48620_a(EntityObj, 14, 3, Vec3D.CreateVector((double)DoorInfo.GetInsidePosX() + 0.5D, DoorInfo.GetInsidePosY(), (double)DoorInfo.GetInsidePosZ() + 0.5D)); if (vec3d != null) { EntityObj.GetNavigator().Func_48666_a(vec3d.XCoord, vec3d.YCoord, vec3d.ZCoord, 0.3F); } } else { EntityObj.GetNavigator().Func_48666_a((double)DoorInfo.GetInsidePosX() + 0.5D, DoorInfo.GetInsidePosY(), (double)DoorInfo.GetInsidePosZ() + 0.5D, 0.3F); } }
/// <summary> /// Returns whether the EntityAIBase should begin execution. /// </summary> public override bool ShouldExecute() { if (TheEntity.IsWithinHomeDistanceCurrentPosition()) { return(false); } ChunkCoordinates chunkcoordinates = TheEntity.GetHomePosition(); Vec3D vec3d = RandomPositionGenerator.Func_48620_a(TheEntity, 16, 7, Vec3D.CreateVector(chunkcoordinates.PosX, chunkcoordinates.PosY, chunkcoordinates.PosZ)); if (vec3d == null) { return(false); } else { MovePosX = vec3d.XCoord; MovePosY = vec3d.YCoord; MovePosZ = vec3d.ZCoord; return(true); } }