Redstone Power

From the Minecraft Beta 1.7.3 Wiki

Redstone power is the on-or-off signal that redstone components send to the blocks around them.

Power sources

Source Powers these blocks beside it Powers this solid block On
Lever Lever all six strongly: the block it is attached to until used again
Button Button all six strongly: the block it is attached to for 20 ticks
Pressure Plate Pressure Plate all six strongly: the block beneath it while something stands on it
Detector Rail Detector Rail all six strongly: the block beneath it while a minecart is on it
Redstone Torch Redstone Torch all but the block it is attached to strongly: the block above it while the block it is attached to is not powered
Redstone Repeater Redstone Repeater the block in front of it strongly: the block in front of it from 2 to 8 ticks after the block behind it is powered
Redstone Dust Redstone Dust the block beneath it, and the blocks it points into weakly: the same blocks while it carries power

Redstone dust carries power from block to block, and loses strength as it goes.

Powered blocks

A full, solid block is powered only through the table's third column, and then passes the power on:

  • A strongly powered block powers every block around it that responds to power, dust included.
  • A weakly powered block powers every block around it that responds to power, except dust.

Block updates

A block that changes sends a block update to each of its six neighbours, asking it to check itself again; see Game Tick#Block updates. Every block update carries the type of block that sent it.

Most blocks that respond act on any block update. Doors, trapdoors, TNT, note blocks, dispensers and rails act only on a block update from a power source: dust, a redstone torch, a lever, a button, a pressure plate or a detector rail. They ignore the rest.

Change Its block updates come from
A block placed, or its metadata changed the block
A block broken air, which is not a power source
A power source switching, or broken while on the power source
A repeater switching the repeater, which is not a power source

Blocks that respond

A block that responds is powered when a source beside it powers it, or when a powered block is beside it. A piston also counts as powered when the space above it would be, and a dispenser when the block above it is. This is quasi-connectivity.

Block Responds when Acts on
Redstone Dust Redstone Dust it is powered any block update
Redstone Torch Redstone Torch the block it is attached to is powered: turns off 2 ticks later any block update
Redstone Repeater Redstone Repeater the block behind it is a source powering it, a powered block, or dust carrying power any block update
Wooden Door Wooden Door Iron Door Iron Door either half is powered: opens a block update from a power source
Trapdoor Trapdoor it is powered: opens a block update from a power source
TNT TNT it is powered: lights a block update from a power source
Note Block Note Block it is itself a powered block, strongly or weakly: plays once a block update from a power source
Dispenser Dispenser it is powered, directly or by quasi-connectivity: fires 4 ticks later, then again 4 ticks after each later block update it acts on while still powered a block update from a power source
Piston Piston Sticky Piston Sticky Piston it is powered from any side but its front, directly or by quasi-connectivity: extends any block update
Powered Rail Powered Rail it or the block above it is powered, or a powered rail it joins is: switches on any block update
Rail Rail power reaches a three-way junction: switches the curve a block update from a power source

Missed updates

A block that responds checks its power only when it gets a block update it acts on. A change to its power that brings no such block update goes unnoticed, and the block keeps its old state until its next one.

Change Missed by
Power reaching a piston or dispenser only by quasi-connectivity Piston Piston Sticky Piston Sticky Piston Dispenser Dispenser
A repeater switching Wooden Door Wooden Door Iron Door Iron Door Trapdoor Trapdoor TNT TNT Note Block Note Block Dispenser Dispenser Rail Rail
Dust changing shape but not level, as when a lever is placed or broken beside the end of a line whatever responds beside the block the dust stops or starts pointing into
A piston extending, and anything its push sets off every other piston of the same kind, normal or sticky

A piston left waiting like this is a block update detector: it moves at the next block update it gets. A redstone torch that misses one also rechecks at its next random tick.

Update order

Direction

A block that changes sends its block updates one neighbour at a time, in the order −x, +x, −y, +y, −z, +z. Each neighbour acts on its block update before the next one gets its own, and a piston moves at once. When one change reaches two pistons aimed at the same space, the piston updated first takes it. A machine that relies on two blocks reacting to one change in some order can work facing one way and fail turned a quarter turn.

Dust

When dust turns on or off, it sends its block updates from an update list of seven positions: its own position and the six positions touching it. It goes down the list one position at a time. At each position, it sends a block update to each of the six blocks touching that position, in the order −x, +x, −y, +y, −z, +z. The order of the list itself comes from a hash of the coordinates.

  • Switching on runs depth first. When a block update from one dust turns on a second dust, the second dust works through its whole update list before the first dust sends its next block update. Where a line splits on one level, the branch on the −x side starts first, then +x, −z and +z. Its first dust can still fire the other branches before its own: that dust's update list includes the position of the dust where the line splits.
  • Switching off makes one update list for the whole network, and works through it in hash order.

The hash order also depends on a table shared by the whole game, in every world. The table starts with 16 buckets, doubles when a network switching off needs more, and never gets smaller until the game is closed. So the same machine can act differently in two places, and in one place before and after another network anywhere switches off. Java 7 and earlier use a different hash from Java 8 and later.

Timing

Power moves through dust, levers, buttons, plates and powered blocks within the tick, and a piston moves within the tick of its block update. Torches, repeaters and dispensers add the delays above, as scheduled ticks.

Waiting in the queue

Every scheduled tick in a dimension waits in one queue, earliest first. When more than 1000 are due, only the first 1000 run in the current game tick. The rest are deferred to the next tick, so redstone delays in that dimension run late. Generating new terrain fills the queue: every block in the underground pockets of gravel queues a tick as it is placed, a few hundred to a chunk. On a server, a player arriving in new terrain 3000 blocks away stopped a clock at spawn for 160 to 185 ticks, when it normally switched every 10.

Lost delays

A delay still waiting is not saved with its chunk. Closing the world loses every one, and so does unloading a chunk, as a server does when no player is near. Delays also lapse near the edge of the loaded area; see Chunk. A redstone torch whose delay is lost corrects itself at its next random tick. A repeater does not, so a clock built with repeaters usually stops for good.

Random ticks

A random tick can make a redstone torch switch inside its 2 ticks, and a button, pressure plate or detector rail release inside its 20. Near a player, the odds are about 1 in 410 for each tick a block waits.

Torch burnout

A redstone torch that turns off for the 8th time within 100 ticks burns out. Every torch in the running game shares one record of turn-offs. A torch in another world, or in the other dimension of a server, can keep a torch from relighting.