3
Datapack version is in the works! Stay tuned!
How to make a simple command escalator using /execute
It's very simple and takes only one execute command per direction!
Step 1: Build your escalator
You need to actually have an escalator before we can work on adding the command. I am using a dark palette with nether brick stairs for this tutorial.
Notice that the bottom nether brick block on the up escalator is actually an upside-down stair. This is optional but it allows minimal walking up as it will start working from the bottom of the stairs.
Step 2: Place the command block and paste the command
Paste the following command into a command block:
/execute as @a[x=0,y=0,z=0,dx=0,dy=0,dz=0] at @a[x=0,y=0,z=0,dx=0,dy=0,dz=0] if block ~ ~-1 ~ minecraft:nether_brick_stairs run tp @a[x=0,y=0,z=0,dx=0,dy=0,dz=0] ~ ~ ~
Your command block can go anywhere, but I recommend putting it under the middle of the escalator.
Make sure it is a repeating command block set to always active!
Now scroll to the end of the command where the teleport command is. Because this is the up escalator and it is facing east, we will change the destination coordinates from ~ ~ ~ to ~1 ~1 ~.
Step 3: Fill in your coordinates
Take the coordinates of the bottom block of the escalator. Note: not the lowest stair, the ground before it.
To find the coordinates of a block, use the F3 menu. In earlier versions, it is located on the left side of your screen. In newer versions, it's to the right.
In this case, the coordinates of the bottom block is 807, 81, 61. Every time (there are three times) the code has @a[x=0,y=0,z=0,dx=0,dy=0,dz=0], replace the X, Y, and Z coordinates with the ones of the bottom block. Your code should now look like this:
/execute as @a[x=807,y=81,z=61,dx=0,dy=0,dz=0] at @a[x=807,y=81,z=61,dx=0,dy=0,dz=0] if block ~ ~-1 ~ minecraft:nether_brick_stairs run tp @a[x=807,y=81,z=61,dx=0,dy=0,dz=0] ~1 ~1 ~
Now, time for the most confusing part: filling in dx, dy, and dz. Don't worry though, it sounds complicated but it's actually just some simple subtraction.Grab the top block of the escalator. Similar to the bottom block, get the coordinates of the landing after the stair blocks, not the top stair block itself, however also add one to the Y value so you get the air block above the landing instead of the landing block itself. In this case, the coordinates are 815, 89, 61.
Now, to get the D values, subtract the top coordinates from the bottom coordinates.
815 - 807 = 8
88 - 81 = 8
61 - 61 = 0
If you do everything correctly, the absolute Y value should match the absolute X or Z values, depending on the direction of the escalator.
Because the D value of Z is 0, we can just get rid of the dz values from the command.
Fill in your dx and dy values, and your finished command should now look like this:
/execute as @a[x=807,y=81,z=61,dx=8,dy=8] at @a[x=807,y=81,z=61,dx=8,dy=8] if block ~ ~-1 ~ minecraft:nether_brick_stairs run tp @a[x=807,y=81,z=61,dx=8,dy=8] ~1 ~1 ~
Step 4: Repeat for down escalator
Although you are "repeating" the same steps as before, all you need to do now is adjust the destination at the end of the command so it teleports you down in the opposite direction, as well as changing the X or Z (the Z in the case of this tutorial) to be the value of the down escalator.
Here is the adjusted command for the down escalator:
/execute as @a[x=807,y=81,z=59,dx=8,dy=8] at @a[x=807,y=81,z=59,dx=8,dy=8] if block ~ ~-1 ~ minecraft:nether_brick_stairs run tp @a[x=807,y=81,z=59,dx=8,dy=8] ~-1 ~-1 ~
Step 5: Enjoy!
Your escalator should now be fully functional! If it's not, all you likely did was only change one of the three @a[x=0,y=0,z=0,dx=0,dy=0,dz=0]'s, changed the incorrect value, forgot to make a value negative, or didn't set the command block to an always active repeating command block.
Tags |
5438758
6
Create an account or sign in to comment.