How can I get a complete player stats JSON file for testing?

U

/u/zn-ku

Guest
excuse my english

I am working on a Minecraft server statistics website and I want to test my parser with a player file that contains as much data as possible

  • world/players/stats/<uuid>.json
  • world/players/advancements/<uuid>.json

I noticed within my server that the json files only contain what the players have achieved (I am guessing for storage optimization) but I want to have a template of everything this json file can restore so players in my smp can view what they achieved so far and what has to be done.

Is there a way to get a test JSON file where a player has completed all advancements and has a large amount of statistics recorded, such as mined blocks, killed mobs, crafted and used items, traveled distances, and other available statistics?

I am not looking for real player data, just a complete example dataset or a way to generate one locally.

Things I have tried:

  • Creating a test Fabric server
  • Using /advancement grant @s everything
  • Generating mobs and blocks with commands to increase stats

I am mainly looking for the best way server admins/developers test tools that read Minecraft player statistics.

Thanks!

Update: I have a friend who is a modder and he helped me and he found a clean way to do this, sharing in case anyone else hits the same wall.​


The core issue: you don't actually want a "maxed out" test player file. even if you had one, it'd only tell you what that player touched, not the full set of things that could be tracked. What you actually need is Mojang's own registry data, independent of any player.

Turns out the vanilla server jar can generate this itself:

java -cp server.jar;<every jar in libraries/> net.minecraft.data.Main --reports --output <some-dir>

Important: don't run it with -jar (that launches the actual dedicated server, not what you want). use -cp and call net.minecraft.data.Main directly. Also needs a modern JDK; if java -version on your PATH shows something old, point at a newer JRE explicitly.

anyway.........

This drops a reports/registries.json with every registry in the game, including the ones that matter for stats.json:

  • minecraft:item → every item
  • minecraft:block → every block
  • minecraft:entity_type → every entity
  • minecraft:custom_stat → every custom stat name (play_time, deaths, jump, etc.)

Cross-referencing the stat categories on the wiki (mined, broken, crafted, used, picked_up, dropped, killed, killed_by, custom), you can build the full theoretical set of every stat_key that could ever appear in a player's file. for me that's 9,274 combinations.

For advancements it's actually simpler. the raw JSON is already sitting in the jar at data/minecraft/advancement/*/.json (note: singular "advancement", not "advancements" like the player-file folder), so you don't even need the generator for that half.

Once you have this catalog, the actual fix isn't a fake test file at all. it's a LEFT JOIN between "every possible stat" and "what this player's file actually has." Anything with no match just reads as 0. Works for real player 1s and 0s alike.

submitted by /u/zn-ku
[link] [comments]

Continue reading...
 
Back
Top