Skip to content

Statistics Helper

Kompy edited this page Aug 25, 2023 · 4 revisions

Statistics Helper

What does it do?

Simply put, upon entering a single player world, Statistics Helper writes the folder path to your statistics .json file as a json object to /config/fmhelper/statshelper.json. The key for the path value is simply "path" (handled as $.path in Fancy Menu's json placeholder)

Why?

Because Fancy Menu's json placeholders are unable to handle variables in paths. Your world name and your UUID will always be variables, and thus Fancy Menu is inherently unable to navigate to your world's stats file. Thankfully, Fancy Menu can also utilize nested json placeholders, and thus we take advantage of a nested json placeholder for the path to properly resolve the path to the stats .json file.

Example usage

Create a new GUI with Fancy Menu (refer to Fancy Menu's docs on how to do this), then create a new text element. Edit the newly created text element's content and add the following as a json placeholder (advanced > JSON parser): {"placeholder":"json","values":{"source":"{"placeholder":"json","values":{"source":"config/fmhelper/statshelper.json","json_path":"$.path"}}","json_path":"$['stat.examplestat']"}}

Then, navigate to your world's stats folder and open the stats .json file with a text editor. Note that if you need a particular stat, you will need to first perform the action ingame that will log that stat to the file if you otherwise don't already know it. An example would be killing a zombie, or mining a dirt block.

Copy the stat's key, such as stat.mineBlock.minecraft.dirt and replace stat.example in the above placeholder code. If you used my example, it will look something like this:

{"placeholder":"json","values":{"source":"{"placeholder":"json","values":{"source":"config/fmhelper/statshelper.json","json_path":"$.path"}}","json_path":"$['stat.mineBlock.minecraft.dirt']"}}

Save the text element changes, save the menu changes, and refresh Fancy Menu. Your stat should appear as a numerical value.

That's it! You've successfully obtained the stat and displayed it in your menu. This mod will properly handle each world individually. Exiting your world and entering a different world will show that world's statistics.

The rest of the menu's design is up to you and Fancy Menu's capabilities.

Stat Dumper

/statsdump will dump all stat IDs to statsdump.json in config/fmhelper

Use this to review all possible stat IDs in your modpack to assist in developing elements in Fancy Menu.

Clone this wiki locally