For the longest time the execute command in Java and Bedrock were wildly different. Java’s made more sense. But as of 1.19.10, Bedrock is getting parity with Java. So, if you want to learn Minecraft’s most important command in either version, then this video’s got you covered. To start, there are four types of execute sub commands. “Conditions” check to see if a certain condition in the world is met; for instance I’m using this one kind of like a sculk sensor. The “run” sub command allows you to run any other Minecraft command and when you combine It with conditionals, oh boy does magic happen. “Modify” sub commands allow you to change the frame of reference for where your command is executed. And finally the “store” type sub command allows you to take the result of a command and store it somewhere in your world. What the heck does that mean? Watch the video and find out! Today, we’re going to start with the condition type sub command because I have a feeling you’re going to be using this one the most. Every conditional type command starts the same way with “execute if”. What about “execute unless?” I… I will get to that it’s just not how I wanted to introduce the concept. The first conditional subcommand we are going to cover is “execute if block”. All it does Is it allows us to check if a certain block is of a certain type. Now, one place I use this in my adventure map is to repair this broken door here – the fuse just blew – so We placed glowstone down there. And the command for this is super simple all you have to do is say execute if block then you enter in the x y and z coordinate for that block and then the type of block that you’d like to check. Now, let’s say we wanted the opposite to be true meaning that when there is no bed the redstone signal is on. Now we could just use an inverter in there that works perfectly well or we could use the “unless” version of the sub command. So, coming into here we now Say “execute unless block” and this checks the opposite condition. And by the way “unless” works with all of the conditional sub commands we are about to cover. And moving on to our very next conditional sub command “execute if blocks”. It allows you To compare two different volumes of blocks to see if they are exactly equal block for block, and I used this trick in my roguelike dungeon to make a really interesting pattern puzzle that when players complete it they exit the room and get a little bit of loot. So you’re going to start with execute if blocks, and then you’re going to select one of the corners in your reference area. Then you’re going to head over to the exact opposite corner and select that as well. And now heading over to the area we want to reference we’re going To go to the lowest most northwest block – that’s why I have f3 on. And that is going to be the third variable in our command. Now we put that into our repeating command block, we notice that the redstone signal is low and that’s because these two sides are currently Different. So, if we match them up there our redstone signal goes on. “Execute if entity” is probably the conditional that I use the most, and we already have an example of that here. This one actually checks to see if a player is within three blocks. And I also use it to detect when players fly through the gates in my flight course. 41 seconds, woo! And the way this command works is super simple. You just say execute if entity and then you use a selector that you want to test against. “Execute if data” is a great way to check if items are in player inventories or in chests. I use this command for magic items on my server such as the Wand of Midnight, which when held fixes the time to midnight across the whole server. I put tother three examples for you here. The first is to check to see if there is an item in the player’s inventory, specifically a lightning rod. So, we say execute if data entity at the nearest player and this is the way to check if it’s in the players inventory, And so when I pick up this item there our redstone signal goes on. Moving on to our next example I want to see if a player’s actually holding the lightning rod. So the way to do That is to say selected item is the rod the rest of the command is the same. So when I select the lightning rod there our redstone signal goes high. Finally, if we want to check if the lightning rod is within the chest then all we do is we say execute if data block. We set the block where the chest is located we say items is lightning rod somewhere in the chest. It doesn’t matter where it is, and then all I do is drop this bad boy in, and there our signal goes on. “Execute if score” is a great way to reward players For doing well in your minigames. For instance, I keep track of the number of consecutive rooms that players have completed in my roguelike dungeon. And oh I got a decent pair of boots. Every five rooms players are granted some Kind of reward, and while scoreboards are technically out of the scope of this tutorial it’s kind of important to understand them because that’s how executive score works. So, whenever players complete one of the rooms we add one to the Vilethorn dungeon room count Scoreboard, and the way the command works for that is we say executive score that matches the number five. And we notice here that this isn’t on because I believe my score is thirty five right now, so if we change this over to thirty five there that goes it is now on. And you can also check to see if the score is greater than or less than which makes this demand super flexible. “Execute if predicate” is like if you execute the data execute score and executive entity and combine them all into a super efficient selector. Now if it’s super efficient why Don’t we just use it all the time? Well, that’s because it requires you to create a datapack. And here inside of a predicate that I made I check to scene if a player is in the overworld and between 610 and 8000 blocks from wherever this predicate is run. I have also linked A predicate generator in the description of this video in case you want to make your own. Now, in order to test the predicate we made in our data pack we run “execute if predicate” and then we drop in the name of the predicate we gave in our datapack, we hit done, and For some reason our redstone signal is low. In order to fix this, we need to get a little further into the tutorial. The run type sub command is about as simple as it gets. See, you type “execute run” and Then you follow that up with the Minecraft command that you want to run. Now you’re probably wondering what the heck the point of that is, well you can chain conditional and modify commands into run commands. So for instance, we can check to see if this block right here Is a gold block, and that test unsurprisingly has passed. Now if we precede our particle command with that check that’ll mean that particles are only going to show up if this block is a gold block. You can “and” together as many conditions as you want up to the character Limit. For instance, if I only wanted this water to flow when the block on the left was gold and the block on the right was red wool, I could make the command something like this. That’s how I figure out when to drop this giant gate when these two diamond blocks are destroyed. Yee! With the run command and command chaining mastered, we now need to talk about “modify” type sub commands. And honestly modified sub commands are super simple because they just changed the reference frame of the command meaning where it’s run in the world and who ran that command. A common problem I have is with NPC dialogue, you see when players approach The Knowledge Bearer he’s going to say “you are in a place of great knowledge” blah blah blah blah blah. The thing is about this pressure plate it’s a complete lie! This isn’t attached to anything. If we head down to the not as pretty depths of this tower, we see a command block monstrosity that actually controls all of the villager dialogue. And one way to solve my problem is to execute all of the commands down here to the position that they should run up above. And what this does is it dramatically simplifies the commands that follow them, and it makes things a heck of a lot cleaner for us. And that covers “execute positioned”. “Execute at” is nearly identical but a lot more powerful. A good example of this is in my Evil AI boss fight where this guy of course is trying to kill me. And the way that he does this in one of many ways is he creates these particle walls that when I touch them I am completely vaporized. There are these armor sands that are sliding along tracks Just beneath the stage, and what I’m doing is summoning particles at those armour stands using the “execute at” command. A simpler example is if we try to summon particles around this sheep. The way we do that is we type “execute at” and then we can select any entity within A distance of ten blocks, and by chaining on a particle command and clicking done we now have a beautiful glowing cheap underbelly. And since players are entities I also get this really cool particle effect under my feet. “Execute align” allows you to push your command to one of the edges of a block. For instance, if I type “align x”, the particles are now shown up on the x axis of the block, and you can Even specify all three axes to push the command to the corner of a block. I have never used this. “Execute rotated” allows you to change the rotational frame of reference. Channeling the Legend of Zelda here I kind of picture a little particle wisp that follows the player wherever they Go. Right now I have it so that the rotated parameter is always 180 degrees relative to where the player is facing, but if I set this to zero degrees then Navi can come and talk to me. “Hey listen!” “Execute facing” works nearly identically, except you can point to blocks or entities in your World. And the whole command looks something like this. “Execute anchor” allows you to run a command from a player’s eyes or from a player’s feet. I never use this. “Execute in” is the only way you can teleport players between dimensions, so when I say Execute in The End, teleport Avid to 0 90 0. We’re gonna head on over to The End dimension. And the last “modify” sub command is “execute as”. If you guys didn’t know I like to make cutscenes. “Olm, The Old One, he made me do it”. “Everyone get out of here now!” Well I didn’t say they were good cutscenes. And a common problem I have in these cutscenes is I want to nudge my actors a little bit in one direction or another. So, let’s say we have two sheep here and we want to nudge both of them to the left. We can do something Like “execute at” select the sheep, then run teleport at all the sheep, and looks something like that. But there’s a problem with this because when you run it the sheep consolidate to a single square. The way to fix that is we change “execute at” to “execute as”. We use @s. And we also changed the teleport to @s. Et Voila, we now have synchronized sheep. And with all of the “modify” sub commands mastered, we can now fix our predicate. The way we do that is we say “execute as” all players on the server, “positioned” at the spawn point, and Now our predicate works perfectly. And that means we are ready for “execute store”, which allows you to take the result of any of the commands we just talked about and store that into the NBT data of a block, boss bar, entity, score or storage. I… I don’t use this one. But for the integrity of this video we have to at least try one, so let’s make a bossbar. Just going to do some quick research here. Yes I see, so according to this book all I Have to do is summon in a boss and then create a boss bar. Then the magic comes in with the “execute store” command. We store the result into the custom boss bar that we made, and We store the entity’s health into that bossbar. And then all I should have to do is hit this button. This is the end of the line sheep. Baaa. that’s all you have to say to me after all these years. Baaa. Your reign of terror ends today! Good-bye old friend goodbye. WHYYY! That was so stupid. For the three of you who made it to the end of this video you should consider subscribing. And I highly recommend you check out my adventure map series. Also, if you want to learn more about the Execute Store command I’ll leave a link in the video And I’ll see you all next time bye bye! Video Information
This video, titled ‘The Execute Command [Minecraft 1.20 Java and Bedrock] Tutorial’, was uploaded by AvidMc on 2022-08-04 14:15:02. It has garnered 49910 views and 1354 likes. The duration of the video is 00:12:05 or 725 seconds.
The execute command for Minecraft Bedrock is getting parity with Java! The Minecraft execute command is essential for making datapacks and command block creations. This tutorial covers the subcommands such as execute as, execute at, execute if, execute unless, execute if predicate, and MUCH more! This tutorial is for both beginners and advanced command users.
► JOIN THIS CHANNEL FOR PERKS https://www.youtube.com/channel/UCvIdf6Xan1zf7xndKk8PsHw/join
►SUPPORT ME ON PATREON https://www.patreon.com/avidmc
►JOIN MY COMMUNITY DISCORD https://discord.gg/ARne4s2jkS
► PREDICATE GENERATOR https://misode.github.io/predicate/
► EXECUTE STORE COMMAND https://www.youtube.com/watch?v=vpZqPBEo-l0
►SUPPORT ME ON GLIMPSE https://www.glimpse.me/Avid
►SUPPORT ME ON PATREON https://www.patreon.com/avidmc
►JOIN MY COMMUNITY DISCORD https://discord.gg/ARne4s2jkS
►FOLLOW ME Reddit: https://www.reddit.com/user/McEMau5 Twitter: https://twitter.com/Avid_Yt Instagram: https://www.instagram.com/avidmc_yt/
0:00 The Most Important Command 0:21 The Four Sub Commands 1:01 Conditional Sub Commands 1:13 Execute If Block 1:40 Execute Unless 2:06 Execute if Blocks 2:58 Execute if Entity 3:21 Execute if Data 4:26 Execute if Score 5:16 Execute if Predicate 6:03 Run Sub Command 6:13 Chaining Execute Commands 7:02 Modify Sub Commands 7:15 Execute Positioned 7:58 Execute At 8:49 Execute Aligned 9:05 Execute Rotated 9:25 Execute Facing 9:32 Execute Anchored 9:38 Execute In 9:49 Execute As 10:45 Execute Store Sub Commands 11:03 Execute Store Result Bossbar
#minecraft #commandblock #tutorial