Mining

From the Minecraft Beta 1.7.3 Wiki

Mining is breaking a block in the world by holding the attack button on it.

Breaking a block

Damage to a block is measured in strength — a fraction added once per tick, with the block breaking on the tick the running total reaches 1. Strength comes from one of two formulas, depending on whether the player can harvest the block at all:

  • Harvestable — speed ÷ (hardness × 30) per tick, where speed is the held item's multiplier against that particular block, default of 1 for a bare hand or non-tool
  • Not harvestable — 1 ÷ (hardness × 100) per tick, flat. The held item is never consulted on this branch, so a wooden pickaxe chews through Diamond Ore at exactly the speed of a bare fist.

Breaking time in ticks is one divided by that, rounded up: hardness × 30 ÷ speed when the block is harvestable, and a flat hardness × 100 when it is not. There are twenty ticks in a second.

Where that division comes out as a whole number, the block sometimes takes one tick more. The running total is kept as a floating-point number, and can land just short of 1 on the tick it should reach it.

The following table shows breaking times for Stone, which has a hardness of 1.5:

Held item Speed Ticks Seconds
Wooden Pickaxe Wooden Pickaxe 2 23 1.15
Stone Pickaxe Stone Pickaxe 4 12 0.6
Iron Pickaxe Iron Pickaxe 6 8 0.4
Diamond Pickaxe Diamond Pickaxe 8 6 0.3
Golden Pickaxe Golden Pickaxe 12 4 0.2
Anything else, or nothing — 151 7.55

The count starts on the tick after the block is first targeted: the first tick on a new target only records its position. Looking away and back resets the total to zero, so a partly-mined block recovers completely the moment the crosshair leaves it.

Instant and unbreakable blocks

A hardness of zero divides to infinity, which clears the threshold on the first frame. Those blocks break the instant the button goes down, before any damage accumulates at all — Torch, Redstone Dust, Sapling, Flower, Tall Grass, TNT and the rest of the zero-hardness list.

A negative hardness results in negative strength, preventing the target block from ever being broken. Only Bedrock and the Portal block have negative hardness.

The five-tick floor

Instant blocks do not come down twenty a second. Two separate delays cap the rate, and they work independently of each other.

The first is a countdown on the controller. Finishing a block through the damage counter sets it to 5, and every tick it stands above zero is spent decrementing it: no target is read and no damage is added to anything. Five ticks go that way, and the sixth is the re-target tick, which only stores the new block's position. Holding the attack button down therefore leaves seven ticks, just over a third of a second, between one block breaking and the next taking its first damage.

The second is auto-repeat. Holding the button re-runs the click path once every five ticks — ticksPerSecond / 4, against a timer running at 20 — while a fresh press runs it at once, with no such test. That click path is the one that breaks a zero-hardness block, so instant blocks come down on the auto-repeat rather than through the damage counter, and a player clicking faster than five ticks apart breaks them faster than a player holding the button.

Clicking at nothing — swinging at air rather than at a block — costs ten ticks during which left-click does nothing at all.

Releasing the attack button

Once a tick the game asks whether the attack button is down and the crosshair is on a block. Whenever either answer is no it calls resetBlockRemoving, and that does more than discard the accumulated damage: it zeroes the five-tick countdown and the ten-tick air-swing lockout as well. Both are cancelled outright rather than left to run down.

Releasing and re-pressing the button does therefore start the next block sooner. The countdown dies on the tick the button reads as up, the press re-targets on the tick after, and damage begins on the tick after that — three ticks against the seven a held button costs:

Tick Button held Button released and re-pressed
T the block breaks, countdown set to 5 the block breaks, countdown set to 5
T+1 countdown 5 → 4 button up: damage and countdown both zeroed
T+2 countdown 4 → 3 button down: the new block is targeted
T+3 countdown 3 → 2 first damage
T+4 countdown 2 → 1
T+5 countdown 1 → 0
T+6 the new block is targeted
T+7 first damage

Two things bound it. The button must read as up at the moment the check runs, so a release and a press inside one tick achieve nothing — the check sees a button that never left the mouse. And the same reset throws away accumulated damage, so letting go part-way through a block loses that progress; it is free only in the window straight after a break, where the damage is already zero.

Looking away costs nothing extra, because it is the same reset. A crosshair that leaves the block for a tick cancels the countdown exactly as a released button does.

That is the single-player controller. Multiplayer runs a different one, on which letting go does not clear the countdown; re-pressing still pays there, but for a different reason. See the pause in multiplayer.

Water and falling

Two conditions reduce the player's speed, and both are checked only when mining a harvestable block:

  • Mining with the head underwater divides speed by five.
  • Mining while not standing on the ground divides speed by five.

They stack, so mining from a jump underwater runs at a twenty-fifth of normal speed. The test for water samples eye level rather than the feet, so standing waist-deep costs nothing.

Because both penalties only apply to harvestable blocks, they do not apply at all to a block the player cannot harvest. Punching Stone bare-handed takes 7.5 seconds whether the player is dry and standing still or swimming in mid-fall.

Tools

A tool's speed multiplier depends on the block. Each tool class carries a short list of blocks it is effective against; against anything on the list it returns its material's multiplier, and against everything else it returns 1 — the same as a bare hand.

Material Speed Harvest level Durability
Wood 2 0 59
Gold 12 0 32
Stone 4 1 131
Iron 6 2 250
Diamond 8 3 1561

Gold is the fastest material in the game and the most fragile, mining at one and a half times a diamond tool's rate and lasting a forty-seventh as many blocks.

What each tool is effective against

Nothing else carries a multiplier. A hoe mines at bare-hand speed and takes no damage from it.

Because the lists are written out one block at a time, several things are missing from them. Obsidian is not on the pickaxe's list, so even a Diamond Pickaxe takes it at speed 1 — 301 ticks, just over fifteen seconds, a block. Neither are Bricks, Furnace, Dispenser, Monster Spawner, Redstone Ore, Glowstone, Iron Door, the stone Pressure Plate or Stone Stairs, all of which still need a pickaxe to drop anything.

The axe's list names only planks, wood, bookshelves and chests. Every other wooden block breaks at bare-hand speed whatever it is hit with: Wooden Stairs, fences, crafting tables, doors, trapdoors, jukeboxes, note blocks, signs, the wooden pressure plate and the locked chest.

Tool wear

A tool loses one point of durability per block broken, whatever the block, and whether or not it was on the tool's list or dropped anything. Breaking a Torch with a diamond pickaxe costs the same point as breaking Stone.

The exceptions:

  • A sword takes two points per block.
  • Shears take a point only on Leaves and Cobweb, and nothing at all for any other block.
  • A hoe, and anything that is not a tool, take nothing.

A tool lasts one block more than its durability. The block that destroys the tool still breaks, and still drops. See Durability.

Drops

Breaking a block and harvesting it are different things. The block is always removed; the drop happens only if the player can harvest it.

Most blocks are harvestable by anything, including an empty hand. The question is only ever asked of five materials — the only ones flagged as needing a tool:

Material Blocks Harvested by
Rock Stone, Cobblestone, every stone ore, Lapis Lazuli Block, Obsidian, Bricks, Sandstone, Furnace, Dispenser, Monster Spawner, Glowstone, Netherrack, the stone pressure plate, Stone Stairs, and every slab, the wooden one included a pickaxe of sufficient level
Iron Block of Iron, Block of Gold, Block of Diamond, Iron Door a pickaxe of sufficient level
Snow, built snow Snow, as a layer and as a block a shovel, of any material
Web Cobweb a sword or Shears

This table is separate from the lists of what each tool is effective against. A tool can harvest a block it is not effective against.

Harvest levels

Within rock and iron, the pickaxe also has to be good enough. The rule is a sequence of explicit checks on the block rather than a general comparison of tiers:

Block Needs
Obsidian a Diamond Pickaxe exactly — level 3, not "3 or better"
Diamond Ore, Block of Diamond, Gold Ore, Block of Gold, Redstone Ore iron or better
Iron Ore, Block of Iron, Lapis Lazuli Ore, Lapis Lazuli Block stone or better
Any other rock or iron block any pickaxe

A Golden Pickaxe sits at harvest level 0 alongside wood, so for all its speed it cannot harvest iron, gold, redstone, lapis, diamond or obsidian.

Mining a non-harvestable block always uses the slow strength = 1 ÷ (hardness × 100) formula.

What blocks drop

Mining does not always return the block. The substitutions:

Block Drops
Stone Stone Cobblestone Cobblestone
Coal Ore Coal Ore one Coal Coal
Diamond Ore Diamond Ore one Diamond Diamond
Lapis Lazuli Ore Lapis Lazuli Ore four to eight Lapis Lazuli Lapis Lazuli
Redstone Ore Redstone Ore four or five Redstone Dust Redstone
Glowstone Glowstone two to four Glowstone Dust Glowstone Dust
Clay Clay four Clay Ball clay balls
Cobweb Cobweb one String String
Snow Snow, as a layer one Snowball Snowball
Snow Snow, as a block four Snowball snowballs
Gravel Gravel Flint Flint one time in ten, gravel otherwise
Leaves Leaves a Sapling Sapling one time in twenty
Tall Grass Tall Grass, Fern Fern Seeds Seeds one time in eight, nothing otherwise, shears included
Iron Ore Iron Ore, Gold Ore Gold Ore the ore block itself, for smelting

Four blocks give nothing at all, however they are broken: Glass, Bookshelf, Monster Spawner and Dead Bush. Ice gives nothing either, and turns into a Water source on the spot if the block beneath it is solid or liquid.

Shears change what Leaves give: cut with shears, a leaf block returns itself, of the right wood, instead of rolling for a Sapling.

On a server

The client decides when a block breaks and the server checks the arithmetic afterwards. Three limits apply that do not exist in single-player.

  • Reach. The client will not target a block more than 4 blocks away, and the server independently rejects any dig starting or finishing further than 6 blocks from the player.
  • Re-timing. The server counts ticks from the moment digging started and accepts the break once the block would be at least 70% destroyed. A break claimed earlier than that is deferred rather than rejected: the server holds the position and completes it on the tick its own counter fills.
  • Spawn protection. In the Overworld, a non-operator cannot break any block within 16 blocks of the world spawn, measured as the larger of the two horizontal distances. The server answers the attempt by sending the block back, so it reappears after a moment.

The pause in multiplayer

Multiplayer runs its own controller, and the five-tick countdown works differently on it. Letting go of the button does not zero it — the reset cancels the dig and leaves the countdown where it is — and the countdown only runs down while a dig is armed, which happens in the click path. So the five ticks are paid whatever the player does. What re-pressing skips is the wait for the click path itself, and that is worth having.

For an ordinary block, a held button leaves six to ten ticks between one block breaking and the next taking damage, depending on where the break falls in the five-tick auto-repeat cycle. A press on the tick after the release runs the click path at once and makes it a flat seven — worth about a tick a block on average, and nothing at all when the break happens to land just before an auto-repeat would have fired anyway.

For an instant block the difference is much larger, because in multiplayer the click path is the only thing that breaks one. clickBlock removes a zero-hardness block without arming a dig, so the damage counter never runs on it at all, and a held button takes exactly four a second. Each fresh press takes one at once, so clicking is as fast as the player can click.

The exception is a dig already armed on some other block. The controller answers a target that is not the armed one by calling the click path again, once a tick and with no auto-repeat test, and breaking an instant block that way still leaves the armed position untouched — so every later target mismatches too. A player who starts on Stone and then sweeps across torches or Tall Grass without letting go takes one a tick, twenty a second, until the button comes up.

Block hardness

Every block in the game, sortable by hardness. Multiply by 30 and divide by the tool's speed for the tick count with a working tool, or by 100 for the count without one. A whole-number result is sometimes one tick short; see Breaking a block.

IconNameIDHardnessBlast resistanceLight
StoneStone11.560
GrassGrass20.60.60
DirtDirt30.50.50
CobblestoneCobblestone4260
Wooden PlanksWooden Planks5230
SaplingSapling6000
BedrockBedrock7-136000000
WaterWater81001000
WaterWater91001000
LavaLava100015
LavaLava1110010015
SandSand120.50.50
GravelGravel130.60.60
Gold OreGold Ore14330
Iron OreIron Ore15330
Coal OreCoal Ore16330
WoodWood17220
LeavesLeaves180.20.20
SpongeSponge190.60.60
GlassGlass200.30.30
Lapis Lazuli OreLapis Lazuli Ore21330
Lapis Lazuli BlockLapis Lazuli Block22330
DispenserDispenser233.53.50
SandstoneSandstone240.80.80
Note BlockNote Block250.80.80
BedBed260.20.20
Powered RailPowered Rail270.70.70
Detector RailDetector Rail280.70.70
Sticky PistonSticky Piston290.50.50
CobwebCobweb30440
Tall GrassTall Grass31000
Dead BushDead Bush32000
PistonPiston330.50.50
WoolWool350.80.80
FlowerFlower37000
RoseRose38000
Brown MushroomBrown Mushroom39001
Red MushroomRed Mushroom40000
Block of GoldBlock of Gold41360
Block of IronBlock of Iron42560
Double Stone SlabDouble Stone Slab43260
Stone SlabStone Slab44260
BricksBricks45260
TNTTNT46000
BookshelfBookshelf471.51.50
Moss StoneMoss Stone48260
ObsidianObsidian491012000
TorchTorch500014
FireFire510015
Monster SpawnerMonster Spawner52550
Wooden StairsWooden Stairs53230
ChestChest542.52.50
Redstone DustRedstone Dust55000
Diamond OreDiamond Ore56330
Block of DiamondBlock of Diamond57560
Crafting TableCrafting Table582.52.50
CropsCrops59000
FarmlandFarmland600.60.60
FurnaceFurnace613.53.50
FurnaceFurnace623.53.513
SignSign63110
Wooden DoorWooden Door64330
LadderLadder650.40.40
RailRail660.70.70
Stone StairsStone Stairs67260
SignSign68110
LeverLever690.50.50
Pressure PlatePressure Plate700.50.50
Iron DoorIron Door71550
Pressure PlatePressure Plate720.50.50
Redstone OreRedstone Ore73330
Redstone OreRedstone Ore74339
Redstone TorchRedstone Torch75000
Redstone TorchRedstone Torch76007
ButtonButton770.50.50
SnowSnow780.10.10
IceIce790.50.50
SnowSnow800.20.20
CactusCactus810.40.40
ClayClay820.60.60
Sugar caneSugar cane83000
JukeboxJukebox84260
FenceFence85230
PumpkinPumpkin86110
NetherrackNetherrack870.40.40
Soul SandSoul Sand880.50.50
GlowstoneGlowstone890.30.315
PortalPortal90-1011
Jack 'o' LanternJack 'o' Lantern911115
CakeCake920.50.50
Redstone RepeaterRedstone Repeater93000
Redstone RepeaterRedstone Repeater94009
Locked chestLocked chest950015
TrapdoorTrapdoor96330