Statistics

Statistics is a game feature that allows players to track how many times they have completed certain tasks.

List of general statistics
The statistics window is divided into three sections: General, Blocks and Items. The General screen shows a multitude of generic statistics which are listed in the table below. The Blocks screen shows the number of times different blocks have been crafted, used (placed) and mined. The Items screen shows the number of times different items have been depleted, crafted and used to destroy blocks. The buttons at the top of the Blocks and Items screens can be used to sort the list.

Storage
Statistics are stored in .minecraft/stats/stats_username_unsent.dat. They keep track of these stats, as well as achievements earned. The file structure is JSON based, it looks like this:

{      "user":{ "name":"xxxxxxxx", "sessionid":"local" },      "stats-change":[ {"id":value}, {"id":value}, ],      "checksum":"xxxxxxxxxxxxxxxx" } Statistics are stored in the stats-change section. All of these fields are empty unless they need updating. For example, until you jump, the number of times you've jumped will not be recorded. Distance is stored in centimeters, and time is stored in ticks (where one tick equals 0.052 seconds). An example entry for Times Played: {"1000",4}

There is also a checksum field for the statistics data. If any information is changed and the checksum is incorrect, all stats will be deleted by Minecraft. The checksum is calculated by taking the MD5 hash of a string consisting of the sessionid (always "local" in the current implementation) followed by all of the statistics in the format "statname,value,statname,value," (in the same order as they appear above). The statname "stat.startGame", for example, corresponds to the id 1000. In newer version they use the file achievement/map.txt to achieve the statname. If the id is known but not listed in the file, null is used instead. Note that, unlike in the standard implementation of MD5, leading zeroes are trimmed from the checksum (possibly due to an oversight in the code). Also note that when the statistics file is loaded, if any stats are in the list that are not recognized (for example, from a more recent version of Minecraft or from any mods), then the calculated checksum will not match, and the statistics file will be deleted.

This section also stores achievements and block information. Achievements have an ID based on their location in Achievements plus 5242880 (0x500000). For example, 5242880 is "Taking inventory", and 5242882 is "Benchmarking". The value indicates how many times that achievement has been earned (the "Achievement Get" message is not displayed every time). Blocks are saved in a similar fashion, but the ID is 16777216 (0x1000000) plus the block ID. The value is the number of times that block has been mined.

History
Notch talked about statistics (along with achievements) on his March 18 blog post:

Saving of stats online was considered for the Beta 1.6 update, but was considered too error prone at that point.

Bugs

 * Statistics do not record (since their introduction) item creation when you shift + click from the crafting or furnace GUI.
 * In SMP, when a player kills another player it will not be added to the player's "Player Kills" statistic.
 * Statistics and achievements sometimes reset themselves when minecraft.jar is changed or modded.

Trivia

 * The statistics ignore metadata. As such, all types of wood, wool, saplings, and dye will be counted as the same item. Coal and charcoal are also treated as the same.
 * As such, on the items tab, there is no tooltip on ink sac. This is because ink sac has the damage value (0) of the dye ID.
 * Firing an arrow from a bow does not count as using it.
 * "Times Crafted" includes smelting, such as smelting wood for charcoal.
 * The compass and clock icons are functional.
 * When you access General Statistics from your world, the Times Played number will always be 1 bigger than Games quit.
 * When cocoa pod is viewed in the statistics list their full texture is shown, this includes the top of the pod as-well as the side.