Minecraft Blogs / Tutorial

1.13-1.15.1+ Map Creator Command Block Tips | Command Block Tutorial

  • 2,041 views, 2 today
  • 8
  • 3
  • 4
Brodie The Nerd avatar Brodie The Nerd
Level 42 : Master Nerd
With the release of Minecraft 1.13, command blocks have been completely overridden. At a glance, it seems absolutely terrible, with no control over what you can do. But that's not the case. I would love to go into detail of all of the new additions to command blocks but I don't have the time, energy, or even all the knowledge to actually do that. Instead, here are some useful tips for Map Creators who have been left stumped after 1.13, as well as a couple of things that haven't really changed but are still incredibly useful!

Summoning Entities With Custom Names

As of 1.13, giving entities a custom name through /summon has become slightly more complicated. There are two ways you can do this (new stuff will be red, and customizable parts will be green).

1.Quick and easy way with less control

/summon [entity] [​x] [​y] [​z] {CustomName:"\"NAME\""}
Where "entity" is the entity you want to spawn, "X","Y" and "Z" are the x,y and z coordinates respectively, and "NAME" is the name you want to give the entity

Example: /summon minecraft:pig ~ ~1 ~ {CustomName:"\"Kung Fu Pig\""}
This will summon a pig with named "Kung Fu Pig" as though it was named with a nametag

2.Longer, harder, but recommended way
/summon [​entity] [​x] [​y] [​z] {CustomName:"{\"text\":\"NAME\",\"bold\":\"true/false\",\"italic\":\"true/false\",\"underlined\":\"true/false\",\"strikethrough\":\"true/false\",\"obfuscated\":\"true/false\",\"color\":\"COLOR\"}"}

This might be hard to understand (I certainly didn't understand it at first) but it is actually simpler than you would think. To start off, look at this command that is a bit easier to read:

/summon minecraft:armor_stand ~ ~1 ~ {CustomName:"{text:Welcome to my world!,bold:true,italic:false,underlined:true,strikethrough:false,obfuscated:false,color:dark_purple}",CustomNameVisible:1,Invisible:1,Invulnerable:1,NoGravity:1}

This command is supposed to (but doesn't since it is missing a step) spawn an invisible armor stand that can't be removed without commands and does not fall with text above its head saying "Welcome to my world!". To start off, we can cull off all of the options that say "false", and end up with:

/summon minecraft:armor_stand ~ ~ ~ {CustomName:"{text:Welcome to my world!,bold:true,underlined:true,color:dark_purple}",CustomNameVisible:1,Invisible:1,Invulnerable:1,NoGravity:1}

Now that this command is simpler, we can change the command into something the game can understand. How do we do that? Simply start and finish each piece of text through the name customizers with a \", so that bold:true becomes \"bold\":\"true\"

/summon minecraft:armor_stand ~ ~ ~ {CustomName:"{\"text\":\"Welcome to my world!\",\"bold\":\"true\",\"underlined\":\"true\",\"color\":\"dark_purple\"}",CustomNameVisible:1,Invisible:1,Invulnerable:1,NoGravity:1}

And that command will successfully spawn an invisible armor stand with text above its head saying "Welcome to my world!"

Getting Items With Custom Names
This command will work similarly to summoning entities with custom names. If you want an explanation of how to type these yourself, just look at the explanation in Part 2 of "Summon Entities With Custom Names". Customizable options will be in green

/give [​selector] [​item]{display:{Name:"{\"text\":\"NAME\",\"bold\":\"true/false\",\"italic\":\"true/false\",\"underlined\":\"true/false\",\"strikethrough\":\"true/false\",\"obfuscated\":\"true/false\",\"color\":\"COLOR\"}"} count

/give @p minecraft:diamond_sword{display:{Name:"{\"text\":\"Tryhard Sword\",\"bold\":\"true\",\"italic\":\"false\",\"color\":\"blue\"}"}} 1

This command will give you a diamond sword renamed to say "Tryhard Sword".

Player Counters
This will require command blocks, but will allow the game to keep track of however many players there are, which can very very useful.

To start off, spawn in an invisible armor stand with the first format shown in "Summoning Entities With Custom Names" inside the spawn chunks. If you already have one within the spawn chunks, feel free to just use that. Make sure the armor stand does not have any spaces in its name. For our example, we'll have an armor stand named "Count".

Next, create a scoreboard objective and call it something you will remember. In this example, we will call it "playerCount".
If you don't know how to do this, here's my example:
/scoreboard objectives add playerCount dummy

Once you have your scoreboard objective and your armor stand ready, you now need to place down a command block and set it to "Repeat" and "Always Active". Inside the command block, type the following command, changing parts in green to suit your world.

/execute store result score @e[type=armor_stand,name=Count,limit=1] playerCount run effect give @a minecraft:night_vision 11 1 true

The command at the end you can set to whatever command you want to constantly run. I personally use effect give @a minecraft:night_vision 11 1 true because in all of my maps I don't like to make my maps look ugly by placing torches everywhere (my personal opinion).

Now, the player count will always be kept on the chosen armor stand's chosen scoreboard objective. If you would like to test this, simply type /execute if entity @e[​type=armor_stand,scores={playerCount=1}] run say hi. If you are the only player on your world, it should come up with you saying "hi" in the chat. If not, check your commands and try again.

Before going through my overly complicated way of Randomization, Nitrox Nova has come up with a far simpler solution here which does not have as much control over custom chances but it still a hella lot more simple than my solution, so feel free to check it out (but come back afterward xD)

To start off, you will need to create a scoreboard objective to keep the "Randomized" score. If you don't know how, follow my example:
/scoreboard objectives add Randomize dummy
This will create a scoreboard objective named "Randomize" that can't be changed without commands.

Next, place a command block, set it to "Repeating" and "Always Active", and type in the following command, changing the parts in green to suit you scoreboard objective.
/scoreboard players add @a Randomize 1
This will add one point to everyone's "Randomize" score 20 times per second.

After that, you will need to decide how many options you would like, and if you want one to be more likely than others. Start a chain from the repeating command block by placing a single chain command block. If, for example, you would like to have 3 outcomes which all have perfectly equal chances, you will need to type the following command into the chain command block:
/scoreboard players set @a[scores={Randomize=4}] Randomize 1
Just like before, change Randomize to fit the scoreboard objective you created. If you wanted 5 outcomes, you would have put 6, 15 would be 16, 1387 would be 1388, understand? Because, after this command block, we will be left with 3 options: 1, 2 or 3. If you want uneven chances, put any number higher than the number of options (the higher you make it, the more control you get over chance variation).

Once that is finished you will need to come up with a name for a tag that is unique in your world (meaning it is not used anywhere else). In this example, we will use ComplimentMe. Next, think of what you are going to randomize. In this example, we will be randomizing compliments in the chat. Place down another chain command block into the chain and type in the following command, changing the parts in green to suit your world and your purposes for the randomizer:
/tellraw @a[tag=ComplimentMe,scores={Randomize=1}] {"text":"You look wonderful today","bold":true}
Notice how almost the entire thing can be changed. That's because this is the part where you choose the outcomes for the randomizer. Place another chain command block and go again:
/tellraw @a[tag=ComplimentMe,scores={Randomize=2}] {"text":"Your eyes sparkle more than the stars in the night sky","bold":true}
One more outcome:
/tellraw @a[tag=ComplimentMe,scores={Randomize=3}] {"text":"Ew, why would I compliment YOU?","bold":true,"color":"dark_red"}
And so on...

But, what if you would like to make it more likely for one option to be picked than another. If so, expand the tab below. If not, feel free to continue.
Custom chances for the Randomizer
Following our example, lets say we want the final outcome (the only insult) to be more likely to occur than the other two (the compliments), with one being slightly more likely than the other. First of all, we would go back to our first chain command block (the second command block in the chain) and change the number which the score resets. In our example, we will change it to 17, so that the command will look like this:
/scoreboard players set @a[scores={Randomize=17}] Randomize 1
Next, we would change the other chain command blocks to edit their chances, and here's how we would do it to the first option in this example:
/tellraw @a[tag=ComplimentMe,scores={Randomize=1..5}] {"text":"You look wonderful today!","bold":true}
What this will do is display the message "You look wonderful today" to anyone who has the tag "Compliment me" and has any score from 1 to 5 on the Randomize scoreboard objective. See how this works now? If not, here's the next one:
/tellraw @a[tag=ComplimentMe,scores={Randomize=6..8}] {"text":"Your eyes sparkle more than the stars in the night sky","bold"=true}
This time, it will display the message "Your eyes sparkle more than the stars in the night sky" to anyone with the tag "ComplimentMe" and any score from 6 to 8 in the Randomize scoreboard objective. You probably understand how this works by now, but if not, here's the last one:
/tellraw @a[tag=ComplimentMe,scores={Randomize=9..16} {"text":"Ew, why would I compliment YOU?","bold":true,"color":"dark_red"}
This final one will show if the player's score is anywhere from 9 to 16, a much larger gap for the player to randomly get it and therefore a higher chance.

At the end of the command chain, place one more chain command block, and type in the following command, one again changing the parts in green to fit your world:
/tag @a remove ComplimentMe

Now that the entire command chain is completed, you need a way to chose when the randomizer will be used. Simply just place down a normal command block with a button and type the following command, changing green like usual:
/tag @p add ComplimentMe

Now, since you have used that tag throughout the other command blocks, when the tag is applied to you it will "randomize" the result. Because you would press the button at a random time, the result will become randomized, since the way this system randomizes results is through the random timing of the button press and not any fancy calculations. Of course, you wouldn't just place a command block with a button in your map, but this is the command that you might use to chose when the randomization happens. If you would like to make this universal, I would recommend doing the scoreboard objective crap on an invisible armor stand in the spawn chunks so that it does not rely on a player to do this on. There are honestly endless possibilities for a randomizer in anything really, which is why I don't know why I didn't put this one first!

Wireless buttons/levers
There will come many times when making maps in Minecraft when you are limited to where you can place buttons/levers because otherwise you will have command blocks or redstone lying out in the open which is not very aesthetically pleasing. We can fix this with wireless buttons/levers, which only requires two command blocks for each button.

Start off by placing down a command block, set it to "Repeating" and "Always Active", and type in the following command, changing the parts in green to match your desired coordinates:
/execute if block X1 Y1 Z1 minecraft:stone_button[​powered=false] run setblock X2 Y2 Z2 air
Set "X1", "Y1", and "Z1" to the coordinates of where your button/lever will be, "stone_button" to the id of the button/lever, and "X2", "Y2", and "Z2" to where you want the redstone to be outputted.. What this command does is remove the redstone block once the button/lever is unpowered.

Then, place a chain command block on the face the the repeating command block is facing and type in the following command, once again changing the text in green:
/execute if block X1 Y1 Z1 minecraft:stone_button[​powered=true] run setblock X2 Y2 Z2 redstone_block
Set everything to the same thing you set them to in the first command block. This command will detect when the button/lever is powered and put the redstone output (the redstone block) where you want the signal to be taken.

This doesn't just need to be a button or a lever. You can use this to detect when pressure plates are stepped on, when string is stepped on, when doors are opened (using "open=true" instead), when trapdoors are opened, or even when a specific type of block is placed. The benefit of using this rather than just detecting the block and outputting something is that this will only power the output once, and will keep it powered until the button (or other) is unpowered, whereas going directly from detection to the output will mean the output happens 20 times a second, which isn't ideal in most circumstances.

Something I would also STRONGLY recommend is to check out minecraft.tools. This website is extremely helpful and I haven't built a single map in the past few years without using these guys! This website will 100% make your maps look better as well as make it faster to do so! I absolutely love these guys and have even used them to check my commands in this very tutorial, so please feel free to check them out! I can't fully fathom how helpful this website is!

If there are any more tips you'd like to know that you think other map creators would also like to know, please leave those suggestions in the comments and I will try my best :D. Also, feel free to come back to this post in a bit, since there might be something new added by then!

Create an account or sign in to comment.

02/28/2019 1:56 am
Level 57 : Grandmaster Robot
Nitrox Nova
Nitrox Nova avatar
very nice, thank you for taking the time to share this! You may be interested in my random number generator using fish
edit: Thank you for the shout out :D
02/28/2019 5:26 am
Level 42 : Master Nerd
Brodie The Nerd
Brodie The Nerd avatar
That's a much simpler and better solution than mine xD I'll add a link to your Randomizer so you can get full cred :D

edit: All done! You are now included in the tutorial :D
EDIT edit: You're welcome
02/23/2019 11:01 pm
Level 48 : Master Narwhal
Spygron avatar
Amazing! Will definitely use for my map ;)
02/26/2019 4:10 am
Level 42 : Master Nerd
Brodie The Nerd
Brodie The Nerd avatar
Nice to know it helped :D
Planet Minecraft


© 2010 - 2022