Minecraft / Blogs

How to: Command Block!


What a Command Block looks like

Get Embed Codes

Level 28 : Expert Cake
This is a tutorial on: The Command Block! I will show you how to get it, as well as how to use it. Let's get started.

What is a Command Block?
A Command Block is a block used to enhance the player's gameplay. For example, you can make objects "talk" to the player. You can give things to a player, or even teleport them! All you have to do is activate it with a redstone current.

How do I get one?
Command Blocks are NOT found in the creative selection screen. To get it, you must type a /give command. To type the Command, first press "/" (Without Quotes) then type: "give [playername] 137" The finished command will look like this:
/give [playername] 137
/give is a command that gives blocks, items, or entitys to players. 137 is the Id of the Command Block.

How to I use it?
To use the Command Block, you type a command into it (Hence the name, Command Block). But you must be an Oped player in Creative Mode. But when you type the command, how does it know the playername? Well, instead of typing every username in the world, you use an @ substitute. There are 3 kinds:
@p: Do the command to the nearest player
@r: Do the command to a random player
@a: Do the command to every player.
Confused? That's okay. Here's an example. Lets say we want to give a random player a diamond (Getting any ideas? ;3). To do this, we type in a /give command. The Id of a diamond is 264. So the command is:
/give @r 264
When the Command block is activated, a random player gets a diamond :D

Okay so that was the /give command. But there is much much more! Here is some mini-tutorials on some other commands!

Here is a simple yet very useful command! Best used for adventure maps and such. As you can probably imagine, this command tells all the players in the world something. So this means you can't target with @p. Heres an example:
Let's say that you want a command to say "Hahaha! You can't defeat me!" menacingly. So first type /say, the command.
Then the message
/say Hahaha! You can't defeat me!
So when the command block is activated, it will say the message.
And here's a bonus: Remember how I said it can't target with the targeting commands(@p, @a, and @r)?
Well it can use them in a different way. Say you want it to say "[playername], you can't defeat me!" To do this use the command:
/say @p, you can't defeat me!
And it will use the closest persons name! Cool right?

Here's a tricky one for some. This one can teleport the targetted player(s) to a certain spot. To use this, you need to know
the coordinates of where you are teleporting the targets to. To find this out, first stand where you are transporting them. Then, press f3. (It's kind of above the "3" and "4" buttons on your keyboard) Look for where it says: x: number y: number z: number (Only 'number' is a real number). Write these down in the order of the x number, then the y number, and finally the z number. Now go to the command block and type the command.
Next, put the target.
/tp @p
Then the numbers in the order I showed before. For example, let's say the numerals are 100, 2, and -130.
/tp @p 100 2 -130
And you are done! When the block is activated, it will tele the target (nearest player) to the coordinates!

/gamemode and /gamerule
Now at least one of these you are probably already familiar with. But sure enough, command blocks can do both of these. Just for /gamemode substitute the playername for a target:
/gamemode @a 0
Now the other one, /gamerule, is something not everyone knows. It can change certain settings in your world. You can have a command block system set the world up (like for an adventure map) and prevent cheating. Use:
/gamerule [gamerule] [true/false]
Notice you have to define true or false. This is a fancy way of saying on or off.
And just for the lols, I'll include a list of gamerules for you guys at the bottom of this page, just in case you want to try them out.

Like the above commands, this edits settings of the world. You have have a command block system change the difficulty throughout your map. The usage of this is easy. Start with the command, followed by the difficulty you want.
/difficulty (0/1/2/3)
0 - Peaceful
1 - Easy
2 - Normal
3 - Hard

/effect and /enchant
Okay here's some cool ones for messing with and for custom maps. To use /effect, put the command in,
Then put the target. (For example, everyone)
/effect @a
And now enter the effect number. If you want strength, put 5.
/effect @a 5
Finally put the seconds you want it for. Shown here is a minute
/effect @a 5 60
And there you go! Super-buff people! At the bottom of this page will be a list of effect ids, in case you want to write them down.
Next we have /enchant. As always, just start with the command, and the target. (Let's say we will give a random person Sharpness V on whatever they are holding.)
/enchant @r
Sharpness's id is 16. And its level 5, so we put 5 after the 16.
/enchant @r 16 5
Tah-dah! Hopefully this person isn't holding an apple or something at the time we use this ;)
(And yes, enchantment ids at the bottom.)

And that concludes our tutorial for now. I will update daily with more commands! Have fun!

All those lists I mentioned are in here.
commandBlockOutputEnables/disables text output of command block commands to console
doDaylightCycleEnables/disables day/night cycle
doFireTickEnables/disables fire updates (no fire spread or dissipation)
doMobLootEnables/disables mob drops
doMobSpawningEnables/disables the spawning of mobs (with the exception of spawn eggs and mob spawners)
doTileDropsEnables/disables blocks dropping items when broken (includes TNT destroying blocks)
keepInventoryEnables/disables keeping inventory on death
logAdminCommandsEnables/disables the "<player> issued server command: /<command>" message shown in the server console
mobGriefingEnables/disables creepers, ghasts, and Wither blowing up blocks,
endermen picking up blocks, zombies breaking doors, and certain mobs
picking up weapons/armor
naturalRegenerationAllows/Disallows player to naturally regenerate health (if their hunger bar is high enough)
randomTickSpeedHow often a random tick occurs, such as plant growth, leaf decay, etc. Can be 0 to disable random updates.
showDeathMessagesEnables/disables chat messages when a player dies
(Yes this list is from the minecraft wiki. Credited down at the bottom of this blog

Effect Ids
1      Speed=Increases Speed

2      Slowness=Decreases Speed

3      Haste=Increases Mining Speed

4      Mining Fatigue=Decreases Mining Speed

5      Strength=Increases Player Strength

6      Instant Health=Gives Player Instant Health

7      Instant Damage=Gives Player Instant Damage

8      Jump Boost=Gives Player Jump Boost

9      Nausea=Makes Player's Screen Blurry

10    Regeneration=Regenerates Player's Health

11    Resistance=Makes Player Resistant to Damage

12    Fire Resistance=Makes Player Resistant To Fire

13    Water Breathing=Longer Breathing in Water

14    Invisibility=Makes Player Invisible

15    Blindness=Blinds Player

16    Night Vision=Makes Player see at Night

17    Hunger=Makes Player lose Hunger Faster

18    Weakness=Makes Player do less Damage

19    Poison=Makes Player lose Health Slowly (but not kill)

20    Wither=Similar to Poison, but can Kill and Turns Health Bar Black

Enchantment Ids

0 Protection

1 Fire Protection

2 Feather Falling

3 Blast Protection

4 Projectile Protection

5 Respiration

6 Aqua Affinity

7 Thorns

34 Unbreaking


16 Sharpness

17 Smite

18 Bane Of Arthropods

19 Knockback

20 Fire Aspect

21 Looting

34 Unbreaking


32 Efficiency

33 Silk Touch

34 Unbreaking

35 Fortune


48 Power

49 Punch

50 Flame

51 Infinity

Credit:The Minecraft Wiki for the gamerule list.

Version 2 : 05/04/2014 7:46:25 pm5/04/14

-Added more commands
-Fixed spelling errors
-More in depth

Comments : 7

Join us to post comments.

Show Comments

1 - 7 of 7

  • Shark5x
  • Level 28
  • Expert Cake
  • May 4, 2014, 2:43 pm
2786 views! I think this should go into more depth then. Hm...
  • watermelon24
  • Level 4
  • Apprentice Explorer
  • August 1, 2013, 11:32 am
how do i do the smite command for command block
  • spika101
  • Level 1
  • New Miner
  • June 8, 2013, 10:10 pm
I already know abut the base commands do u think u could find mme an awesome command???If so I will subscribe
  • TehBubble
  • Level 16
  • Journeyman Taco
  • March 18, 2013, 5:08 pm
Thanks! Here is a diamond!
btw you dont need the / in the command block
give @a 266 1

  • Shark5x
  • Level 28
  • Expert Cake
  • February 12, 2013, 2:32 pm
YEP! But you don't need a 1 at the end if you just want 1. :3

1 - 7 of 7

Show Comments




© planetminecraft.com