mojira.dev
MCPE-44104

/execute disregards dimension of target entity

The execute command disregards the dimension of the target, and only pays attention to the target's coordinates.

Example: The command

/execute Alice ~ ~ ~ tp Bob ~ ~ ~

should be equivalent to

/tp Bob Alice

If the players are in the same dimension, this works, but if they're in different dimensions (Alice is in the overworld, and Bob is in the Nether), then Bob will be teleported to Alice's x/y/z coordinates in his own dimension instead of Alice's.


This is an issue for me because I wanted to make a command block that teleports someone to a location in the nether or in the end. I wanted to do this by placing a named armor stand inside of a tickingarea in each of the worlds, and then I would be able to have a command block run a command like this to teleport a player to any location in another world:

/execute @e[type=armor_stand,name=Nether_tag] 0 0 0 tp @p 1234 60 2345

However, this currently just causes the player to be teleported to those coordinates within their own world.


Other possible solutions that don't work well or don't work:

Currently, I can teleport the player directly to an entity in another world:

/tp @p @e[type=armor_stand,name=Nether_tag]

This works, but it teleports them directly on top of the armor stand (I don't want them to be able to destroy it and break the command from working again, or see the armor stand and name and realize how it works and risk them making their own same-named armor stand), and it only works if the armor stand is in a loaded chunk, or a ticking area, which there can only be so many of. If I have many places I might want to teleport players to, then they'd have to all be ticking areas.

The Java edition supports a lot of variations of the command, including this one:

/execute in the_end run tp @p 1234 60 2345

If that were ported over to work in the Bedrock edition too, then that would be extremely useful. (The original bug up above would also be nice to see fixed too regardless.) This would mean I wouldn't have to mess about with ticking areas at all, and there'd be no risk of a player breaking things by making an armor stand named the same thing as what my command looks for.

Related issues

Comments

USERcrosbyman64

Just Remember that you cannot use commands to teleport to a different dimension. If you tried to execute as armor stand in the nether and use teleport from the overworld or visa versa, a message in the command block will say "No Targets Matched Selector, " even with ticking areas set. I found this out the hard way when I realized my SuperTrident (Custom Made) would work in other dimensions...

In short: (The Execute Command only works in the one dimension at a time)

agentme

That's not the behavior I experienced. In my testing, the command `/execute Alice ~ ~ ~ tp Bob ~ ~ ~` would teleport Bob to Alice's x/y/z coordinates in Bob's own dimension even if Alice was in another dimension. Doing the same with an entity like `/execute @e[name=Nether_tag] ~ ~ ~ tp Bob ~ ~ ~` also worked the same way for me, as long as the entity was in a loaded chunk in any dimension. I was on 1.10.1 in the Windows 10 version in a world hosted by an Xbox one player, only going between the main world and the Nether, and entering the commands through chat rather than a block if that matters.

Also just to be clear, `/tp @p @e[name=Nether_tag]` did work for me if the entity was loaded, teleporting me from any dimension to the entity's dimension and coordinates. (The problem was that it would teleport me directly to the entity's coordinates, which is why I wanted to use /execute instead.)

USERcrosbyman64

I have no clue about any of this. I'm not a master at commands. whenever I specify an item or entity with a name, I always have to use quotes for it to work. Also I had to name the armor stand when I place it down even though I already named it, which is very frustrating.

I did notice that you typed "1234 60 2345" at "...] 0 0 0 tp @p 1234 60 2345." Of course it would teleport the player to the coordinates in your own dimension. It checks to see it the entity is at 0 0 0, then teleports the player to 1234 60 2345 in their own dimension...

You could try 2 command blocks, that way it should teleport the player into the Nether (or whatever dimension you are using)

Command 1
"/execute @e[type=armor_stand,name=Nether_tag] 0 0 0 tp @p @e[type=armor_stand,name=Nether_tag]"

Command 2 (activated after first command is successful)
"/execute @e[type=armor_stand,name=Nether_tag] 0 0 0 tp @p 1234 60 2345"

Of course you'll need a way to kill the armor stand so it doesn't keep the player from moving or glitching

If this doesn't work, then I don't know what to tell you...

agentme

The /execute command is supposed to run a command as if a specific target entity ran the command. The position parameters to the /execute command (2nd-4th args) are executed relative the entity's location so that `~` works. Currently it disregards the target entity's dimension, which isn't useful behavior, and it is inconsistent with how the /execute command works in the Java edition. It would be tremendously more useful if it used the target entity's dimension, like the Java edition does. It seems like a simple oversight that the Bedrock edition's version of the /execute command disregards dimensions entirely.

In the Java edition, this command teleports the player to a named armor stand's location, including its dimension:

/execute at @e[type=minecraft:armor_stand,name=World_tag,limit=1] run tp PlayerName ~ ~ ~

The "~ ~ ~" could be replaced with specific coordinates like "100 110 120", and the player will be teleported to those coordinates, in the armor stand's dimension, not the player's.

This is the roughly equivalent command in the Bedrock edition:

/execute @e[type=armor_stand,name=World_tag] ~ ~ ~ tp PlayerName ~ ~ ~

However, this command in the Bedrock edition teleports the player to the coordinates in the player's own dimension, which isn't useful, and means there's no way in the Bedrock edition to teleport a player to arbitrary coordinates in another dimension.


>I did notice that you typed "1234 60 2345" at "...] 0 0 0 tp @p 1234 60 2345." Of course it would teleport the player to the coordinates in your own dimension. It checks to see it the entity is at 0 0 0, then teleports the player to 1234 60 2345 in their own dimension...

That's not what that command does. It executes the command as a specific target entity at its location, then adjusts the command's activation location to 0 0 0, and then runs "tp @p 1234 60 2345" as the target entity.

>You could try 2 command blocks[...]

The problem is that after the first command executes, the player is far away from the command block, and may no longer be the closest player to the command block, so the second command block may select a different player with @p.

USERcrosbyman64

Yeah I always forget about that. Try placing the second command in the Nether that only activates when you are in the armor stand. Of course if it was at 0 0 0 then it would cause the armor stand to fall anyways (not definitely). I personally use ~ ~ ~ when using the execute command so I would be able to place the armor stand anywhere (how is anyone going to place an armor stand at 0 0 0?)

Now if there was a way to keep any other players from teleporting into the nether when not intended to... If I wanted to teleport a specific player to a different location, I would use a tag (which means you'll need to add a tag to the player)
example: "...@p[tag=nether]"

A lot of things I make uses more than one command block (I have used at least 15 of them for something complex).

Question: If you went out of the nether, would it teleport you back, or you did you think that through?

Edit: Other than that I don't know what else to tell you. Me coming up with the perfect solution is as impossible as ice cold drinks catching on fire (doesn't make sense does it).

migrated

Request to reopen this, I am afraid that this exists once more in 1.16.221. I made a dummy armor stand in the nether, and tried to teleport a villager to it from the overworld, it only teleports them to the coordinates not the dimension. For players, however, it works.

migrated

After further testing, it is not the execute command, it is the teleport command. I will open a new issue later.

GoldenHelmet

@Inventor156: when I tried to teleport villagers across dimensions they despawned. Please comment on MCPE-127414 with the exact command you are running and the results, and then I can look into whether it should be tracked as part of that report or a separate issue.

agentme

(Unassigned)

307060, 320622

Confirmed

Windows

windows 10

1.14.2.51 Beta, 1.14.1 Hotfix, 1.10.1 (Windows 10 only), 1.10.0, 1.12.0, 1.14.30 Hotfix, 1.16.1

1.16.220, 1.16.220.50 Beta

Retrieved