/teleport without <targets> can change the entity's rotation
The Bug
/teleport commands without <targets> argument specified can change the executor's rotation in certain command context.
To Reproduce
/execute rotated 0 0 run tp @s ~ ~ ~
You are not moved at all.
/execute rotated 0 0 run tp @s ~ ~ ~ ~ ~
Your rotation is changed. This is definitely intended because /teleport command should resolve relative pos arguments by the current command context.
/execute rotated 0 0 run tp ~ ~ ~
Your rotation is changed.
Expected
Your rotation should not change because you didn't specify anything about your rotation in the /teleport command.
Code Analysis
yarn's mappings, 1.15.1, sorry.
When registering the /teleport <location: pos> command, there's a default argument DefaultPosArgument.zero() for the <rotation> argument, which makes
/teleport ~ ~ ~
equivalent to
/teleport @s ~ ~ ~ ~ ~
I suggest you replace it with null.
Thanks for t1546542 telling me this bug. I'm not sure whether this was reported before though, I couldn't find anything.
2020-01-10, 12:32 AM
2024-09-17, 11:01 AM
2024-09-17, 11:01 AM
4
4