<h1 align="center">MC Benchmark</h1>

<p align="center">
  <img src="https://github.com/Krutoy242/mc-benchmark/actions/workflows/ci.yml/badge.svg" alt="CI Status" />
  <img src="https://img.shields.io/github/v/release/Krutoy242/mc-benchmark" alt="Latest Version" />
</p>

> Build charts about load time of 1.12 Minecraft modpacks.

**Modded Minecraft** packs can take ~10 minutes to load. It is useful to know which mod or load step is the bottleneck.
This tool parses the `debug.log` file generated by Forge and uses the [QuickChart API](https://quickchart.io/) to generate detailed Markdown reports with charts.

<p align="center"><img src="https://i.imgur.com/uZj6wS1.png" alt="Pie Chart Example"/></p>
<p align="center"><img src="https://i.imgur.com/PolHIWi.png" alt="Timeline Example"/></p>

## Usage

1. Install **Node.js** (v18+)
2. Open console, navigate to your Minecraft directory (the one containing the `logs/` folder).
3. Run:
   ```sh
   npx mc-benchmark > benchmark.md
   ```
4. A file named `benchmark.md` will be created with all the charts and tables.

> **Note**: Minecraft must be launched at least once to generate `logs/debug.log`.
> Some launchers (like CurseForge) might disable debug logging by default. Make sure to enable it in your launcher settings. Example for [CurseForge Luncher](https://i.imgur.com/u3WD1G4.png).

### Options

<!-- OPTIONS_START -->
```
Build charts about load time of Minecraft modpack. (mc-benchmark)

USAGE mc-benchmark [OPTIONS] [INPUT]

ARGUMENTS

  INPUT    debug.log path (Default: logs/debug.log)

OPTIONS

        -c, --ctlog=<ctlog>    crafttweaker.log path (Default: crafttweaker.log)                                              
          -a, --data=<data>    Output of gathered .json data                                                                  
  -d, --detailed=<detailed>    Count of detailed mods in main pie chart (Default: 16)                                         
  -t, --template=<template>    Non-default template path                                                                      
    -m, --modpack=<modpack>    Modpack name in header                                                                         
              -v, --verbose    Verbose level -v INFO or -vv DEBUG                                                             
                --cwd=<cwd>    Minecraft directory to OPEN files from (Default: ./)                                           
             -n, --nospaces    Replace all space characters "\s" in image code. Useful for posting on GitHub. (Default: false)
```
<!-- OPTIONS_END -->

## Examples

- **[benchmark.md](examples/benchmark.md)**: Default output.
- **[benchmark-nospaces.md](examples/benchmark-nospaces.md)**: Output with `--nospaces`, optimized for direct viewing on GitHub/GitLab.

## Author

- [Krutoy242](https://github.com/Krutoy242)
