Minecraft Command Block : Complete Code list and How to Use it 2020
Minecraft game is one of the best ways to introduce young generation the basics of coding. As a result, Java programming is right around the corner with Minecraft mods and Bukkit plugins.
That's why Minecraft uses a block to divert young generations mind towards programming.
What are Command Blocks in Minecraft?
Command blocks are elements in Minecraft that can execute console commands when powered. The only thing you need to trigger the Command Block is a Redstone. Command Blocks cannot be found on Survival Modes. Enable cheats to get a block in Minecraft.
Keep reading, As, I'll show you how you can activate and use command blocks in Minecraft easily. Also, you will get the complete list of codes as a bonus.
Also, check out our separate post on how to use Minecraft kill commands using a command block.
Minecraft Command Block codes
You can execute commands of a command block when activated by Redstone power. It always has permissions of level 2. Modify the command block using the Use Item control to open the command block GUI. The GUI will open only if you are in Creative Mode.
Here is a complete list of the Minecraft Command Block Codes:
Use of the Command
Change the Game mode
Specifies the game mode. In <mode> you have to enter survival, creative, or adventure using 0, 1, or 2.
Difficulty <new difficulty>
It sets the difficulty level of the game.
Change game mode for individual player
gamemode <mode> <player>
Changes the game mode of the specific mentioned player.
Instantly kills the mentioned target.
Third person chat statement
Displays a third person statement in the world chat if you use /username <text>.
Displays the derived world number
Tell <player><private message>
Delivers chat secretly to specific person only.
Tellraw <player> <rawjsonmessage>
Sends complex message to the mentioned player.
Changes the time duration. Set the value from 0 to 12000.
title <player> <title><raw json title>
Displays a large text to the target persons display screen.
title <player> <clear>
Title gets removed instantly.
Starts or stops the rain instantly.
weather<clear|rain|thunder> [duration in seconds]
Changes the weather condition of the map.
xp <amount> <player>
gives experience point to the mentioned player
Command blocks performs console commands and these console commands are the same commands entered in-game by a player. However, the commands are executed by the server itself. Selecting Always Active makes the command run continuously.
Whenever the command block is being activated, that command takes action which allows you to build fun toys, manage weather and also custom adventure maps.
With the help of a command block you can implement basic commands in Minecraft with ace. It is easy because basic commands require only a few words and numbers. You will get to understand about Command Blocks by seeing the list.
Why should I use Command Blocks in Minecraft?
Commands are used to modify the Minecraft game world in various ways. These Modifications aren’t possible by hand. When command blocks are used correctly, the commands give Minecraft its own sort of pseudo-programming language.
There are three different types of command blocks in Minecraft.
Impulse: This command Block run commands on the rising of Redstone current. This means that when the command blocks are powered by a Redstone, the block will run the command once and stop.
Repeat: This command block run multiple commands up to 20 times every tick (tick is like a frame) they are powered.
Chain: This command Block run the command in order one after the other in a single frame.
The button that says Unconditional stops the command block from checking if the previous block in the chain has executed successfully.
The button that Needs Redstone only runs the command if the command block is powered with a Redstone. The other option, Always Active stops the command block from checking if it is powered and just assumes it is.
All these types of block perform the same series of programming.
How to Obtain a Command Block
Command blocks aren’t the normal blocks that you can find in the inventory easily. These are special blocks. It is because of their world-bending abilities.
Well, it cannot be found in Survival mode. In fact, command blocks don’t even appear on the Block menu in Creative mode. Use the Curse of Vanishing to save your command block from others just as do in case of a Minecraft Blast Furnace.
Here are the steps to obtain a command block in Minecraft JAVA edition:
- Build a world that allows you to enable cheats. Cheats are enabled by default if you start your world in Creative Mode.
- Free some space in the inventory.
- Open the chat menu by pressing the T key.
- Type the command /give <your username> command_block [number] and press Enter.
For Minecraft JAVA edition, you have to perform the following steps to get a code block:
- Go to the server.properties file in your server’s config files.
- Change the line that says enable-command-block=false to enable-command-block=true
- Give yourself a Command Block by opening the chat box and entering /give [your username] minecraft:command_block
- Turn on Creative Mode by typing /gamemode c in your chat box.
Also, Go through our latest post on how to get spawn chunks in Minecraft.
How to Use a Command Block in Minecraft
After obtaining a command block, you can activate it using a Redstone. Just activate the Redstone device that is attached to the command block and you will have a programmed Command Block.
Here are the steps to activate and use command blocks in Minecraft:
1. Use a Redstone Device
By Redstone Devices I meant using a Lever, a Button or simply a Pressure plate.
- Search for a Redstone deep below the surface. Nearly 16 layers in the bottom of the map.
- Toggle the lever if the Redstone device is a lever. Push the button if the Redstone device is a button. Stand on the pressure plate if the Redstone device is a pressure plate.
NB: Redstone is the best to trigger a command block.
With this 3 ingredients you can easily activate a command block in Minecraft.
2. Use Minecraft @ Commands
You can use @e, @p, @a, and /execute commands for using the command blocks. For targeting all entities, use @e target command. Here is an example of using the @e target command: @e[type=Zombie,r=10].
You can also use a chain command like /execute @e[type=Villager] ~ ~ ~ /say Hey.
if you wanted to run /say as if a Villager was talking, you can set up the command like this. This command will send a message to everyone, from every villager.
If you want to combine two /execute commands then type /execute @a ~ ~ ~ /execute @e[type=Villager,c=1] ~ ~ ~ /tell @p Hey.
The first /execute of the command runs on every player, and the second one checks for exactly one Villager nearby and says Hey.
Frequently Asked Questions
Question: How to tell if Cheats are enabled in the existing world in Minecraft?
Answer: You can tell whether cheats are enabled in the existing world by simply finding your world on the Select World page. You will see that the third row of text contains the word Cheats.
Question: Are there any Undo Command in Minecraft?
Answer: No, there aren’t any undo commands in Minecraft.
Question: How can I Teleport using the Command Block in Minecraft?
Answer: Type the command /teleport @p ~3 ~5 ~19 on a command block. The values indicate the X, Y, Z coordinates where you want to be teleported.
Question: What commands can you use in a command block?
Answer: You can use @commands and /execute the command on a command block. This coding applies to JAVA edition and Bedrock edition creative mode.
Command Blocks are the easiest way to modify your Minecraft server.
Though Command block syntax are difficult to understand, with the help of my post you will be able to gasp the way to use Command blocks with ease.
There are a lot of Commands which you can use using the command Blocks. Try using them all for better experience.