At first glance, Minecraft command blocks seem complicated to use. Once you get to know them, however, they become a useful tool for creating adventure maps or managing multiplayer servers.
In this article, we’ll explain what a Minecraft command block is, show you how to make a Minecraft command block, and examine how to use Minecraft command blocks to make Minecraft even better.
What Is a Minecraft Command Block?
A Minecraft command block is a special redstone-powered block. Its main use is to perform pre-set console commands when a redstone charge activates it. When it receives a charge, it fires off the command loaded into it.
The main use for Minecraft command blocks is giving the player control over commands they could not otherwise use. That’s because command blocks have admin-level powers, so they can perform console commands for people without admin privileges. This means you can give players control over specific things without giving them power on your server.
This is great for performing menial tasks, such as changing the current gamemode. If the term “gamemode” draws a blank for you, be sure to read our beginner’s guide to Minecraft to learn what they are.
How Do You Get a Minecraft Command Block?
Because Minecraft command blocks are related to server and player management, they cannot be mined in the game world.
If you want to get a command block, you must have the right permissions to give yourself items. Then, open the chat by pressing the T key. The chat window doubles as the in-game console; start your message with a forward-slash (/) to turn a chat message into a command.
With the chat open, type “/give PLAYER_NAME minecraft:command_block”, where PLAYER_NAME is your name.
You may notice the game predicting what you’ll type as you enter characters. If the game guesses correctly, you can press the TAB key to enter the guess automatically.
Now that you have a command block in your possession, it’s time to put it to use.
How to Use Minecraft Command Block Commands
To use the block, right-click it as if it were a crafting table. You’ll see a lot of confusing buttons, but don’t worry about those right now. Let’s focus on getting the command block to perform a task when it receives a redstone charge.
Entering a Command
In the text entry box, enter the console command you want the block to perform. Unlike chat commands, you don’t need the forward-slash at the start—just enter the command without it.
If you enter a command that requires a username to complete (such as the “give” command), you’ll notice something odd happen. When it comes to the user argument, the autosuggest will mention a few cryptic-looking entries. All of these entries are an @ followed by a single letter. These are called target selectors and are very useful for commands that aren’t user-specific.
For example, if you want a command block that dispenses a diamond sword, you can use a target selector, so the closest player receives the sword. This is a much easier solution than making separate command blocks for “/give player_a minecraft:diamond_sword”, “/give player_b minecraft:diamond_sword”, etc.
Using Target Selectors
The target selectors available in command blocks are as follows:
- @a is for every player on the server. This is useful for performing a command on every single user without manually typing each of their names individually.
- @p is for the closest player to the block at that time. This command is best for performing an action on whoever activates the block.
- @r is for a random player on the server. You can use a “give” command with a @r argument for a lottery-based system, or attach it to a “kill” command for the Minecraft version of Russian Roulette.
- @e targets all entities on the server. All players are entities, but the category spans a lot further than that. Entities include everything that can move, either by themselves or via physics. This includes monsters, items, arrows, boats, minecarts, and even falling sand. As such, be careful with how you use this command.
Once you’ve typed out the command you want to perform, activate it using redstone. The easiest way is to put a lever or redstone torch next to it, but you can also use a redstone circuit to trigger it off of buttons or pressure pads.
Chaining Minecraft Command Blocks
If you take a closer look at the design of a Minecraft command block, you’ll see that it has an arrow pointing upward. Every time the command block fires, it sends a signal to activate the next command block in the direction of the arrow.
Because we’ve been experimenting with only one block, we haven’t put this feature to use yet. To chain commands together, place a block so that the first one is pointing directly at it and is also adjacent to it. Then, in the command block interface of the new block, click the “Impulse” button to change it to “Chain”.
Give the chain block a command to perform. Now, when you activate the first block, it should automatically trigger the second one to fire, too.
The Buttons on the Minecraft Command Block Interface
Now that we’ve gotten to grips with commands, it’s time to explore the other buttons we have on the command block interface. These buttons are:
- Impulse, Chain, and Repeat. This defines how the block handles its command. “Impulse” fires off once when it receives a signal. “Chain” fires when it receives the go-ahead from another command block. “Repeat” continually fires when it’s activated.
- Conditional and Unconditional. If the block is set to “Conditional,” it will only fire if the command block behind it successfully fires. Note that the block only cares if the one behind it triggers; it doesn’t care if it’s being chained into or not. A block set to “Unconditional” won’t care about if the block behind it successfully fired.
- Needs Redstone and Always Active. “Needs Redstone” means the block only fires if it has a redstone charge. “Always Active” means it’s always ready to fire. The latter setting is useful for chain command blocks because you don’t need to add them to the redstone circuit to use them. Just chain into them, and they’ll activate right away. If you turn on “Always On” for an impulse block, it’ll fire only the once. For repeat blocks, it’ll continuously fire off.
Getting the Most Out of Minecraft Command Blocks
Minecraft command blocks are a useful tool and aren’t nearly as complicated as they first appear. And now, thanks to this guide to Minecraft command blocks, you know how to make a command block, how to use a command block, and how to chain command blocks together.
If you’re interested in modifying your Minecraft game with commands, here’s how to create your own Minecraft mod.