Command Block

151 Category: Minecraft Blocks

Discover a new guide for Command Block Minecraft Wiki. A command block is a block that can execute commands to make it more convenient for the player. Since it cannot be obtained or edited in Survival mode without cheating, it is mainly used on multiplayer servers, in Creative Worlds and in custom maps.

Command Block Wiki


The pulse command block is the default block type; it only executes once when activated.

The chain command block will execute each time it is activated.

The repeating command block will execute every game tick as long as it is active.

Command Block Minecraft Obtaining

In Java Version, Command Block Minecraft are available in the Ad Warehouse under the “Operator Utilities” tab, if the “Operator Items Tab” setting in the “Controls” Preferences tab is set to “ON” . On both the Java and Bedrock versions, they can be obtained using the select block control or by using various commands such as /give @s minecraft:command_block or /setblock ~ ~ ~ command_block.

  • Just like other blocks that can store NBT data, using the select + CTRL block copies commands and options inside the command block.
  • The command block is non-flammable and has the same explosion resistance as the original stone. Command blocks, structure blocks and puzzle blocks cannot be mined in Survival.
  • Command blocks can be placed by players other than the operator.

Command Block Minecraft Using

Command block Minecraft can execute commands when activated by redstone source. It always has a level 2 ‌[Java Version Only]/1 level ‌[Bedrock Version Only] permission, so it can be used to allow players who can’t use that command in general to use a specific commands (e.g. allowing anyone to get a specific item with /give without allowing people / to give themselves whatever they want).

The instruction block determines the chain of command blocks to trigger, and the blocks are checked to see if the command block in “Conditional” mode will execute.

To execute the command, in the Java Version, the command block that enables multiplayer in the server.properties file must be set to true (false by default); in Bedrock version, “Command Block Enabled” in preferences must be enabled.

Command Block Minecraft Revision

To enter commands or modify a command block, use the Use Items control on the command block to open the command block GUI (graphical user interface). The GUI only opens if the player is in Creative mode and has the appropriate permissions. That means, in single player, “Allow Cheats”‌[JE Only] or “Enable Cheats”‌[BE Only] in the options must be enabled. In multiplayer, Gui can only be opened by those operating in Creative mode, and the Java Edition operating license level in the server.properties file must be set to 2 or higher (default is 4).

In Java Edition to enter commands or modify command blocks, Enable-command-block in the server.properties file must be set to true (default is false).

In the Java Version, opening the GUI in single player pauses the game.

Console commands‌[JE only]/Enter commands‌[BE only]

  • Commands can be entered in the top text box. The text limit for commands in a command block is 32,500 characters, but the text pane can only display a fraction of this number at a time.
  • Commands in command blocks do not need to be prefixed with a forward slash (/) like in the chat window, but doing so will still work.
  • Press Tab ↹ to complete the words or cycle through the options.
  • In Bedrock Edition, below the console’s command text pane are some reminder tips on how to use the target selector.

Command Block Minecraft Previous output

The lower text pane displays the output message (success or failure) of the last executed command (initially it is empty‌[JE only] or ” – “‌[BE only]). Its text is not editable.

A button to the right of the Previous Output‌[JE only] text pane or to the left of “Previous Output”‌[BE only] specifies whether the final output is stored and displayed.

It is O‌[JE only]/enabled‌[BE only] when the output text should be cached and X‌[JE only]/disabled‌[BE only] when the output text should not be cached. For worlds with many command blocks, especially command blocks that run on fast clocks, not storing output text can reduce memory and storage requirements.

If the gamerule sendCommandFeedback is true (the default), the default is O‌[JE only]/enabled‌[BE only]. Otherwise the default is X‌[JE only]/disabled‌[BE

Command Block Minecraft Block type

  • Click the “Pulse/Sequence/Repeat”‌[JE only]/”Block Type”‌[BE only] button to change the command block type. The default state is “Pulse”, but non-default command blocks can be obtained and placed.
  • Command blocks also change color when changing the command block type:
  • The “Impulse” command block is orange. They execute once each time they are activated.
  • The “Chain” command block is green. They execute once each time they are enabled if they are already enabled.
  • The “Repeat” command block is purple. They execute their commands every single tick in the game (or more ‌[BE only]) as long as they are active.

Condition

  • Click the “Conditional/Unconditional” button‌[JE Only]/”Condition”‌[BE Only] to change the conditional behavior of the command block:
  • “Conditional”: A command block in conditional mode only executes its instruction when the block behind it is successfully executed (“Number of successes” is greater than 0).
  • “Unconditional” : The command block in unconditional mode will execute its command.
  • “Behind it” in the opposite sense of the direction the command block is facing, regardless of the direction of the chain or even where the chain is occurring.

Command Block Minecraft Red stones

  • Click the “Always Active/Need Redstone” button‌[JE only]/”Redstone”‌[BE only] to change the command block’s activation requirements:
  • “Need redstone” (default for pulse and repeat command blocks): Command blocks in the “Redstone needed” settings can only be activated with redstone.
  • “Always active” (default for chain command blocks): The command block is activated when set to
  • “Always active”. Then it always works even without redstone active.

Execute on first tick‌[BE Only]

Specifies whether the repeating command block executes its command as soon as it is activated. If it is disabled, will execute the first time after the delay from the time it was enabled.

Delay in Ticks‌[BE only]

  • For a pulse or sequence command block, specify the number of times the game is delayed before executing the command after it is triggered or activated.
  • For repeating command blocks, specify the number of times the game is delayed for re-execution.
  • Note that for pulsed or repeated instruction blocks, 0 and 1 behave the same; the game takes 0 as 1.
  • However, for chain command blocks, 0 and 1 are different.

Hover Notes‌[BE Only]

Specify the name of the command block, which is visible when you point to the block. It is also used for message commands. If the command block was named in the anvil prior to placement, that name is also used.

Finished

  • In Java Version, click the “Done” button or ↵ Enter to save the command and leave the command block GUI.
  • In Bedrock Edition, close the GUI to save commands and changes.

Cancel

Click the “Cancel” or Esc‌[JE only] button to leave the command block GUI without saving any changes.

Activated

  • Command blocks are redstone mechanics and can be activated by:
  • An adjacent active power component: e.g. lever, redstone block, daylight sensor, button, etc.
  • An adjacent powered block (e.g. a translucent block with an active redstone torch underneath it)
  • Powered redstone comparator or redstone repeater opposite mechanism component
  • Powered redstone dust is configured to point at the command block (or on it) or have no direction; the command block is not triggered by the adjacent powered redstone dust configured to face away from it.
  • The command block can also be activated by setting it to “Always Active” mode.
  • When activated, the command block will execute its command, depending on the block type:
  • The pulse instruction block executes its instruction once.
  • The chain command block does not execute its command until it is activated.
  • The command block repeats executing its command every one tick in the game (or more‌[BE only]) until it is no longer active.

Command Block Minecraft Executive

The pulse command block, when enabled, checks whether the command block behind it was executed successfully or not (if in conditional mode).

After a delay of 1 game tick (or more‌[BE only]), if the condition is met before the delay (if in “Conditional” mode), it will execute its command once and trigger activate the chain command block it is pointing to.

Repeat command block, when activated, after 1 game tick (always 1 no matter how many “Tick Delays”), will check if the command block behind it was executed successfully or not (if in conditional mode).

If the condition is met and if “Execute on first tick‌” is enabled in Bedrock Edition, it will execute its command once and trigger the chain command block it is pointing to.

If it remains enabled, it checks, executes, and reactivates the chain command block after 1 game tick (or more‌[BE only]).

When executing a command, it also updates the success count: If in “Conditional” mode, if the command block after it fails to execute successfully, it sets its success count to 0. If no, it will set it to the request’s success count.

Also:

When a pulse or repeat command block in “Needs redstone” mode has a command set or is copied by command to a powered location, the new command block only executes its command if it has not been activated by stone red. In Java Version it also needs a block update to execute its command.

When a pulse or repeat command block in “Always Active” mode has a command set or is copied by command to a powered location, the new command block only executes its command if it has not been activated by kick red.

When a pulse or sequence command block is set to “Repeat”, if it has been enabled, check if the command block behind it was executed successfully (if in conditional mode). After 1 game tick (always 1 no matter how many “Tickets Delay”), if the condition is met, it will execute its command once and trigger the chain command block it is running point to. It then checks, executes, and reactivates the chain command block after 1 game tick (or more ‌[BE only]).

Activate and chain

If any command block that has executed its command (whether successful or unsuccessful) encounters a chain command block, it will trigger the chain command block to attempt execution.

When a chain command block is activated,

If it has been enabled,

It checks if it’s in “Conditional” mode and the command block behind it hasn’t been executed successfully (Behind in the sense of the direction it’s heading, not in the sense of what block of code is concatenated with It),

If true, it will trigger another block of chain commands it is facing without executing the command.

If false, it will check if it has been done in this game. If false, it will execute the command and trigger another chain of command block it is facing. If true, it has no effect. That means the threaded execution cannot be passed to the block of code that was executed in that game (the loop executes only once).

If it is not already activated, it will trigger the chain command block it is facing to try to execute.

Chained command blocks execute concurrently in the same game, marked in the order they are chained.

In Bedrock Edition it is also possible to delay before executing the command if “Ticket Delay” is not zero:

When it is activated,

If it is already enabled, the chain command block checks if the command block behind it is executed successfully (if in conditional mode) it will delay.

After a delay, if the condition is met before the delay (if in “Conditional” mode), it will execute its instruction once and trigger the chain command block it is pointing to regardless of whether the condition is met or not.

If it is not already activated, it will fire (without delay) the chain command block it is facing to try to execute.

In Java Version it can execute multiple times in the same game if “UpdateLastExecution” is set to false.

In this case it doesn’t check if it is already executed in this game.

If the chain command block has been fired when it is activated, it also updates the number of successful times: If in “Conditional” mode, if the command block behind it fails to execute successfully, it sets the number of times its success to 0. Otherwise, it will set it to the command’s success count.

Output

When enabled, the command block can produce a variety of outputs:

Command Block Minecraft Success number

A command block can power a redstone comparator facing away from it (possibly separated by a block) with a specific signal strength for the number of hits. The number of successes is an integer between 0 and 2,147,483,647 (inclusive).

The signal strength always reflects the last command executed, even after the command block is disabled.

In Java Edition, the number of successes is usually 0 or 1, except for /function and /execute.

In Bedrock Edition, the number of successes is an integer related to the command (e.g. the number of players affected by the command, the number of blocks changed, the value returned by the command, etc.)

In Java Version, leaving the command block GUI by clicking “Done” or pressing ↵ Enter will reset the number of successes to zero, regardless of whether changes were made in the GUI. In Bedrock Edition, leaving the GUI with the changes resets the success count to 0.

Message

The output message describes the success or failure of the command being executed and can be written to multiple destinations:

Output first: The output message is always written to the “Pre output” text frame of the command block GUI.

Chat: Output messages are written to single-player chat text or broadcast to all other multiplayer activities, unless it is blocked with /gamerule commandBlockOutput false.

Some commands can write additional text to the chat as their normal function and will not be blocked (e.g. the /say command writes messages to all players chat), separate from output message.

Chat messages are usually prefaced with the player’s name (such as from the /me, /say, and /tell commands), use @ ‌[Java version only] / ! ‌[Bedrock version only] as the player name. If the command block was given a name in the anvil before placement, that name will be used instead. In Bedrock Edition it can also be modified in the GUI.

Log: The output message is logged in the multiplayer server log unless it is suppressed with /gamerule logAdminCommands false.

Note

Command blocks execute commands with OP level 2. The following commands cannot be used in command blocks: /ban, /banlist, /ban-ip, /debug, /deop, /kick‌[JE only], /op, /pardon, /pardon-ip, /publish, /reload‌[BE only], /save-all, /save-off, /save-on, /stop and /whitelist (i.e. /debug, /publish and all multiplayer -except/list commands only).

Easter sign

Main article: Easter Egg § Command block
Running “Searge” (case-insensitive) as a command in a command block without a “/” before it will set the previous output to “#itzlipofutzli”. Its number of successes is 1.

Piston interaction

Command blocks cannot be pushed by pistons.

Command Block MInecraft is one of the best blocks that MC Wiki has just updated to the Minecraft Blocks list

Tags