The Bug
Target selector arguments x_rotation
and y_rotation
don't fully respect ranges if only one end of the range is given.
How To Reproduce
Look into the sky, your x_rotation
is <0. Use this command:
/execute if entity @s[x_rotation=80..]
The feedback is Test passed, count:1
, but your x_rotation (the last number on the `Facing` line on the F3 screen, it changes when you look up and down) is <0, not >=80.
This command only fails if your x_rotation
is between 0 and 80.
This bug also exists for the y_rotation
argument, but doesn't exist for other times ranges are used.
Workaround
Define both ends of the range.
/execute if entity @s[x_rotation=80..90]
Linked issues
Comments 6
Relates to (fixing of) MC-121673.
Code analysis:
In EntitySelectionParser::createRotationPredicate, the default min/max value is 0.0/-1.0 if it is not specified in the range. Which doesn't make any sense at all, especially the default max value -1.0. They should be negative/positive infinities or just -180/180.
The first two callings of Mth.wrapDegrees there should also be removed. Since the bounds (WarppedMinMaxBounds) had been wrapped when parsing the entity selector (as indicated by its class name), it's not necessary to wrap them again.
Hey there!
Does MC-123441 happen to describe your issue?