No way of moving players or entities between dimensions natively
altrisi opened this issue ยท 3 comments
Currently, if you want to move entities between dimensions, you have to fall back to run('execute in the_nether run tp ...')
. It would be nice to support it natively.
Ideas:
- An extra optional parameter to
modify(entity, 'pos')
- New
modify()
modifier to change dimension without affecting position. - Allowing
in_dimension
to influencemodify(entity, 'pos')
- A new function
Edit: I've been looking at it, and yes, it's not simple for non-players, since entities are recreated on the other side. But this should be possible (there's a kinda easy way to do it, but it has some side-effects and can fail).
for non-players is actually easy - since the vanilla way is to save to nbt -> remove here -> spawn there -> read from nbt. I woudn't try to afffect that. For players - its little more complex but could just follow what /tp command does.
I would suggest adding another 'modify' option to change the dimension with specified target location - since the usecase of keeping the coordinates is bad by definition (never happens in real game, there is always some adjustments).
maybe modify(e, 'teleport', dim, pos, angles?) to emphasize that the first thing to worry about is dimension.
Problem isn't emulating vanilla behavior, problem is changing the pointers of EntityValue
s referencing those, since modify
operations get the Entity
directly.
For players is extremely simple, they have a built-in teleport
method that supports both with and without world change, and manages everything needed.