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

Rotation NBT has inconsistent wrapping

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • Minecraft 17w45b, Minecraft 17w50a, Minecraft 18w05a, Minecraft 18w11a, Minecraft 1.13, Minecraft 1.13.1-pre1, Minecraft 1.13.1-pre2, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 18w45a, Minecraft 19w07a, Minecraft 19w08b, 1.15.2, 20w21a, 1.16.4, 1.19.2
    • None
    • Windows 10, Bundled runtime (jre-x64\1.8.0_25)
    • Community Consensus
    • Commands
    • Low
    • Platform

      Assuming a scoreboard objective rotation with type dummy, if the command execute as @a at @s store result score @s rotation run data get entity @s Rotation[0] is ran in an Always Active repeating command block, it is expected that the Vertical Rotation of each player will be set to their rotation score. This does occur, but it is inconsistent, ranging from -360 to 359

      I believe this happens due to Rotation NBT not actually capping it's value, instead the value being given to rotation is the result of Rotation % 360 where % is modulus and Rotation >= 0. This isn't the worst thing, but the issue arises when Rotation NBT is negative and rotation then is given the value of Rotation % -360. Rotation NBT seems to not have a cap (and is inconsistent when being translated to rotation because if you continually rotate clockwise (angle is increasing), rotation will loop from 0 to 359. If you rotate from 0 to 720 (two full rotations), it then takes 2 rotations back (720 to 0) to begin getting a negative rotation score.

            Unassigned Unassigned
            TheAfroOfDoom TheAfroOfDoom
            Votes:
            16 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              CHK: