Minecraft Blogs / Tutorial

Command Blocks

  • 665 views, 2 today
  • 9
  • 0
  • 5
SzaryPogromca's Avatar SzaryPogromca
Level 29 : Expert Architect
34
Command blocks programing

This blog will be dedicated to commandblocks. It's a kind of guide about commands and commandblocks. You will learn how to use and program commandblocks and structure blocks in at least minimum primary level. This text is divided into sections. If you want to find specific command use Ctr+F and write it. So let's start.

I'm a God? (/time)
If you are a builder or someone who played at least 3 minecraft days in creative, you should know this command. As the name says, /time is used to dealing with time. However, it can be used in different ways. With this command you can add or query hours and set the specific time of day.
You have only three options to set time. You can change it to day, night or specific hour. To do this you have to write /time set day, /time set night or /time set ....
Like you can see you can also set definite hours, but first you have to know that any 1000 ticks it's an hour. Minecraft like our real world have 24 hours, but they are shorter. One day last 20minutes. (time is exactly 72 times faster than normal). For example when we use /time set 9000, we have 15:00, and when we write /time set 18000, we have 0:00.
Day Night Clock
Now let's work on add and querry. It's not very complicated. We can add or querry every number of hours what we would like to. For example 72hours (72000) - what are 3 minecraft days.
For example: There is nine o'clock, we want ten o'clock. You can wait if you want, but why if you can do this with only one command? So you have to add 1 hour (|9-10|=1), so we have to write /time add 1000, because like I said earlier any minecraft hour is 1000 ticks, and we have ten o'clock. Easy? Easy. Let's move on farther. When we want to querry 1 hour you have to replece add with that, so you will have /time querry 1000. It's work on every hour. You can try this on your own server.
/setworldspawn
Hidden content here!

/gamemode
In minecraft we have four diffrent gamemodes. They are marked with numbers from 0 to 3, and they have other names:
0 - survival,
1 - creative,
2 - adventure,
3 - spectator.
Each of this gamemodes have this own settings. I will describe it later, but first :How to change gamemode? The easiest way to do this is /gamemode 0 (1/2/3) But it won't work if you are on survival or hardmode world, or when you are on multiplayer server and you don't have permission to do this.

/defaultgamemode


One command to rule them all (/gamerule)
You know that you can setup difficulty, music, sounds, video settings and more in game menu, but did you knew that there is some options in minecraft commands. If no, this section is for you.
Minecraft have about 18 rules, what we can change with commandblocks. You will learn names of them, normal setting and description of what they are.
Firstable we have to know how to use /gamerule command. It's easy, so it won't take much time. We have to write /gamerule {ruleName} true or /gamerule {rulename} false. That's all.
Let's sort them alphabetically.

commandBlockOutput (Default value - true) This rule is responsible for notify player about the command what commandblock is performing. So it says for example: teleported player to..., player found and other informations like this. If we change value to false this messages won't be showed.
disableElytraMovementCheck -
doDaylightCycle
(Deafult value - true) responsible for sky. It's control moon, sun and time. When it will be false the time will stop. Sun or moon (according to whitch one will be visible) stop in this place. We can change it position only with /time or with changing false to true.
doEntityDrops
(Deafult value - true)
doFireTick -
doMobLoot
(Deafult value - true) Like we know mobs have it own loot - items what they leave after they death. Now creepers, skeletons, zombies and other mobs, only mobs leave loot. When we setup this gamerule to false the mobs won't leave items.
doMobSpawning
(Deafult value - true) Mobs are spawning in the dark, even child know that. But we know how to stop they spawning. When we replace true to false the mobs won't be able to spawn naturally. But they will can still spawn from mobspawners and spawneggs, so you don't have to be afraid. This command affect on monsters and on animals too, so be carful when you use it.
doTileDrops -
keepInventory
(Deafult value - false) I'm thinking that this is the most popular command on adventure maps. It make that our inventory will keeped after our death. We only have to change it from false to true, and we will can jump into lava when we want and don't be afraid about inventory.
logAdminCommands -
mobGriefing
(Deafult value - true) This could be very useful for us. Some kinds of mobs have change look of our world by blow it - Creepers, Ghasts; move blocks - Endermans; pick up items - Zombie, Skeletons; destroy grass - sheeps; or harvest plants - Villagers. We can stop them by write this easy command: /gamerule mobGriefing false. After that mobs won't be able to do changes to our world. The Creepers will blow, but they won't destroy ground. The Ghasts will shoot proticles, but they won't demolish netherrack and other materials.
naturalRegeneration -
randomTickSpeed -
reducedDebugInfo -
sendCommandFeedback -
showDeathMessages -
(Deafult value - true)
spawnRadius -
(Deafult value - 10)
spectatorsGenerateChunks -


You or me (Selectors)
Firstly we should get to know how to select from many entites, one, what will perform our command. We have four basic selectors what we can see in commandblock. (@p,@r,@a,@e) Each of them have diffrent meaning. For example when we use @p after our command, it will be working on nearest player (from commandblock, if you wrote it in commandblock or us when you wrote this on chat, because the nearest person to you, it's... you). When we replece @p with @r that means, that command will choose random player. If we use @a command will select all players. The fun begins at @e. All what we see in minecraft it's an entity. The pig is an entity. Player is an entity. Flying arrow is an entity. The creeper is an entity. ArmorStand is an entity. The items and many other things are entities too. So when we use @e behind command it will affect on all this creatures, players and items, but we can modify that.

Not, me but you and he (Advenced Selectors)
When we instead of @e use @e[type=Zombie] in this case command will affect only at Zombies, but when we write @e[type=!Zombie] behind command it will affect at all entities without Zombie. We can replace "Zombie" with any other entity name - Creeper, Skeleton, ArmorStand, Item, Minecart, Boat, Arrow...
You can also use commands on definite entities, by using they names. To name entity in minecraft you have to use name tag on him, rename his spawn egg, or summon with custom name. So we have 3 Skeletons: Bill, Bob and Fred. We want to use command on Fred. So like before we write @e[type=Skeleton]. Now it select all 3 Skeletons, but we don't want that so we customize it, by add name={our entity name}, and we have: @e[type=Skeleton,name=Fred]. Remember to put comma after arguments.
Next we can work with certain range. For example we want to use /kill (when you don't know what is that, check lower) on Spiders within a radius of ten blocks.
So we have our command. /kill Next we have to select spiders. It's /kill @e[type=Spider]. Now add radius. /kill @e[type=Spider,r=10] And it's done. When you run this command you will kill all spiders in radius of 10 blocks. But what when we don't want to kill all spiders? We can modify our radius. Instead of r, we can write rm. /kill @e[type=Spider,rm=10] Rm means that the command will affect on spiders, which are more than 10 blocks from commandblock.
We know how to setup range of commands, next we can setup on how many entities will affect command. There are 13 Creepers and we want to kill only 3 of them. So we have our /kill command. Next we have to pinpoint what entity we want to kill. /kill @e[type=Creeper]. Now we can write how many mobs will be killed. /kill @e[type=Creeper,c=3]. This command will kill 3 creepers, like we wanted. ("c" mean count and it affect on nearest mobs, but we can change that with "-" before the number. /kill @e[type=Creeper,c=-3] This command will kill last 3 Creepers)
Let's rest for a moment from mobs and focus on that what we can do with players. We can select one player but for example @p, @r what we met before. We can also use this arguments, what we used earlier, with mobs, like c (number of players), name (player name) and type (type=Player), but we can use other arguments, whitch won't affect on other entities too. For example we can select all players, who are in gamemodes: survival, creative, adventure or spectator, by "m" agruments. So every gamemode have his own number from 0-3. (Survival - 0, Creative - 1, Adventure - 2, Spectator - 3) We want to select all players, who are in gamemode 2. So we have to use select players, by write @e[type=Player] and add argument. @e[type=Player,m=2] We selected all players, who are in adventure gamemode. Easy? Now let's select all players in creative. All what we have to do it's replace gamemode number. So instead of @e[type=Player,m=2], we will have @e[type=Player,m=1]. The command is the same with two others gamemodes.


/tp and ~
Hidden content here!

/kill
Hidden content here!

/give
Hidden content here!

/setblock
Hidden content here!

/fill
Hidden content here!

Blog will be updated soon.
Tags

4 Update Logs

Update #4 : by SzaryPogromca 08/22/2016 8:59:42 amAug 22nd, 2016

* add informations about new gamerules: mobGriefing, keepInventory, doDaylightCycle, domobspawning, doMobLoot...
LOAD MORE LOGS

Create an account or sign in to comment.

1
08/20/2016 7:52 pm
Level 15 : Journeyman Pokemon
Techno-5
Techno-5's Avatar
This is pretty well detailed, nice job! +1 diamond
1
08/21/2016 2:28 am
Level 29 : Expert Architect
SzaryPogromca
SzaryPogromca's Avatar
Thank you.
1
08/21/2016 1:59 pm
Level 15 : Journeyman Pokemon
Techno-5
Techno-5's Avatar
=)
1
08/21/2016 2:25 pm
Level 29 : Expert Architect
SzaryPogromca
SzaryPogromca's Avatar
There will be update soon, maybe tommorow. I hope you will enjoy from it. =D But to this time you can check my other projects.
1
08/22/2016 3:38 pm
Level 15 : Journeyman Pokemon
Techno-5
Techno-5's Avatar
Okay, cya! =]
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome