mojira.dev
MC-152997

The dimension of @s is not updated when teleporting non-player entities

When running this function

execute at @s run setblock ~ ~ ~ green_concrete
execute at @s in the_nether run tp @s ~ ~ ~
tellraw @a ["Dimension: ",{"nbt":"Dimension","entity":"@s"}]
execute at @s run setblock ~ ~1 ~ red_concrete

using the following command from within the overworld:

/execute as @e[type=pig,distance=..3] run function dimensions:test

I'd expect to find a green concrete block in front of me and a red one in the nether. Instead, I see a stack of a green and red concrete block, even though the tellraw reports the pig being in dimension -1.

This does not happen, when a player is teleported instead of a pig: Then everything works as expected and a green block is placed in the overworld, and a red one in the nether.

Linked issues

Comments 9

confirmed in 1.16.2

confirmed in 20w45a

Confirmed in 20w49a

Confirmed in 21w03a

To switch dimensions, non-player entities are entirely recreated, but `@s` still targets the previous entity. (`@e` and the uuid select the new entity)

This may be able to be resolved by adding a Dimension nbt tag to entities like players have. This would mean the entity is not resummoned and instead is actually moved.

That doesn't resolve the problem at all. The issue here is that when you teleport `@s` to another dimension it causes `@s` to no longer point at the correct entity, being able to get the dimension from NBT would not do anything here, and setting from NBT will almost certainly result in desyncs between client and server

Confirmed in 1.18.2

J_Aetherwing

(Unassigned)

Confirmed

Platform

Normal

Commands

command

Minecraft 1.14.2 Pre-Release 4, Minecraft 1.14.3, 1.15.2, 1.16 Pre-release 4, 1.16.2, ..., 20w45a, 20w49a, 21w03a, 1.18.2, 23w33a

Retrieved