Mojira Archive
MC-169660

/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.

Fixed

[Mod] SPGoding

2020-01-10, 12:32 AM

2024-09-17, 11:01 AM

2024-09-17, 11:01 AM

4

4

Confirmed

Normal

Platform

Commands

/teleport, /tp

1.15.1 - 1.17.11.15.1, 1.15.2 Pre-Release 1, 1.15.2, 20w06a, 20w07a, 20w09a, 20w10a, 20w11a, 20w12a, 20w13a, 20w14a, 20w16a, 20w17a, 20w18a, 20w22a, 1.16 Pre-release 2, 1.16 Pre-release 3, 1.16 Pre-release 6, 1.16.2 Release Candidate 1, 1.16.3, 1.16.4, 20w45a, 21w03a, 1.17 Pre-release 2, 1.17.1

24w38a