Dispenser

A Dispenser is a special block available since Beta 1.2. When right-clicked, a menu allows you to place items inside it. Each time the block receives power from a redstone circuit, a random item from its inventory drops out.

Unlike chests, when a dispenser is destroyed, the items inside are gone forever. Notch has stated that this is a bug:.

Crafting
When placed, the dispenser faces the player (it will dispense items towards where the player is standing).

Dispensing
Most items placed in a dispenser will simply be ejected as items and land 2-4 blocks away if on level ground. Arrows, eggs, and snowballs that are stored inside the dispenser are instead fired out (as if they were right-clicked in your inventory). Arrows will cause damage (and cannot be picked up, like arrows fired by skeletons); eggs and snowballs break with all the usual effects.

Unlike most other redstone-triggered devices, it may be triggered by redstone wire placed up to one block adjacent to it as well as running directly into it; therefore a single redstone wire can trigger up to 5 dispensers in a cross pattern. This allows for easy creation of large walls of dispensers.

When a dispenser dispenses an item, it emits a clicking sound and a puff of smoke. If it is empty when activated, it emits a slightly higher-pitched click.

A dispenser will not work if it is placed underwater, unless all sides but the face are covered with a block.

If the face of the dispenser is covered by a block, and the dispenser is facing west or south, fired items will pass through the block. This will soon be fixed.

Advanced Trap Making
Because of its ability to fire Arrows, eggs, and snowball, the dispensers make ideal traps. A dispenser hooked up to a Clock Generator circuit will fire multiple times until it is out of ammunition (see Redstone Circuits). This combined with a switch or timing element can create an effective machine gun barrage of projectiles. When combined with the West/South quirk allowing projectiles to be fired through blocks, one can make a completely hidden automated machine gun.

Some examples of more complex traps: 1) Machine Gun: Connect a lever and a clock to an AND gate, and then link the output from that AND gate to a dispenser full of arrows. This effectively creates a switch-operated machine gun.

2) Semi-Automatic: Use the above example with any form of input (lever, button, pressure plate etc). In addition to linking to the AND gate, have the pressure plate start a signal through a series of delay circuits. Have the delay circuits output TRUE by default and FALSE when the pressure plate is pressed. Have the signal from the delay circuits hooked up to another AND gate, which you can place between the first AND gate and the dispenser. By doing this, you will have a pulsing signal that only fires a shot if the initial input is true and if the delay timer hasn't gone off yet. This can be used to make timed bursts of projectiles to conserve ammunition. It is thus possible through trial and error to create a semi-automatic firing mechanism fine-tuned to deliver just the right number of projectiles.

3) Door Trap: Using quirk with updating a water or lava square to cause it to change directions (read more here in this thread), one can convert the update of ANY block adjacent to the water into a signal that fires the trap. Simply place redstone wire or a redstone torch in the path the water will take when it updates. Doing this will cause the water or lava to wash/burn away the redstone, switching the input signal to the trap. If arranged properly, this can trigger a single arrow to fire or begin a machine-gun burst as outlined above. This technique can be used to trigger the trap when an update function--such as a door opening--occurs next to the water tile. Unfortunately, this trap must be manually reset each time it is triggered.

4) Wall Trap Place the dispenser behind a wall and make sure it is facing West or South. To find out which direction is which, use the top face of a cobblestone. If you can read an "L" in the upper left hand corner of the texture, you are facing north (the direction clouds travel). In order to better disguise your trap in a stone hallway, you can smelt Cobblestone into smooth Stone which is indistinguishable from natural rock.

Trivia

 * The Dispenser uses the same texture as the Furnace on all sides except the face, which has a unique texture.
 * Interestingly, the texture file for the dispenser menu is named "trap.png", possibly because it was originally designed for making arrow traps.