Updated:
1. Count one block type
/scoreboard objectives add stone_mined minecraft.mined:minecraft.stone "Stone mined"
/scoreboard objectives setdisplay sidebar stone_mined
This counts automatically, with no command blocks. Use minecraft.mined:minecraft.diamond_ore for diamond ore.
2. Count a total
There is no single criterion for every block, so add up pickaxe uses. Breaking a block with a pickaxe adds one use.
/scoreboard objectives add p_wood minecraft.used:minecraft.wooden_pickaxe
/scoreboard objectives add p_stone minecraft.used:minecraft.stone_pickaxe
/scoreboard objectives add p_iron minecraft.used:minecraft.iron_pickaxe
/scoreboard objectives add p_gold minecraft.used:minecraft.golden_pickaxe
/scoreboard objectives add p_dia minecraft.used:minecraft.diamond_pickaxe
/scoreboard objectives add p_neth minecraft.used:minecraft.netherite_pickaxe
/scoreboard objectives add dig dummy "Blocks mined"
Add copper_pickaxe in 1.21.9 and newer, and shovels or axes the same way if you want them.
3. Add them up (repeating)
/execute as @a run scoreboard players operation @s dig = @s p_wood
/execute as @a run scoreboard players operation @s dig += @s p_stone
/execute as @a run scoreboard players operation @s dig += @s p_iron
/execute as @a run scoreboard players operation @s dig += @s p_gold
/execute as @a run scoreboard players operation @s dig += @s p_dia
/execute as @a run scoreboard players operation @s dig += @s p_neth
Use execute as @a with @s. Writing @a on both sides mixes up players. Hitting mobs with a pickaxe also counts as a use, so the total is close but not exact.
4. Show the leaderboard
/scoreboard objectives setdisplay sidebar dig
/scoreboard objectives setdisplay list dig
The sidebar shows the top 15. The list slot shows the number in the tab list.
5. Rewards (repeating)
/execute as @a[scores={dig=1000..},tag=!dig1000] run tellraw @a [{"selector":"@s"},{"text":" mined 1000 blocks!","color":"gold"}]
/give @a[scores={dig=1000..},tag=!dig1000] diamond 5
/tag @a[scores={dig=1000..},tag=!dig1000] add dig1000
6. Reset
/scoreboard players reset @a p_wood
/scoreboard players reset @a dig
Reset p_stone, p_iron and the other pickaxe objectives the same way, or step 3 restores the old total.
Troubleshooting
- Nothing counts: the criterion needs minecraft. twice, as in
minecraft.mined:minecraft.stone. - Everyone has the same number: use execute as @a and @s in step 3.
- Bedrock Edition: only dummy objectives exist there.
Check your command
The Command Error Doctor checks common syntax mistakes in your browser.