Skip to content
MC Command Generator

How to get a command block in Minecraft, and why it does nothing

GuideJava 1.13 → 26.3 · Bedrock5 min read5 commands

Type /give @p minecraft:command_block: command blocks only come from commands. If yours does nothing, check the command_blocks_work game rule and redstone.

You get a command block with a command: /give @p minecraft:command_block on Java, /give @p command_block on Bedrock. There is no crafting recipe. If the block then does nothing, the usual cause on current Java versions is a game rule, not your command.

#1Command block · JavaEpic

The basic (impulse) command block. Needs cheats on, or operator rights on a server.

give @p minecraft:command_block
Open in /give Java 26.3
#2Command block · BedrockRare

Same block, Bedrock spelling: no minecraft: prefix needed and the count is written out.

give @p command_block 1
Open in /give Bedrock 26.50+

The other three are repeating_command_block, chain_command_block and command_block_minecart. We checked all four IDs on a Java 26.3 server by putting each in an armor stand’s hand; the game named them Command Block, Repeating Command Block, Chain Command Block and Minecart with Command Block. Change the item in the /give generator to get the line for any of them.

Why does my command block do nothing?

Since Java 1.21.9, whether command blocks run at all is a game rule. It is command_blocks_work on 1.21.11 and later and commandBlocksEnabled on 1.21.9 and 1.21.10. We placed the same always-active block twice on 26.3, once with the rule on and once with it off, and read the block’s SuccessCount:

Server log · Java 26.3
  1. setblock 5 -60 5 minecraft:command_block{Command:"say on",auto:1b}
    Changed the block at 5, -60, 5
  2. data get block 5 -60 5 SuccessCount
    5, -60, 5 has the following block data: 1
  3. gamerule command_blocks_work false
    Game rule command_blocks_work is now set to false
  4. setblock 7 -60 5 minecraft:command_block{Command:"say off",auto:1b}
    Changed the block at 7, -60, 5
  5. data get block 7 -60 5 SuccessCount
    7, -60, 5 has the following block data: 0

With the rule off there is no error and no message. The block just sits there with a count of 0. Turning the rule back on did not wake it up either: the count was still 0 until we broke the block and placed it again, and then it ran at once.

#3Switch command blocks on (Java 1.21.11+)Epic

If this rule is false, every command block in the world is ignored.

gamerule command_blocks_work true
Open in /gamerule Java 26.3
The same rule, written by the /gamerule generator for each version.
VersionCommand
Java 1.21.11, 26.1 – 26.3gamerule command_blocks_work true
Java 1.21.9 – 1.21.10gamerule commandBlocksEnabled true
Java 1.21.8 and olderCommand blocks work does not exist in Java 1.21.8 — left out.

Each version refuses the other’s spelling with Incorrect argument for command; we got that from 26.3 for commandBlocksEnabled and from 1.21.10 for command_blocks_work.

#4Switch command blocks on (Java 1.21.9 – 1.21.10)Rare

The same rule under its first name.

gamerule commandBlocksEnabled true
Open in /gamerule Java 1.21.9 – 1.21.10

Servers before 1.21.9

Older servers have no such rule. There the switch is the line enable-command-block=true in server.properties (minecraft.wiki, server.properties), read when the server starts. Our 1.21.4 test server refused both rule names, had that line set to true, and its command blocks ran. We did not test it set to false.

It needs redstone, or Always Active

A command block placed by hand starts in Needs Redstone mode. Nothing happens until it gets a signal, or until you switch the button in its menu to Always Active (that is the auto:1b in our test blocks). We placed one without auto, read the count, then put a redstone block next to it:

Server log · Java 26.3
  1. setblock 13 -60 5 minecraft:command_block{Command:"say needs redstone"}
    Changed the block at 13, -60, 5
  2. data get block 13 -60 5 SuccessCount
    13, -60, 5 has the following block data: 0
  3. setblock 13 -60 6 minecraft:redstone_block
    Changed the block at 13, -60, 6
  4. data get block 13 -60 5 SuccessCount
    13, -60, 5 has the following block data: 1

Opening the menu needs Creative mode and operator rights (minecraft.wiki, Command Block: Usage); with no player on the server that is one thing we could not try.

Skip the menu: place the block with its command inside

/setblock can place a command block that already holds a command and is already active. This is the form we used for every test on this page; the /setblock generator takes the same data in its NBT field.

#5Place one that is already runningMythic

A repeating command block above you with the command inside and Always Active on. No redstone, no menu.

setblock ~ ~1 ~ minecraft:repeating_command_block{Command:"say hi",auto:1b}
Open in /setblock Java 26.3

A repeating block really does run every game tick. Ours added 1 to a scoreboard each time, and the score went from 87 to 114 between two reads a moment apart. A leading slash inside the block is fine too: {Command:"/say slash",auto:1b} ran with a success count of 1.

If the chat fills up with command block messages, /gamerule command_block_output false turns them off (commandBlockOutput on 1.21.10 and older). For what to put in the blocks, the parkour course guide builds a whole minigame out of them.

FAQ

What is the command to get a command block?

/give @p minecraft:command_block on Java and /give @p command_block on Bedrock. Cheats must be on, or you must be an operator on a server.

Can you craft a command block or find it in Creative?

No. There is no recipe, and it is not in the normal Creative tabs (minecraft.wiki, Command Block: Obtaining). A command is the way to get one.

Why is my command block not working?

On Java 1.21.11 and later check /gamerule command_blocks_work: with the rule set to false our test block never ran. Then check that the block is powered by redstone or set to Always Active.

What are the IDs of the other command blocks?

repeating_command_block, chain_command_block and command_block_minecart, next to the plain command_block. All four were accepted as item IDs on our Java 26.3 server.