Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-169660

/teleport without <targets> can change the entity's rotation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.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
    • Confirmed
    • Commands
    • Normal
    • Platform

      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.

            Unassigned Unassigned
            SPGoding [Mod] SPGoding
            Votes:
            4 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              CHK: