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
Run:
/scoreboard objectives add facing dummy /scoreboard objectives setdisplay sidebar facing /scoreboard players add @s facing 0
Face at: (Towards positive Z) (14.0 / 0.3) (
/tp @s ~ ~ ~ 14.0 0.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
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.
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
First execute all these commands:
/scoreboard objectives add facing dummy /scoreboard objectives setdisplay sidebar facing /scoreboard players add @s facing 0
Now try to face at; (Towards positive Z) (14.0 / 0.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.
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.
/tp @s ~ ~ ~ 14.0 0
/execute if entity @s[y_rotation=9..13]
Notice this doesn't match the player.
Confirmed for
1.8.4 but only for
*ry=14*
(however with rotation 14.1 it fails)