Minecraft Blogs / Tutorial

MEGATUTORIAL - command blocks! PART 1

  • 412 views, 2 today
  • 9
  • 8
  • 5
ronsiv8 avatar ronsiv8
Level 7 : Apprentice Miner
3
Welcome to the world of command blocks! they can be used for a LOT of different things. No expirence is needed! (Java edition)
EPISODE 1
The basics of the basics!
Get yourself a command block using /give @p command block
Now, right click it!
Lets look at this menu:
First tab is the command, which, is just the command (what did you think?).
Secend (left) is the command block TYPE. there are 3 different types:
Impulse: Run the command once.
Chain: Theres an arrow on the top of the command block. If the arrow points to a chain command block, when the command block runs, the chain will start triggering. Which basiclly means,

When the impulse command block runs, and its arrow points to the chain command block, than they both run. You can add unlimited command blocks to a chain. If your chain doesnt work, please check if you ticked "Always active" instead of "Needs redstone".
Repeat: As long as they have signal (Or if they dont need redstone) they run again and again, without stopping. If a chain command block is connected, it will run every time the repeating command blocks runs its command, so it basiclly becomes another repeat command block.
Reapet command blocks run in every game tick (20 game ticks = 1 secend)
Conditinal / unconditinal: If a command block is conditinal, It will only run if the command block before it has ran it's command. This is mostly used using the execute command (explianed later)
Congrats! you got through the first episode! Lets continue!
EPISODE 2
selectors!
What are selectors? They beg the question: WHO will be affected by the command? For example, give an item to WHO?
There are 4 types of selectors:
@a = all the players. If i give @a, all the players will recive an item.
@p = nearest player. If used by a command block, it will target the nearest player. If used by a player, the player himself is obviously the closest to him so it will trigger himself.
@s = The player who runs the command. Unless used by an execute, command blocks cannot use this selector most of the time because there is never a defined player in the commands (again, UNLESS you use an execute command)
@r = Target a random player.
Selectors are IMPORTANT! Renember em!

EPISODE 3
Scoreboards!
If werent for the execute command, scoreboards would be the most powerful command in the game!

You may think that scoreboards are only used for counting time or scores, but you would be VERY wrong!
Scoreboards can be used for ANYTHING; from counting time, to wireless timers to check if players are using an item!
Command syntax:
/scoreboard objectives/players add, list, modify(Objectives only), remove,setdisplay(Objectives only), enable(Players only),get(Players only),operation(Players only), reset(Players only), set(Players only). SELECTOR + TARGET OBJECTIVE.

Whew! big command. Don't worry, its... Quite easy.
So first, lets add an objective. /scoreboard objectives and use ADD to add an objective. give an objective name, we'll call this Used. and than... My god! a very beefy window has just been added to the mix. What this does is that is asks you, "What do you want to count for? for example, Player deaths? Or player kills? As you can see, there are a lot of options. For this example, lets add an example so when you right click on a carrot on a stick, it counts up. Why carrot on a stick? Its just a good way to count since all the other uses do something, so if you say for example use fireball, than youll fire a giant ball of fire, which is less than what we want.
So, our final command!
/scoreboard objectives add Used minecraft.used:minecraft.carrot_on_a_stick
Why are there so many minecrafts in the command? Good question. I don't get it too.
Now! Get ready! Get a carrot on a stick and RIGHT CLIC- oh wait. Nothing happened. Why? Well, our command IS working. It IS counting, we just cannot see it! so how do we? We put in the command:
/scoreboard objectives setdisplay sidebar Used
we SET our objective display to the scoreboard objective, used. and now it should all work! Get a carrot on a stick and click it, as your heart desires!
Another mention worthy scoreboard objective is the dummy. To create a dummy object, lets make a simple clock using command blocks only. We will need 2 scoreboard objectives. One of them is the objective that will count TICKS (renember! 20 ticks = a secend!) and the other will count SECENDS (IF the ticks score is 20 THAN add 1 to the secends objective.)
So, how do we do this?
Quick reminder, a game tick happenes every time a repeating command block does its command.
Try to do this yourself, and have these hints:
1. Dummy objectives only increase when you tell them to increase. They remain at 0 until you say a command that tells them to increase using a command.
2. That command is /scoreboard players add (selector) (objective) (number such as 1 or 2)
3. you must detect if score = 20, to do that use this command: /execute as @a[​scores={YOUROBJECTIVE=TARGETNUMBER}] run ANY COMMAND
4. Renember conditinal command blocks?






THE SOLUTION:
If you didnt make it, before you give up, heres the layout of the command blocks:
One repeat command block, pointing to a chain block, Pointing to a conditinal chain command block.
Okay, lets solve this!
First, were gonna want to have 2 scoreboard values:
Ticks for counting game ticks,
And Secends for counting secends.
Now, were gonna place a repeating command block thats has the command /scoreboard players add @a ticks 1
which adds 1 to ticks every secend.
than, add one more chain command block, make sure the repeating command block is pointing to the chain and also make sure that it is "Always on" so it works and doesnt need redstone. the command here will be
/execute as @a[​scores={ticks=20}] run scoreboard players add @a Secends 1
All well and good, but our command will run only once since the count will keep going and not add 1 secend each time but rather it will only happenes once.
So, add one more conditinal chain command block. Make sure its conditinal and is always active. In there type:
/scoreboard players set @a Ticks 0
And thats all! our system is working!
Alright everyone, i think that is enough for this part. Please, send me any questions!
Thanks for reading this quite beefy blog.
Tags

Create an account or sign in to comment.

1
05/03/2020 4:01 am
Level 7 : Apprentice Miner
ronsiv8
ronsiv8 avatar
Part 2 will come out today!
It will only be about the execute command.
2
05/01/2020 5:55 pm
Level 27 : Expert Enchanter
Culpeo
Culpeo avatar
I was just thinking about what a funky command block that is in the image. No arrows.
1
05/02/2020 3:23 am
Level 7 : Apprentice Miner
ronsiv8
ronsiv8 avatar
ikr. I just thought these look more.. say.. iconic?
1
05/02/2020 3:10 pm
Level 27 : Expert Enchanter
Culpeo
Culpeo avatar
AH, yes. Those 1.4 vibes.
2
05/03/2020 3:01 am
Level 7 : Apprentice Miner
ronsiv8
ronsiv8 avatar
yeesss
Planet Minecraft

Website

© 2010 - 2021
www.planetminecraft.com

Welcome