mojira.dev
MC-80173

Player rotation detection missaligned

The bug

While I was working on player rotation detection, I noticed that when I used the command "/testfor @p[ry=13,rym=9]" While facing ry=14 (according to the F3 info "Facing: south (Towards positive Z) (14.0 / 0.3)") the player was detected, and should not have been.

How to reproduce

  1. Run:

    /scoreboard objectives add facing dummy
    /scoreboard objectives setdisplay sidebar facing
    /scoreboard players add @s facing 0
  2. Face at: (Towards positive Z) (14.0 / 0.3) (/tp @s ~ ~ ~ 14.0 0.3)

  3. Run:

    /execute at @a[y_rotation=13..9] run scoreboard players set @p facing 1

    → ❌ See how your score will change from 0 to 1.

Linked issues

Attachments

Comments 11

Confirmed for

  • 1.8.4 but only for *ry=14* (however with rotation 14.1 it fails)

When i use the command "/tp @p ~ ~ ~ 14 ~" then re test for the rotation of 13 it fails. I think the F3 display in my original problem was at something similar to 13.99999999, but displaying it as 14. Since the F3 display doesn't display the decimal past the tenths spot, it must round up or something.

On a side note I cannot use "/testfor @p[ry=13.9]" Nor does "/testfor @p[ry=13.9d]" and "/testfor @p[ry=13.9f]" I always forget which letter is used for this kind of number.

Well that might be the reason probably, so I guess this is invalid

It is not invalid as 13.999999999 =! 14 still.

1 more comments

Confirmed for 1.9

Can confirm for 1.12.1.

Confirmed for 1.13.1.

Since command updates, i'll leave a updated version, on how to reproduce. please edit this into the ticket or link my comment.

How to reproduce

  1. First execute all these commands:

    /scoreboard objectives add facing dummy
    /scoreboard objectives setdisplay sidebar facing
    /scoreboard players add @s facing 0
  1. Now try to face at; (Towards positive Z) (14.0 / 0.3)

  2. Run: /execute at @a[y_rotation=13..9] run scoreboard players set @p facing 1

  3. See how your score will change from 0 to 1.

Cannot reproduce in 1.15.1

Steps to reproduce were wrong causing the detection area to wrap around. The selector should use y_rotation=9..13 instead of y_rotation=13..9. Using these new steps I cannot reproduce anymore.

  1. /tp @s ~ ~ ~ 14.0 0

  2. /execute if entity @s[y_rotation=9..13]
    Notice this doesn't match the player.

Please check if that's still an issue for you in the latest 1.15.1 stable release

John Dame

(Unassigned)

Confirmed

(Unassigned)

Minecraft 1.8.4, Minecraft 1.9, Minecraft 16w35a, Minecraft 1.12.1, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 19w05a, Minecraft 19w06a, Minecraft 19w07a

Retrieved