Dispenser

A dispenser is a solid block used as a redstone component to dispense items.

Obtaining
A dispenser can be mined using any pickaxe. If mined without a pickaxe, it will drop nothing.

Natural generation
Two dispensers are naturally generated in every jungle temple.

Usage
A dispenser can be used as a container and as a redstone component which dispenses items when activated, with results varying on the item dispensed.

To place a dispenser, it while pointing at a surface adjacent to the space it should occupy. A dispenser can be placed so that its output faces in any direction, including up or down. When placed, a dispenser will face towards the player placing it.

A dispenser cannot be moved by pistons, and water and lava will flow around a dispenser.

Container


A dispenser has 9 slots of inventory space.

To open the dispenser GUI, use the control. To move items between the dispenser inventory and the player inventory or hotbar while the dispenser GUI is open, drag or shift-click the items. To exit the dispenser GUI, use the control.

By default, the GUI of a dispenser is labeled "Dispenser". A dispenser's GUI label can be changed by naming the dispenser in an anvil before placing it, or by using the blockdata command. For example, to label a dispenser at (0,64,0) "Alice's Dispenser", use.

A dispenser can be "locked" by setting the dispenser's  tag. If a dispenser's  tag is not blank, the dispenser cannot be accessed except by players holding an item with the same name as the   tag's text. A dispenser's  tag can be set or unset with the blockdata command. For example, to lock a dispenser at (0,64,0) so that only players holding an item named "Alice's Key" can access the dispenser, use.

Redstone component
A dispenser can be used to randomly dispense its contents.


 * Activation


 * A dispenser is a redstone mechanism and can be activated by:
 * an adjacent active power component: for example, a redstone torch (except that a redstone torch will not activate a dispenser it is attached to), a block of redstone, a daylight sensor, etc.
 * an adjacent powered opaque block (for example, a block with an active redstone torch under it)
 * a powered redstone repeater or redstone comparator facing the dispenser
 * powered redstone dust configured to point at the dispenser, or on top of it, or a directionless "dot" next to it; a dispenser is not activated by adjacent powered redstone dust which is configured to point in another direction.


 * Some of these methods can activate a dispenser (in the sense of triggering an action) without actually powering the dispenser (in the sense of whether the dispenser will power adjacent redstone dust, etc.).


 * In addition to the methods above, a dispenser can also be activated by quasi-connectivity. A dispenser will be activated if one of the methods above would activate a mechanism component in the block above the dispenser, even if there is no mechanism component there (even if the block above the dispenser is air or a transparent block), but only when the dispenser receives a block update (including a redstone update within two blocks of the dispenser).


 * A dispenser will not activate if it has been less than 1 redstone tick (2 game ticks, or 0.1 seconds barring lag) since its last activation ended.


 * Behavior


 * When activated, a dispenser waits 2 redstone ticks (4 game ticks, or 0.2 seconds barring lag) and then ejects one item. The dispenser does not continue to eject items while activated -- ejection occurs only on the initial activation (the rising edge of an input signal). To eject multiple items, repeatedly activate the dispenser with a clock circuit.


 * If multiple slots are occupied by items, a random occupied slot will be chosen for ejection. The slot is chosen when an item is ejected, not when the dispenser is initially activated, thus it is possible to move items into or out of a dispenser between its activation and item dispensing.


 * The effects of being activated vary with the type of ejected item. Most items will simply be thrown in the direction the dispenser is facing, as if a player had used the control. (Unlike a dropper, a dispenser can't feed another container.) Other items will behave differently when dispensed:


 * {| class="collapsible wikitable"

! colspan=2 | Dispenser Behavior ! Item ! Effect
 * Equips on a player or armor stand within the block the dispenser is facing with empty appropriate armor slot (any armor, made from any material).
 * Fired in the direction the dispenser is facing.
 * Placed as entity (i.e., a right-clickable vehicle) in the block the dispenser is facing, if the dispenser is facing water or an empty block above water &mdash; otherwise dropped.
 * Uses bone meal (as fertilizer) on the block the dispenser is facing, if possible. If the block faced does not react to bonemeal, no bone meal is used.
 * Thrown in the direction the dispenser is facing, as if the player had right-clicked the item in their inventory. Splash potions and lingering potions are fired farther.
 * Collects lava or water source block the dispenser is facing, adding the newly filled bucket to an empty slot in the dispenser's inventory. If there isn't room in the dispenser for the newly-filled bucket (i.e. the empty bucket was part of a stack and all other slots in the dispenser are also full), drops the filled bucket. If no source block is in front of the dispenser, drops an empty bucket.
 * Launches fireball (as if produced by a blaze) in the direction the dispenser is facing. When a dispensed fireball hits a mob (including a player) or a block, the mob or block will be set on fire. When a dispensed fireball hits a boat or minecart, the vehicle will be destroyed and drop itself as an item.
 * Placed in front of the dispenser and launched upwards.
 * If the dispenser is facing an air block, place fire in the air block and reduce durability of the flint and steel. If the dispenser is facing TNT, ignite the TNT. Otherwise, do nothing.
 * Places lava or water in the block the dispenser is facing (replacing the lava or water bucket in the dispenser with an empty bucket), if the block the dispenser is facing is one that the player could use a lava or water bucket on (e.g., air, flowers, grass, etc. &mdash; doesn't work with a cauldron) &mdash; otherwise dropped. Water dispensed in The Nether will disappear instantly, leaving only the empty bucket in the dispenser.
 * style="white-space:nowrap;"|
 * Placed as entity (i.e., a right-clickable vehicle) in the block the dispenser is facing, if the dispenser is facing a type of rails &mdash; otherwise dropped.
 * Placed as blocks. If placement completes the construction of an iron golem, snow golem, or wither, the entity will be created as if constructed by a player. Equips on a player, mob or armor stand with an empty helmet slot, within the block the dispenser is facing.
 * Summons a mob in front of the dispenser.
 * Places and ignites TNT in the block the dispenser is facing, with a small velocity in a random direction.
 * Others
 * Dropped: Ejected towards the block the dispenser is facing, as if a player had used the control.
 * }
 * Launches fireball (as if produced by a blaze) in the direction the dispenser is facing. When a dispensed fireball hits a mob (including a player) or a block, the mob or block will be set on fire. When a dispensed fireball hits a boat or minecart, the vehicle will be destroyed and drop itself as an item.
 * Placed in front of the dispenser and launched upwards.
 * If the dispenser is facing an air block, place fire in the air block and reduce durability of the flint and steel. If the dispenser is facing TNT, ignite the TNT. Otherwise, do nothing.
 * Places lava or water in the block the dispenser is facing (replacing the lava or water bucket in the dispenser with an empty bucket), if the block the dispenser is facing is one that the player could use a lava or water bucket on (e.g., air, flowers, grass, etc. &mdash; doesn't work with a cauldron) &mdash; otherwise dropped. Water dispensed in The Nether will disappear instantly, leaving only the empty bucket in the dispenser.
 * style="white-space:nowrap;"|
 * Placed as entity (i.e., a right-clickable vehicle) in the block the dispenser is facing, if the dispenser is facing a type of rails &mdash; otherwise dropped.
 * Placed as blocks. If placement completes the construction of an iron golem, snow golem, or wither, the entity will be created as if constructed by a player. Equips on a player, mob or armor stand with an empty helmet slot, within the block the dispenser is facing.
 * Summons a mob in front of the dispenser.
 * Places and ignites TNT in the block the dispenser is facing, with a small velocity in a random direction.
 * Others
 * Dropped: Ejected towards the block the dispenser is facing, as if a player had used the control.
 * }
 * style="white-space:nowrap;"|
 * Placed as entity (i.e., a right-clickable vehicle) in the block the dispenser is facing, if the dispenser is facing a type of rails &mdash; otherwise dropped.
 * Placed as blocks. If placement completes the construction of an iron golem, snow golem, or wither, the entity will be created as if constructed by a player. Equips on a player, mob or armor stand with an empty helmet slot, within the block the dispenser is facing.
 * Summons a mob in front of the dispenser.
 * Places and ignites TNT in the block the dispenser is facing, with a small velocity in a random direction.
 * Others
 * Dropped: Ejected towards the block the dispenser is facing, as if a player had used the control.
 * }
 * Summons a mob in front of the dispenser.
 * Places and ignites TNT in the block the dispenser is facing, with a small velocity in a random direction.
 * Others
 * Dropped: Ejected towards the block the dispenser is facing, as if a player had used the control.
 * }
 * Others
 * Dropped: Ejected towards the block the dispenser is facing, as if a player had used the control.
 * }


 * When a dispenser dispenses an item, it emits a clicking sound (unless the item is a projectile or a spawn egg) and a smoke particle. If it is empty when activated, it emits a slightly higher-pitched click. The noise of a dispenser can be heard up to 16 blocks away.


 * A dispenser is a full solid opaque block, so powering it directly can cause adjacent mechanism components (including other dispensers) to activate as well.

Data values
Every dispenser has the ID name, and is further defined by its block data and block entity. A dispenser also has a block state which is expected to replace the functionality of block data in a future version.

Block data
A dispenser uses its block data field to store its orientation and activation status:

Block entity
A dispenser has a block entity associated with it that holds additional data about the block. The block's block entity ID is.