Command blocks can be obtained by using the pick block control Minecraft uses the standard control scheme of mouse and keyboard controls as input. The game cannot be played using only a mouse or only a keyboard using the default control scheme. The controls menu is or with various commands, such as
/give @p minecraft:command_block.
Just like other blocks that can store NBT data, using pick block + ctrl will copy the command and options inside the command block. This allows it to be placed elsewhere without having to re-enter the the data inside.
Command blocks are not available in the Creative Pixel art and other creations made in Creative mode. "Sandbox" redirects here. For a place to test edits to this wiki, see Minecraft Wiki:Sandbox. Creative mode is one of the main game modes in Minecraft. inventory, cannot be broken in Survival mode A new Survival game of Minecraft. The health and hunger bars, as well as the hotbar, are visible. See the game mode. For other uses, see Survival (disambiguation). Survival mode is one or if you do not have operator permissions, are not flammable, and have the same blast resistance A TNT explosion. An explosion is a physical event, generally destructive, that can be caused by several different circumstances. It can destroy nearby blocks, propel and damage nearby players, entities, and their armor, and cause as bedrock Bedrock Transparency No Luminance No Blast resistance 18,000,000 Tool None Renewable No Stackable Yes (64) Flammable No Drops None Data value dec: 07 hex: 7 bin: 111 Name bedrock Bedrock is a block, indestructible by survival means. Contents . Command blocks cannot be moved by a piston Piston Transparency Yes Luminance None Blast resistance 2.5 Tool Any tool Renewable Yes Stackable Yes (64) Flammable No Drops Itself Data values See Data values Pistons are blocks capable of pushing most blocks, depending on .
|“||So this block will be able to run cmds on redstone signals. With proper commands, many things can be scripted||„|
|— Jeb Jens Bergensten Real name Jens Bergensten Date of birth May 18, 1979 (age 38) 1] 2] Occupation Lead creative designer Nationality Swedish Languages English, Swedish 3] Spouse Jenny Bergensten 4] Children 1 5] Website oxeyegames.com Known announcing the command block|
A command block is a block See the various blocks found in Minecraft. For the blocking with shields that reduces damage when performed, see Blocking. All blocks Blocks are the basic units of structure in Minecraft. Contents 1 that can execute commands. Because it cannot be obtained in Survival mode A new Survival game of Minecraft. The health and hunger bars, as well as the hotbar, are visible. See the game mode. For other uses, see Survival (disambiguation). Survival mode is one without cheats, it is primarily used on multiplayer servers and in custom maps.
- See also: Commands Contents 1 Usage 1.1 Tilde notation 1.2 Target selectors 1.2.1 Target selector variables 1.2.2 Target selector arguments 1.3 Data tags 1.4 Raw JSON text 1.5 Block/item names 2 Summary of commands 3 List of commands and Tutorials/Command Block This article may need cleanup to comply with the style guide. Please help improve this if you can. The talk page may contain suggestions. This article is a stub. Please help us by expanding it.
A command block can execute commands when activated by redstone power See redstone circuits. For other redstone-related articles, see Redstone (disambiguation). Contents 1 Redstone basics 1.1 Redstone components 1.2 Power 1.3 Power level 1.4 Redstone update 1.5 Redstone tick 1.6 Signals and pulses . It always has all permissions, so it can be used to allow a specific use of a command by players who can`t use that command in general (for instance, allowing anyone to obtain a specific item with
/give, without allowing everyone to /give themselves whatever they want).
A command block has an orientation ("facing") which determines which chain command block will be activated, and which blocks will be checked to see if a command block in "Conditional" mode executes.
To enter or modify the command in a command block, use the Use Item control Minecraft uses the standard control scheme of mouse and keyboard controls as input. The game cannot be played using only a mouse or only a keyboard using the default control scheme. The controls menu is on the command block to open the command block GUI (graphical user interface). The GUI will only open if the player is in Creative mode Pixel art and other creations made in Creative mode. "Sandbox" redirects here. For a place to test edits to this wiki, see Minecraft Wiki:Sandbox. Creative mode is one of the main game modes in Minecraft. , and has the proper permissions. In singleplayer See general gameplay in Minecraft. For instructional material, see Tutorials. A fresh Survival game. Gameplay in most game modes of Minecraft consists mainly of adding and destroying a variety of different blocks , cheats must be enabled to edit command blocks. In multiplayer See the multiplayer experience in Minecraft. For the multiplayer software, see Server. PvP (Player versus Player) on a multiplayer server. Multiplayer is the server-based version of Minecraft that enables multiple players to , command blocks can only be edited successfully by operators See the multiplayer software in Minecraft. For the multiplayer experience, see Multiplayer. For the official Mojang paid-for servers, see Realms. For other unofficial Minecraft server software, see custom servers. Minecraft servers allow in Creative mode, and for command blocks to work at all the following values must be set in the server.properties The default server.properties file. server.properties is the file which stores all the settings for a multiplayer (Minecraft or Minecraft Classic) server. If you are going to edit server.properties it is important that you use the file:
enable-command-blockmust be set to
op-permission-levelmust be set to
2or above (default is 4)
- Console Command
- Commands can be entered in the top text pane. The text limit for commands in a command block is 32,500 characters, but the text pane can only show a small portion of this amount at a time. Press Tab ⃢₆Ⅱ to complete words or cycle through options.
- Commands in a command block do not need to be prefixed with the forward slash (
/) as they do in the chat window, but doing so will still work.
- Below the console command text pane are some reminder tips about how to use target selectors.
- Previous Output
- The bottom text pane displays the output message (success or failure) of the last executed command (initially blank). Its text is not editable.
- A button to the right of the Previous Output text pane specifies whether the last output should be stored and displayed. It shows
O(the default) when the output should be stored and
Xwhen the output should not be stored. A command block that`s tracking its output while executing its command will cause a block update, and when you have 64 of those command blocks tracking their output while executing their command sharing the same chunk, it will then cause 1 or more chunk updates because 64 block updates in 1 chunk will cause one or more chunk updates. If the amount of chunk updates is high enough, then it can cause fps drops for players if they receiving the chunk updates. To avoid this, simply have all of your command blocks not track their output at all. The track output option should only be used temporarily for debugging purposes.
- Click the "Impulse/Chain/Repeat" button to change the command block`s type. The default state is "Impulse", but non-default command blocks can be placed. The command block also changes color when changing its command block type:
- "Impulse" command blocks are orange. These execute once every time they are activated.
- "Chain" command blocks are green. These execute only after the command block pointing to it is processed. This differs from the Conditional option in that it detects what is pointing to it, instead of simply behind it. The command blocks pointing to it also don`t need to be chain command blocks themselves to trigger the chain.
- "Repeat" command blocks are purple. These will execute their commands once per game tick as long as they are activated (20 times per second, barring lag).
- Click the "Conditional/Unconditional" button to change the command block`s conditional behavior:
- "Conditional": A command block in conditional mode will only execute its command after the command block behind it has executed successfully ("behind it" in the sense of opposite to the direction the command block is facing, regardless of chain direction or even if chaining is occurring).
- "Unconditional" (default): A command block in unconditional mode will execute its command (if activated correctly) even if there`s a command block behind it that didn`t execute its command successfully.
- Always Active/Needs Redstone
- Click the "Always Active/Needs Redstone" button to change the command block`s activation requirements:
- "Needs Redstone" (the default for impulse and repeat command blocks): A command block in the "Needs Redstone" setting must be activated with redstone in order to execute its command.
- "Always Active" (the default for chain command blocks): The command block is always active even without redstone activation (chain command blocks will execute their command when chained, repeating command blocks will execute their command every game tick (20 times every second), and impulse command blocks activate once then cannot be activated again).
- Click the "Done" button or ⃢₆ℾ Enter to save the command and leave the command block GUI.
- Click the "Cancel" button or Esc to leave the command block GUI without saving any changes.
Command blocks are redstone mechanisms and can be activated by:
- An adjacent active power component: for instance, a redstone torch Redstone Torch Transparency Yes Luminance Yes, 7 (when on) Blast resistance 0 Tool Any tool Renewable Yes Stackable Yes (64) Flammable No Drops Itself Data values See Data values Name See Data values This article (except that a redstone torch will not activate a command block it is attached to), a block of redstone Block of Redstone Transparency Partial (blocks light, mob spawning possible) Luminance No Blast resistance 30 Tool Renewable Yes Stackable Yes (64) Flammable No Drops Itself Data value dec: 152 hex: 98 bin: 10011000 Name redstone_block This article is , a daylight sensor Daylight Sensor Type Block Entity Physics No Transparency Yes Luminance No Blast resistance 1 Hardness 0.2 Tool Renewable No Stackable Yes (64) Flammable No, but catches fire from lava First appearances See History Drops Itself , a button Button Transparency Yes Luminance No Blast resistance 2.5 Tool Any tool Renewable Yes Stackable Yes (64) Flammable No Drops Itself Data values See Data values Name See Data values A button is a non-solid block etc.
- An adjacent powered block (for instance, an opaque block with an active redstone torch under it)
- A powered redstone comparator Redstone Comparator Transparency Yes Luminance No (7 when powered, in Pocket Edition) Blast resistance 0 Tool Any tool Renewable No Stackable Yes (64) Flammable No Drops Redstone Comparator (1) Data values See Data values Name or redstone repeater Redstone Repeater Transparency Yes (partial) Luminance No (7 when powered, in Pocket Edition) Blast resistance 0 Tool Any tool Renewable Yes Stackable Yes (64) Flammable No Availability Survival, Creative Drops Redstone Repeater (1) Data values facing the mechanism component
- Powered redstone dust Redstone Transparency Yes Luminance No Blast resistance 0 Tool Any tool Renewable Yes Stackable Yes (64) Flammable No Availability Survival Drops Redstone (1) Data values See Data values Name See Data values This article is configured to point at the command block (or on top of it) or directionless; a command block is not activated by adjacent powered redstone dust which is configured to point away from it.
In addition, when a command block is cloned by a command to a powered location, the new command block will only execute its command if the original has never been activated (visible in the F3 debug screen as "triggered").
Unlike all other redstone components except the note block Note Block Type Solid Block Requirements None Physics No Transparency No Luminance No Blast resistance 4 Hardness 0.8 Tool Renewable Yes Stackable Yes (64) Flammable No, but catches fire from lava First appearances See History , a command block can be activated every game tick Nearly all video games (including Minecraft) are driven by one big program loop. Just as every gear in a clock is synchronized with the pendulum, every task involved in advancing a game simulation is synchronized (20 times per second, barring lag). Be that as it may, activating it two game ticks in a row requires that it transition from powered to unpowered and back during the same tick (for instance, with a setblock clock).
A command block in "Always Active" mode is always activated. The default state is "Needs Redstone", which means that it runs only when powered.
When activated, a command block will try to execute its command. depending on the command block`s type:
- a command block ("Impulse") will try to execute its command once
- a chain command block ("Chain") will not try to execute its command until another command block facing it executes its own command
- a repeating command block ("Repeat") will try to execute its command every game tick until no longer activated
If any command block faces a chain command block (a command block in "Chain" mode) when activated, it will notify the chain command block to also attempt execution. The chain command block will only execute its command if activated and, if in "Conditional" mode, if the command block behind it executed successfully (behind in the sense of the direction it is facing, not in the sense of which command block chained to it). Whether or not the chain command block is activated or executes successfully, if it is facing another chain command block, it will notify it to attempt execution as well.
Chained command blocks execute in the same game tick in the order they are chained. Chained execution cannot be passed to a command block which has already executed in that game tick (loops execute only once).
When activated, a command block can produce multiple types of output:
- Redstone Comparator
- A command block can power a redstone comparator facing away from it (possibly separated by a block) with a signal strength specific to the last executed command (for instance, the number of players affected by the command).
- The signal strength always reflects the last command executed, even after the command block is deactivated.
- The output message describes the success or failure of the executed command, and may be written to multiple destinations:
- Previous Output: The output message is always written to the "Previous Output" text pane of the command block GUI.
- Chat: The output message is written to the chat text in singleplayer mode, or broadcast to all other ops in multiplayer mode, unless it has been suppressed with
/gamerule commandBlockOutput false. Some commands may write additional text to the chat as their normal function which won`t be suppressed (for instance, the
/saycommand will write a message to the chat of all players), separate from the output message. Chat messages which would usually be prefaced by a player`s name (such as from the
@as the player name. If the command block had been named in an anvil Anvil Transparency Yes Luminance No Blast resistance 6,000 Tool Renewable Yes Stackable Yes (64), same damage state only Flammable No Drops Itself Data value dec: 145 hex: 91 bin: 10010001 Name anvil See the item before placement, that name will be used instead.
- Logs: The output message is written to multiplayer server logs unless it has been suppressed with
/gamerule logAdminCommands false.
- Command Stats
- Command blocks can post various success results to scoreboard objectives, including:
- SuccessCount: the number of successes (previously also available by redstone comparator output, but not limited to 15)
- AffectedBlocks: the number of blocks that were altered
- AffectedEntities: the number of entities that were altered (including players)
- AffectedItems: the number of items that were altered
- QueryResult: value returned by command
- The objectives to be used can be specified by running the
/statscommand or by modifying the command block`s NBT data directly with the
The following commands cannot be used in a command block:
/publish, and all of the multiplayer-only commands except
The following commands are usable but with limited functionality (their output only displays in the command block`s Previous Output pane rather than being displayed in the chat):
/scoreboard players, and
/scoreboard teams list.
The following commands use the command block`s name (defaults to
@) in their output:
Running "Searge" as the command in the command block without a preceding "
/" will now set the previous output to "#itzlipofutzli". Additionally, if
/help is run via command block, it gives various messages prefixed with "Searge says: ".
A command block has an ID name of
minecraft:command_block and is further defined by its block data and block entity. A command block also has a block state which is expected to replace the functionality of block data in 1.13 1.13 Planned releaseAnnounce date ? ◄◄ 1.12 See the computer edition. For other editions, see Version history (disambiguation). 1.13 is an upcoming major update with no set release date. It will focus . upcoming This page is about planned versions of all editions of Minecraft. These updates either have major sources to their existence or have received development versions. Note that only editions with known planned updates are listed
A command block`s ID determines its mode:
|Name See the definition of the block states. For the files that determine block models, see Models#Block states. Block states are extra pieces of data that further define a block. Contents 1 List||ID Name||Block/Item ID|
|Command Block|| ||137|
|Repeating Command Block|| ||210|
|Chain Command Block|| ||211|
- See also: Data values See values from the latest PC version of Minecraft. For values from Classic, see Data values/Classic. For values from Indev, see Data values/Indev. For values from the Pocket Edition, see Pocket Edition
A command block`s block data specifies whether the command block is currently activated.
A 3-bit field storing the command block`s facing:
6 and 7 are unused but produce command blocks facing down and up respectively.
|0x8||Whether the block is in conditional mode.|
- See also: Block entity format Chunks store the terrain and entities within a 16×256×16 area. They also store precomputed lighting, heightmap data for Minecraft s performance, and other meta information. Contents 1 NBT structure 2 Block format 3 Entity format 3.1
A command block has a block entity associated with it that holds additional data about the block. The block`s block entity ID is
Block entity data
- Tags common to all block entities see Template:Nbt inherit/blockentity/template
CustomName: Optional. The name will replace the usual `@` when using commands such as
CommandStats: Information identifying scoreboard parameters to modify relative to the last command run.
SuccessCountName: Player name to store success of the last command. Can be a player selector but may only have one resulting target.
SuccessCountObjective: Objective`s name to store the success of the last command.
AffectedBlocksName: Player name to store how many blocks were modified in the last command. Can be a player selector but may only have one resulting target.
AffectedBlocksObjective: Objective`s name to store how many blocks were modified in the last command.
AffectedEntitiesName: Player name to store how many entities were altered in the last command. Can be a player selector but may only have one resulting target.
AffectedEntitiesObjective: Objective`s name to store how many entities were altered in the last command.
AffectedItemsName: Player name to store how many items were altered in the last command. Can be a player selector but may only have one resulting target.
AffectedItemsObjective: Objective`s name to store how many items were altered in the last command.
QueryResultName: Player name to store the query result of the last command. Can be a player selector but may only have one resulting target.
QueryResultObjective: Objective`s name to store the query result of the last command.
Command: The command to issue to the server.
SuccessCount: Represents the strength of the analog signal output by redstone comparators attached to this command block. Only updated when the command block is activated with a redstone signal.
LastOutput: The last line of output generated by the command block. Still stored even if the gamerule Contents 1 Usage 1.1 Tilde notation 1.2 Target selectors 1.2.1 Target selector variables 1.2.2 Target selector arguments 1.3 Data tags 1.4 Raw JSON text 1.5 Block/item names 2 Summary of commands 3 List of commands commandBlockOutput is false. Appears in the GUI of the block when right-clicked, and includes a timestamp of when the output was produced.
TrackOutput: 1 or 0 (true/false) - Determines whether or not the LastOutput will be stored. Can be toggled in the GUI by clicking a button near the "Previous Output" textbox. Caption on the button indicates current state: "O" if true, "X" if false.
powered: 1 or 0 (true/false) - States whether or not the command block is powered by redstone or not.
auto: 1 or 0 (true/false) - Allows to activate the command without the requirement of a redstone signal.
conditionMet: 1 or 0 (true/false) - Indicates whether a conditional command block had its condition met when last activated. True if not a conditional command block.
UpdateLastExecution: 1 or 0 (true/false) - Defaults to true. If set to false, loops can be created where the same command block can run multiple times in one tick.
LastExecution: stores the tick a chain command block was last executed in.
- See also: Block states
|Name See the definition of the block states. For the files that determine block models, see Models#Block states. Block states are extra pieces of data that further define a block. Contents 1 List||Value||Description|
| ||True if the command block is in conditional mode.|
| ||The direction the command block is pointing.|
- See also: Commands₧History
|Official release Minecraft 1.0 Starting version 1.0.0 (Nov. 18th, 2011) Latest version 1.12 Paid Yes Website http://www.minecraft.net/ See the official release of Minecraft for the PC. For the version, see 1.0.0. For the first|
|27 Jul. 2012||Jeb Jens Bergensten Real name Jens Bergensten Date of birth May 18, 1979 (age 38) 1] 2] Occupation Lead creative designer Nationality Swedish Languages English, Swedish 3] Spouse Jenny Bergensten 4] Children 1 5] Website oxeyegames.com Known began tweeting of a new block he had created to start expanding Adventure mode. He began posting pictures, ideas and hints of what the block will be able to do.|
|31 Jul. 2012||During Notch`s AMA he hinted the block may be in 1.4.|
|1.4.2||12w32a||Added command block.|
|1.5||13w03a||Command block success can now power a redstone comparator Redstone Comparator Transparency Yes Luminance No (7 when powered, in Pocket Edition) Blast resistance 0 Tool Any tool Renewable No Stackable Yes (64) Flammable No Drops Redstone Comparator (1) Data values See Data values Name .|
|13w04a||Command blocks renamed with an anvil Anvil Transparency Yes Luminance No Blast resistance 6,000 Tool Renewable Yes Stackable Yes (64), same damage state only Flammable No Drops Itself Data value dec: 145 hex: 91 bin: 10010001 Name anvil See the item now use their name instead of @ in the chat.|
|1.6.1||13w19a||Command blocks are no longer mineable in Survival, and are also not damaged by explosions except by Blue Wither Skulls.|
|1.7.2||13w37a||Added a bar that shows the previous output.|
|Increased the character limit from 256 to 16,369 when inserting a command in-game. Using a third-party editor allows you to reach 32,767 characters.|
|1.8||14w07a||Dispensers now place command blocks, instead of shooting it out.|
|14w20a||Removed the in-game character limit of 16,369, allowing access to the full 32,767 characters.|
|14w27a||Added CommandStats NBT tag.|
|1.8.6||Dispensers no longer place command blocks.|
|1.9||15w33a||Character limit is now 32,500 instead of 32,767|
|15w34a||Added Chain Command Block and Repeating Command Block.|
|Added block facing.|
|Updated block textures.|
|15w34b||Added Conditional mode.|
|Added tab completion support.|
|15w35a||Updated texture of all three command blocks|
|Added Always active and needs redstone options. Added |
|When set to conditional, the back of the arrow texture is curved.|
|15w36a||Players unable to use commands such as |
|15w36d||Each command block type now appears with different colors on maps.|
|16w04a||Running "Searge" as the command in the command block without a preceding " |
|1.11||16w32a||The block entity ID is changed from |
|1.12||17w16a||Chains of command blocks no longer schedule their commands to be run in the next tick, they now execute all in the same tick they are read. This allows later blocks in a chain to be modified via earlier blocks, allowing techniques like branching and looping, all in the same tick.|
|pre6||Tab-completing command names in command blocks will no longer add a |
|1.0.5||build 1||Added all types of command blocks.|
The command block GUI in Pocket Edition
The second image released by Mojang showing the block giving glass to the player.
Issues relating to ⃢₀ₜCommand Block⃢₀ are maintained on the issue tracker. Report issues there.