top of page

Magic Carpet

This tutorial I will show how to make the magic carpet v1. If you don't know the basics of command blocks go to this tutorial and come back. There is a button that will take you to back to this page don't worry.

To make a magic carpet you need to make a..you guessed it..a carpet. In this tutorial I will use the selector @a but if you want to make a tag then go ahead try it out. So back to making the magic carpet. We need someone else position and more than one person so we need the execute command. For the fill command we only need position so we will use at. So far it's looking like this execute at @a run. So what do we want to run? A fill command. Simple enough. execute at @a run fill ~-1 ~-1 ~-1 ~1 ~-1 ~1 red_wool. Two things you might notice here if you are already trying this out (if you're not don't worry the command will change later on so keep tight till the end). One is that it will destroy every block it goes through. Two is that it will leave a trail of red wool. So the first one is easy to fix just add "keep" to the end of your command. execute at @a run fill ~-1 ~-1 ~-1 ~1 ~-1 ~1 red_wool keep.

​

Now about the second one. We will need another command. It will need to happen before this command. I'll say why in a bit. So we will do a similar command. execute at @a run fill ~-2 ~-2 ~-2 ~2 ~1 ~2 air replace red_wool. I will explain this command now. It will replace all red wool with air in a bigger range because after you move it will be in the position you were in. The second y coordinate could be anything down to -1 if you really want but I think that if it's going to destroy red wool at least make it so you don't suffocate in it.

​

The reason that command is first is so that at the end of each game tick when we are moving there is red wool. Not air. Now you might think your magic carpet is complete. It's almost complete. We need a way to get down. We will do this by sneaking. We need to add a scoreboard objective for sneaking first scoreboard objectives add Sneak minecraft.custom:minecraft.sneak_time Sneak. The Sneak at the end is optional because you are not really going to display and if you are then the Sneak at the beginning is the same. Now this will record your sneak time. Almost what we want.

 

We will need another command to make it if you are sneaking or not. That command will be execute as @e[scores={Sneak=!0}] run scoreboard players set @s 0. That will set any score of at least 1 to 0 or any score of at most -1 to 0 or any score of null to 0. This command must be used at the end of the creation otherwise any commands requiring the sneak will not work it will always be 0. Now that we have our third command we must modify our second command. The new command will be execute at @a[scores={Sneak=!1..}] run [...]. I left out the second part as it didn't change. Notice how I didn't do sneak=0. This is because if its null I also want it to run. Now we are almost done.

 

We need to know what types of command blocks we need. The first will be repeating and either always active or needs redstone. The rest will be chain and always active. The reason I gave an option in the first is because needs redstone means you can deactivate the machine and in my command block world it's what I did. That is the magic carpet done. The next part of this tutorial is the super pig/super effect. I will be doing the second one this time to show how tags would end up working.

bottom of page