Breaking



Breaking, digging, punching, or mining is a common activity in Minecraft, performed (by default) by holding the left mouse button or right trigger while the cursor is pointing at a block, or by long-pressing on the block on touch screens. Breaking is used to create passages, tunnels and clear away unwanted blocks, and is the primary way of acquiring blocks for future placement or crafting.

Basics of breaking
Breaking is accomplished by holding down the button while the cursor is over a block. If the player is within range of the target, the player's hand begins swinging, making a repetitive "thump" noise as the player hits the block, and cracks appear.

$$, this range is 5 blocks in Creative mode, and 4.5 blocks otherwise. $$, the range is 5 blocks when using a keyboard/mouse or controller input, and when using touch input, the range is 12 blocks in Creative mode and 6 blocks otherwise.

Blocks are marked with a wireframe cube outline, making the current target easily visible. After the cracks completely cover the block, it breaks and depending on the type of block and the tool being wielded, it may be harvested for resources.

Although many blocks can be harvested with bare hands, certain ones require the use of a tool. In particular, to obtain resources from stone or metal-type blocks, the player must use a pickaxe. For harder blocks like iron ore or obsidian, a pickaxe made from a higher-tier material is required. The player can also use shovels and axes to speed up the breaking of dirt and wood-type blocks (respectively), although, with the exception of snow, they are not required to get the resource drop. The downside is that tools have durability, and so they eventually wear out.

If the tool has the blue Unbreakable tag under its enchantment and name, it does not break under any circumstances. One can be acquired from typing the command /give

(example: )

The progress for breaking a block is reset if the target block changes while breaking. Progress is also reset whenever the mouse button is released. The player can move freely while breaking blocks. The player can even dig while jumping, swimming, or riding, although this reduces the breaking speed.

On survival mode, however, some blocks are unbreakable, like bedrock, and on adventure mode all blocks are unbreakable unless the player has a item/tool with the NBT tag. On spectator mode a player can't break blocks in any way, and on creative mode all blocks are breakable, unless the player holds a sword or trident in their hand.

Speed
The player's digging speed is controlled by three factors: the block being broken, the item the player is currently wielding, and the mining penalties affecting the player. Every block has a hardness value, which determines the base amount of breaking time if the player hits it with their bare hands.

The base time in seconds is the block's hardness multiplied by 1.5 if the player can harvest the block with the current tool, or 5 if the player cannot.

Assuming that the player can harvest the block, the next check is whether the player's tool increases the breaking speed for the block. See Best tools for a full list.

If the tool helps, then it increases digging speed by a constant multiplier, given in the following table:

If a proper tool is used, the tool speed is further increased by the Efficiency enchantment. If the level of Efficiency is not 0, then the level squared plus 1 is added to the tool speed. For example, Efficiency I adds 2 to the value, while Efficiency V adds 26. The speed is also increased by (20×level)% per level of Haste, while Mining Fatigue decreases it by 70% for level I, 91% for level II, 99.73% for level III, and 99.919% for all other levels.

If the player's head is underwater and they are not wearing a helmet with the Aqua Affinity enchantment, breaking a block takes 5 times as long. If the player's feet are not touching the ground, an additional 5x penalty is added; this causes players floating in water to break blocks 25x slower than if they had been standing on land.

The total time to break a block is always a multiple of $1/20$ of a second, or 1 game tick; any remainder is rounded up to the next tick.

Instant breaking
When breaking a block, a tool and its enchantments do its speed value as "damage" to a block every game tick, and when that value equals or exceeds the block's hardness, the block breaks. If the tool and enchantments immediately equal or exceeds the hardness times 30, the block breaks with no delay; otherwise a 6 tick ($3/10$) second delay occurs before the next block begins to break.

For example, a player with Haste II holding an Efficiency V diamond pickaxe can break stone instantly, as the damage is (8+26)&times;(1+0.4)=46.2, which is greater than the base hardness of stone (1.5) times 30 (which is 45). Players in creative mode always break blocks instantly regardless of tools or status effects, except for when wielding a sword, debug stick or a trident, in which case the player is unable to break anything.

Calculation
Combining all of the information above yields the following pseudo-code to calculate how long in seconds a player takes to mine a certain block. All operations are floating-point, not integer. if (isBestTool): speedMultiplier = toolMultiplier

if (not canHarvest): speedMultiplier = 1

else if (toolEfficiency): speedMultiplier += efficiencyLevel ^ 2 + 1

if (hasteEffect): speedMultiplier *= 1 + (0.2 * hasteLevel)

if (miningFatigue): switch (miningFatigueLevel): case 0: speedMultiplier *= 0.3 case 1: speedMultiplier *= 0.09 case 2: speedMultiplier *= 0.0027 default: speedMultiplier *= 0.00081

if (inWater and not hasAquaAffinity): speedMultiplier /= 5

if (not onGround): speedMultiplier /= 5

damage = speedMultiplier / blockHardness

if (canHarvest): damage /= 30 else: damage /= 100

if (damage > 1): return 0
 * 1) Instant breaking

ticks = roundup(1 / damage)

seconds = ticks / 20

return seconds

Best tools
Fastest tools to mine specific blocks:

Blocks by hardness
The following table shows the time it takes to break each type of block. Values with a red background indicate that it cannot be harvested by that quality of tool. If there is no tool that helps speed up mining that block, the "tool" column is left empty. A few blocks are harvested faster with shears or a sword. These speeds are listed in the last two columns if different than "nothing".

Note that some blocks don't drop anything even when mined with the proper tool; these are marked with a yellow background.

Any blocks with a breaking time of 0.05 seconds or less can be broken without the $3/10$ second delay which occurs between each broken block. See instant breaking above.

Any block that has a hardness of infinity actually has a hardness of -1 however the seconds start to tick from 0 meaning that it can never break.

[ [ edit values]]

Trivia

 * In the code, blocks use a hardness value of -1 in order to make blocks unbreakable.
 * The breaking animation is intentionally programmed by the developers to appear off-center on certain blocks such as chests and signs.