Minecraft Blogs / Tutorial

[Discontinued] [C|T #5] Tick Tock - Clocks Rock!

  • 676 views, 1 today
  • 7
  • 2
  • 1
Bertiecrafter's Avatar Bertiecrafter
Retired Moderator
Level 70 : Legendary Engineer
775

This series is discontinued. Have a look at my new series about data packs (1.13+).


Hello,
if you didn't know yet, C|T stands for Command Tutorial.
In the tutorial series I will try to teach you all about commands and command blocks.

So in the past blogs I have talked about the commands themselves, but what about timing?
When you create a command block contraption, timing is crucial and that's why I want to teach you all about it.
The Pulse (Main Clock)

This is what drives your command blocks. Put it too slow and your contraption is not accurate, but going too fast will cause a lot of lag. Also, with the exception of the purple command block, a too fast clock might trigger the beginning of a chain, before the previous pulse has reached the end. This will cause your entire contraption to work in the wrong order and that could be a big problem for some projects. Try to pick a speed that is as fast as possible, with playable lag, but without creating any double pulses in your contraption. Of course, on special occasions you should do something different. E.g: When it benefits you greatly if you use a clock that pulses every second for a special adventure map. Having it run at 1 tick per second could make some calculations way easier.

How do you create the perfect pulse?

Sometimes, this can be a difficult question. Not all clocks are efficient on all intervals. All clocks, except for The Command Clock, have a picture of them in the gallery at the top of the page.

[Discontinued] [C|T #5] Tick Tock - Clocks Rock!
The Tick Clock: The purple command blocks will only activate the green chain command blocks that are attached to the side with the circle. It pulses 20 times a second. It pauses minecraft until it finished the chain, which normally isn't noticable. With really big chains, things will get laggy.

[Discontinued] [C|T #5] Tick Tock - Clocks Rock!
The Classic: This is a great, reliable and just amazing clock. It's best on 0.6-5 sec intervals. Don't use a single repeater with a 1 (redstone) tick delay, this is when the torch is in position 1 out of 4. This causes the torch to burn out. You can extend the chain of repeaters and redstone if you want to slow down the clock. Your output is the torch. Number of repeaters needed:
(Number of seconds * 10 - 2) / 8
Of course, 4.25 means 4 full repeaters and 1 repeater with the torch on position 1 out of 4.
And 2.5 means 2 full repeaters and 1 repeater with the torch on position 2 out of 4.

[Discontinued] [C|T #5] Tick Tock - Clocks Rock!
The Hopper Clock: This one is more suitable in places where you want a slower pulse. Make sure that the hoppers are feeding into each other. Your output is the redstone block. Whatever I tried, I couldn't figure out the timing for this clock. Only 2 items give exactly a 1 sec delay. So with around 5 stacks, I guess this clock is best with a 1-120 sec interval.

The Command Clock: With commands, you can create an objective that tracks the progress of one cycle. Once the score gets to 0, you can use /setblock to place a redstone block somewhere else. Make sure to set it back to the right delay (score) after that. Use one of the above clocks to count down on the score again. Repeat all of this when it hits 0 again. Of course, you set the score on an armor_stand or player, so you can detect it with @e[type=####,score_///////=0]. This one suits any time interval.

The Others: So you will all know about different clocks that aren't listed here, but that's because they are easier. The chance is big that they are likely to run out (the 2/4 repeaters in a circle) or burn out (the two torches on hyper-speed). Also the vertical hamburger construction with (with cmd - redstone block - cmd) is just as fast as the purple command block, but laggier. The ones listed are the most reliable and should satisfy your needs.

Getting the right order

There are three ways of putting down command blocks:
In series (chain command blocks): This is where you define the order of your creation. The first command triggered executes first, then the second, then third, etc. Wether you use the normal orange impulse command blocks or the hyper-speed purple ones, you can attach any green chain command block to the side with the circel to make it activate when the main one is activated. Of course, you can add chain command blocks to other chain command blocks as well. The entire chain happens in one tick and will mc pause until the chain is completed, usually you don't notice this. However, big chains can cause lag.

Make sure to set all chain command blocks to "Always Active" as they will only execute when the first command block gets a signal AND they are powered themselves. I would prefer this method over the second, because this one is less laggy.

In series (redstone repeaters): Same concept, but using repeaters in the to connect the command blocks together. Each repeater needs a block update when it gets powered and this causes lag. Also, a redstone tick comes after 1 gametick. Look at this contraption:

---------7------------8-------------9
---------4------------5-------------6
button-1-repeater-2-repeater-3

With all the command blocks in chains of 3 each. Now, if we press the button, the executive order would be: 147258369

However I would not recommend using repeaters, sometimes they can come in handy with getting just the right order if you combine this with the chains OR they can make the design of a contraption a bit easier. (Otherwise you have to guide the big chain around, like a snake).

In parallel: You use parallel to run the command blocks next to each other at the same time. You can also use this to create multiple chains of command blocks that run at the same time, because one big chain is too laggy to run at once.

- HOLD ON -

yes, you can run multiple at the same time, because one chain is too laggy to run at once. That's what I said and I realised it months after. What I mean is, you can run multiple little chains in each tick (1/20th of a second), the delay is so small that it appears to be at the same time. And yes, this can be less laggy than running all commands within that 1/20th of a second.

I am explaining this in the next paragraph as well.

- CONTINUE -

If you use the purple command blocks, all command blocks in the chain run one after the other, BUT in the same tick. This appears as running at the same time to us. Because a purple command block runs every tick, there is no difference in lag between a chain in parallel or in series. If you do want parallel, you need to simply place more purple command blocks, but this is usually not very useful. I only use it in big contraptions where it just gives a better layout, instead of where you link everything together.

If you use the repeaters and impulse command blocks, you can use parallel to allow for better destribution among ticks or just for general design purposes. You create command blocks in parallel here, by simply branching off the main clock with more repeaters, instead of adding to the end of the chain.

Once again, when I say "at the same time", I mean that it looks like that to us. There is no way of actually running something EXACTLY at the same time.
If you want all players on a location to be teleported and have a message display in chat (with e.g a minigame), you need to put both commands in series. Message first, then the tp command, otherwise the players aren't there anymore for the message. You can also put the two in parallel, but it's not exactly at the same time. Nobody knows what happens first and your contraption could be failing that way.



My Server: GIBI

Click the banner for more info!
Tags

Create an account or sign in to comment.

1
03/15/2017 6:07 pmhistory
Level 70 : Legendary Engineer
Bertiecrafter
Bertiecrafter's Avatar
Thank you Jahm, amazonbear12, pettyGamingHD, dreamCritting123, PixieMax and Vellaris for the diamonds!!! :D
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome