Teleport to Scaled Coordinates?
I am working on a datapack and would like the give the end dimension a coordinate scale like the nether (so it can be used for fast travel).
So I set the coordinate scale to 16 in the json file and it works fine, except... now the ender dragon doesnt spawn.
So is there a workaround? I was thinking I could just teleport the player to 16 times whatever their current coordinates are in the end, but in order to do this I would have to save their coordinates as a scoreboard (which I know how to do), but I cant seem to make variables work in a /tp command.
To recap: I would like a command to tp a player to 16 times their current x/z coordinates. Is this possible?
Edit: it was possible but I needed to use someone's datapack to do it, and it's very complicated.
To do a raw teleport to another dimensions with scaled coordinates, we will do:
- Summon an armor_stand
- Store X with execute scaled to 16
- Store Y
- Store Zx16
- Tp player to armorstand but in the end
- Remove armorstand
And here are the command versions. You said you are making a datapack so you can make these commands a file and run execute as <player> run function <this function>
and it should work just fine.
As stated by the OP, the armor stand quickly goes to unloaded chunks. Here is the solution to it, use execute as armor_stand run function
, this why @s
will be the armor stand for the entire time, even when unloaded.
file_1:
execute in minecraft:overworld at @r run summon minecraft:armor_stand ~ ~ ~ {Tags:["scale"]}
tag @s add to_end
execute as @e[tag=scale,limit=1] at @s run function file_2
tag @s remove to_end
file_2:
execute store result entity @s Pos[0] double 16 run data get entity @a[limit=1,tag=to_end] Pos[0]
execute store result entity @s Pos[1] double 1 run data get entity @a[limit=1,tag=to_end] Pos[1]
execute store result entity @s Pos[2] double 16 run data get entity @a[limit=1,tag=to_end] Pos[2]
execute at @s in minecraft:the_end run tp @a[limit=1,tag=to_end] ~ ~ ~
kill @s
Tried at (1000, ~, 1000) and it worked.