Minecraft Blogs / Tutorial

A Lesson In Command Blocks

  • 716 views, 2 today
  • 4
  • 2
NoahsterNP's Avatar NoahsterNP
Level 24 : Expert Engineer
21
So...I wanted to create a blog about commands because I am really good at command blocks so I wanted to go over some simple stuff and maybe even some complicated stuff. So here it is.

Spoiler - Getting started and /give
So first off to get a command block just type this in chat in one of your worlds: /give @p minecraft:command_block
this will give you a command block. this is where you will type all your commands, to activate it, just make a redstone signal go to it like putting a button on it. Anyway, lets talk about the /give command. Real simple. just type in /give, then the next thing to put in is the username. If you type in your username it will give the item to you. If you type in someone else's username it will give it to them. or you can type in @p, @r, @a, or @e. @p stands for nearest player. @r stands for random player. @a stands for all players, and @e stands for all entity's. An entity is basically anything moving in minecraft, such as a Zombie, Chicken, Minecart, or anything on the ground.
The next thing you want to type in is the item if you type in /give @p stone_sword, it will give the nearest person a stone sword, if you typed in /give @p stick, it will give nearest person a stick.
Spoiler - /tp and data tags.
/tp is teleporting you somewhere. You can teleport your self to another player by using: /tp <your username> <other users username> 
you can also use /tp to teleport to a location using this: /tp <your username> <X> <Y> <Z>
to find out what coordinates (X, Y, And Z) you want to go to click F3 and find your coordinates. This is easier done in version 1.7.
Data Tags.
data tags are kinda hard to explain. they basically are information to give more specific details about what you want. For example, if you wanted to give yourself a stone sword that has the name: Deadly Sword you would type in this: /give @p stone_sword 1 0 {display:{Name:"Deadly Sword"}}
I bolded the data tag. I will go over the, 1 0, and the display, and name in the next section. Just know that data tags always enclosed in curly brackets {}. 
Spoiler - Data Tags: display, Enchantments, Can break,  and Unbreaking.
so now I will go a little more in depth with data tags. Specifically for /give. But first, I want to go over why you have to type 1 0 before you type the data tag. So the 1 is how many items you want, if you typed in /give @p stick 2, it would give the nearest person 2 sticks. the 0 is something else that I dont want to go over right now. Just always put 0 there. 
More Data Tags
Display
So as I said before Data tags are like more information and details about the item. So lets first go over display.
Display is used to show something about the sword. Like in the previous example I used display to give a name of an item: {display:{Name""}}. just type in the quotations and thats what name will be on the item. Another thing you can use the display tag for is lore. If you dont know what a lore, its basically just the text that it under the sword when you scroll on it. To change the lore of an item you simply type in : /give @p stone_sword 1 0 {display:{lore:"This is Lore"}} There are more display tags than lore and name but thats just what I wanted to go over. 
Enchantments
Another data tag is {ench} and that can be used to enchant an item. It can be used like this: /give @p stone_sword 1 0 {ench:[{id:16,lvl:1}]} Woah, thats a mouthfull. lets go over them one by one. The id is what the enchantment is. you can get a full list of them here: List of Ids. The lvl stands for what level enchantment you want, For example, if you wanted unbreaking 2 on you sword you would type in: /give @p stone_sword 1 0 {ench:[{id:34,lvl:2}]} the id:34 is unbreaking, and the lvl 2 means unbreaking II. But wait, there's more! you can even type in 2 enchantments! by doing this: /give @p stone_sword 1 0 {ench:[{id:34,lvl:2},{id:16,lvl:1}]} this will give you a stone sword with unbreaking 2 and sharpness 1 (sharpness id: 16). (note: you can type in lvl as high as you want, you can even have unbreaking 1000!)
Can Break
Can break is a data tag that makes it so that you can only break a certaint block. Heres an example: /give @p stone_pickaxe 1 0 {CanDestroy:[stone]} This data tag will make it so that the stone Pickaxe can only break stone. (please note this only works in adventure mode.) You can even make it so that a certaint item can only break 2 items by typing in this: /give @p stone_pickaxe 1 0 {CanDestroy:[stone],[coal_ore]} Try it out!
Unbreaking
Now I know you can basically make an item unbreakable by having an item have the enchantment unbreaking and putting it to a high level, but this wont make it truly unbreakable. To make it truly unbreakable you type in this really simple data tag: /give @p stone_sword 1 0 {Unbreakable:1} this will give you a really unbreakable stone sword. try it out. it works. 
Test
with all that you learned can you make a stone_pickaxe with the name: Miners pickaxe, and can you make it have Unbreaking II, and sharpness I, and have it so that it can only break stone, coal_ore, iron_ore, gold_ore, and diamond_ore, and have it truly Unbreakable? need a hint?
Spoiler - Hint
/give @p stone_pickaxe 1 0 {display:{Name:"Miners Pickaxe"},ench:[{id:34,lvl:2},{id:16,lvl:1}],CanDestroy:[stone],[coal_ore],[iron_ore],[gold_ore],[diamond_ore],Unbreakable:1}
Woo, thats a lot. 
Spoiler - /title and /tellraw
Lets introdue 2 new commands. /title and /tellraw. Lets go over /tellraw first
/tellraw
if you type in (/tellraw @a hi) it will tell everyone in chat hi. But tellraw is more complicated than that. If you wanted 2 words or more, you have to type in this data tag: tellraw @a {text:"Tellraw Chat!"} this data tag is very simple. its text, on the screen. thats all. But tellraw isnt that boring, lets get to the fun stuff. You can have Colored Chat in minecraft with tellraw. Just type this in: /tellraw @a {text:"Colored Chat!",color:red} that will make the chat color red. there is also blue, green ,purple, gold, dark red, darg green, dark blue, aqua and a lot more. Just try it out for yourself. And there is even more. You can have Bold chat, Italic chat, Under line chat, or strikethrough chat.  All you need to do is type in this: /tellraw @a {text:"Bold!",bold:true} And that will have bold chat. And thats not all. you can have bold chat, italic chat, underline chat, and have it the color red all at the same time! type in this: /tellraw @a {text:"WOO HOO!",color:red,bold:true,italic:true,underline:true} And there you go. 
/title
have you ever seen maps or screenshots or videos where there playing minecraft and there all of a sudden huge chat right in the middle of the screen? yeah, thats the /title command. It works similar to /tellraw, but let me give you an example: /title @a title {text:"Title!"}  The only difference is that before the data tag there is: title. this is basically just a sub category of  the title command. you can type in /title @a title or /title @a subtitle. subtitle would be the big words too, just under the big words. As I said, it is similar to the tellraw command. You can have it colored, bold, italic, and strikethrough as well, with the same data tags! /title @a title {text:"Same as tellraw",color:red,bold:true,italic:true,underline:true} and thats how you do it. 
Spoiler - Last command: /scoreboard
So here we go. /scoreboard is a command used to keep track of points, or your score. its used like this: /scoreboard objectives add Points playerkillcount wow. Thats a lot. but its really simple because they are all sub categories. for example, objectives is a sub category, it can either be objectives, player, or team. (Im not going to go over teams in this blog) add is a sub category. it could be lots of things. Points is just a name. playerkillCount is a sub category. it could be thousands of different things. So lets see what they all mean. First /scoreboard objectives add Points is just adding an objective to the game, called Points. /scorebaord objectives add Points playerkill count is just adding an objective to the game called points, and the objective is to kill players. So basically its keeping track of how many players each person has killed. But right now you cant view it. in order to see it you have to put: /scoreboard objectives setdisplay <sidebar, or list> Points If you choose to pick sidebar, it will keep track oh how many players each player has killed, and it will display it on the side of the screen. If you pick list then it will keep track of how many players each player has killed, and it will show it next to your name. And by that I mean if you click tab it will show how many players are on, and next to each players name will be a number, thats how many players that player has killed. Now you can do more /scoreboard objectives add  than just playeykillcount, you can do totalkillcount, which is how many mobs you have killed, deaths, which is how many times you have died, health, which is how much health you have, and Tons more that you would not fit in a single blog. Good luck exploring this command!
Spoiler - Some cool things you can do with commands
Now Im going to have a list of a bunch of really cool stuff you can do with commands, and the command itself. some of the commands I might have went over in this lesson, and some I might not have. Here you go!
Spoiler - Custom villager trades
Command: /summon Villager ~ ~2 ~ {Offers:{Recipies:[{maxUses:1,buy:{id:gold_ingot,Count:10},sell:{id:diamond_sword,Count:1,tag:{display:{Name:"The Moon Glower"},ench:[{id:16,lvl:10}],Unbreakable:1}}]}
This will create a villager with an offer of 10 gold ingots for a diamond sword named The Moon Glower with sharpness I and It being Unbreakable. 
Spoiler - How to summon Lightning
Command: /summon LightningBolt ~ ~ ~2
Spoiler - How to have a Herobrine, Notch, Mario, Or even Squid Head!
Commands:
/give @p skull 1 3 {SkullOwner:Mario}
/give @p skull 1 3 {SkullOwner:Herobrine}
/give @p skull 1 3 {SkullOwner:Notch}
/give @p skull 1 3 {SkullOwner:MHF_Squid}

Spoiler - How to have items with effects such asSpeed or Knockback Resistance.
Command (Speed): /give @p stone_sword 1 0 {AttributeModifiers:[{AttributeName:"generic.movementSpeed",Name:"generic.movementSpeed",Amount:0.5,Operation:1,UUIDMost:1,UUIDLeast:10}]}
Command (KnockbackResistance): /give @p stone_sword 1 0 {AttributeModifiers:[{AttributeName:"generic.knockbackResistance",Name:"generic.knockbackResistance",Amount:0.5,Operation:1,UUIDMost:1,UUIDLeast:10}]}

Hope You Enjoyed! If you have a diamond is Much aprreciated. ;)
Tags

Create an account or sign in to comment.

Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome