0

I'm looking for a way to store a player's current location (probably in the scoreboard as separate X, Y and Z) and teleport the player to that location later. I'm not completely familiar with the execute command, but I think this should be possible with the store sub-command.

The methods I found online involved an intermediary entity, whose location is modified first, then the player is teleported to that entity, and finally the entity is killed so the identifier can be reused. The problem I have with this method is that the target location has to be loaded, which I cannot ensure.

I'm looking for as simple as possible a solution that I can put in my own data packs, not an external data pack. Can anyone provide me with the method and exact commands to achieve this?

3

2 Answers 2

0

You can do this with scoreboards but the solution is kind of long

First, setup the scoreboards with:

scoreboard objectives add xpos dummy

scoreboard objectives add ypos dummy

scoreboard objectives add zpos dummy

Then, at any time you can do:

execute as <your target player> run execute store result score @s xpos run data get entity @s Pos[0]

execute as <your target player> run execute store result score @s ypos run data get entity @s Pos[1]

execute as <your target player> run execute store result score @s zpos run data get entity @s Pos[2]

This saves your position as a score

Unfortunately, in order to teleport back to those coordinates non-manually, it takes a lot of complicated math functions, but here goes. I will paste the two I have and the Y part should be easy.

You will need the following four blocks of commands, for both x and z, and their positive and negative. The same thing should work for Y meaning you would only need one block of commands if you only plan to teleport to locations above y0, but a second is necessary for it to be compatible with the new negative areas. NOTE: I do not have the y value one made, but you should be able to make it reletively easily by changing the values.

But first:

execute as <target> store result score @s tpX run data get entity @s Pos[0]

execute as <target> store result score @s tpY run data get entity @s Pos[1]

execute as <target> store result score @s tpZ run data get entity @s Pos[2]

tp <target> 0 0 0

execute as @s[scores={tpX=..-1}] at @s run function minecraft:tpx_neg

execute as @s[scores={tpX=1..}] at @s run function minecraft:tpx_pos

execute as @s[scores={tpY=..-1}] at @s run function minecraft:tpy_neg

execute as @s[scores={tpY=1..}] at @s run function minecraft:tpy_pos

execute as @s[scores={tpZ=..-1}] at @s run function minecraft:tpz_neg

execute as @s[scores={tpZ=1..}] at @s run function minecraft:tpz_pos

tpx_neg

scoreboard players set @s tpConst -1
scoreboard players operation @s tpX *= @s tpConst

#Teleports the player 1 block if it needs, this is all just binary
scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-1 ~ ~

#Teleport two blocks, rides off the const of 2 before
scoreboard players operation @s tpVar = @s tpX
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-2 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 4
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-4 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 8
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-8 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 16
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-16 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 32
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-32 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 64
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-64 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 128
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-128 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 256
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-256 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 512
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-512 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 1024
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-1024 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 2048
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-2048 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 4096
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-4096 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 8192
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-8192 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 16384
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-16384 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 32768
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-32768 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 65536
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-65536 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 131072
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-131072 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 262144
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-262144 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 524288
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-524288 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 1048576
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-1048576 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 2097152
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-2097152 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 4194304
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-4194304 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 8388608
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-8388608 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 16777216
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-16777216 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 33554432
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-33554432 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 67108864
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-67108864 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 134217728
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-134217728 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 268435456
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-268435456 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 536870912
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-536870912 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 1073741824
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~-1073741824 ~ ~

scoreboard players set @s tpConst -1
scoreboard players operation @s tpX *= @s tpConst

tpx_pos

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~1 ~ ~

#Teleport two blocks, rides off the const of 2 before
scoreboard players operation @s tpVar = @s tpX
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~2 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 4
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~4 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 8
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~8 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 16
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~16 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 32
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~32 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 64
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~64 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 128
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~128 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 256
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~256 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 512
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~512 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 1024
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~1024 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 2048
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~2048 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 4096
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~4096 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 8192
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~8192 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 16384
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~16384 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 32768
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~32768 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 65536
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~65536 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 131072
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~131072 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 262144
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~262144 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 524288
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~524288 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 1048576
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~1048576 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 2097152
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~2097152 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 4194304
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~4194304 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 8388608
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~8388608 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 16777216
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~16777216 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 33554432
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~33554432 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 67108864
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~67108864 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 134217728
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~134217728 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 268435456
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~268435456 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 536870912
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~536870912 ~ ~

scoreboard players operation @s tpVar = @s tpX
scoreboard players set @s tpConst 1073741824
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~1073741824 ~ ~

CONTINUED IN PART 2 I RAN OUT OF SPACE

4
  • I wasn't expecting it to be a short solution. I would like to hear the rest as well, thanks.
    – HYBR1D
    Mar 11 at 2:32
  • So I originally found it online but anyways it requires the use of bits to round to the exact block. I think it would be easier to just send it to you. How should i do that? Email?
    – Aceplante
    Mar 11 at 6:50
  • I'm hesistant to just dump my email here. Doesn't arqade have some PM system?
    – HYBR1D
    Mar 11 at 16:21
  • 1
    The Stack Exchange network is supposed to be useful to future visitors, not just the original asker, thus any further details should not be sent by private message but instead added to this answer.
    – pppery
    Mar 11 at 18:09
0

Why do these keep getting downvoted. Fine, nevermind. PART 2

tpz_pos

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~1

#Teleport two blocks, rides off the const of 2 before
scoreboard players operation @s tpVar = @s tpZ
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~2

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 4
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~4

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 8
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~8

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 16
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~16

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 32
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~32

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 64
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~64

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 128
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~128

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 256
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~256

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 512
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~512

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 1024
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~1024

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 2048
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~2048

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 4096
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~4096

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 8192
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~8192

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 16384
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~16384

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 32768
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~32768

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 65536
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~65536

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 131072
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~131072

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 262144
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~262144

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 524288
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~524288

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 1048576
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~1048576

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 2097152
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~2097152

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 4194304
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~4194304

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 8388608
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~8388608

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 16777216
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~16777216

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 33554432
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~33554432

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 67108864
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~67108864

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 134217728
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~134217728

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 268435456
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~268435456

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 536870912
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~536870912

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 1073741824
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~1073741824

tpz_neg

scoreboard players set @s tpConst -1
scoreboard players operation @s tpZ *= @s tpConst

#Teleports the player 1 block if it needs, this is all just binary
scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-1

#Teleport two blocks, rides off the const of 2 before
scoreboard players operation @s tpVar = @s tpZ
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-2

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 4
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-4

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 8
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-8

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 16
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-16

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 32
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-32

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 64
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-64

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 128
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-128

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 256
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-256

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 512
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-512

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 1024
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-1024

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 2048
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-2048

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 4096
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-4096

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 8192
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-8192

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 16384
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-16384

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 32768
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-32768

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 65536
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-65536

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 131072
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-131072

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 262144
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-262144

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 524288
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-524288

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 1048576
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-1048576

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 2097152
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-2097152

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 4194304
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-4194304

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 8388608
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-8388608

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 16777216
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-16777216

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 33554432
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-33554432

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 67108864
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-67108864

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 134217728
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-134217728

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 268435456
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-268435456

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 536870912
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-536870912

scoreboard players operation @s tpVar = @s tpZ
scoreboard players set @s tpConst 1073741824
scoreboard players operation @s tpVar /= @s tpConst
scoreboard players set @s tpConst 2
scoreboard players operation @s tpVar %= @s tpConst
execute as @s[scores={tpVar=1}] at @s run tp @s ~ ~ ~-1073741824

scoreboard players set @s tpConst -1
scoreboard players operation @s tpZ *= @s tpConst

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .