mojira.dev
MC-188069

Target selector arguments x_rotation and y_rotation don't fully respect ranges if only one end of the range is given

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

Hey there!

Does MC-123441 happen to describe your issue?

No, that's a different issue with a different target selector argument.

Confirmed for 1.17.1

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.

Confirmed in 1.20.6

Paint

(Unassigned)

Confirmed

Commands

commands, range, selector, x_rotation, y_rotation

1.16 Pre-release 2, 1.16 Pre-release 4, 1.16 Pre-release 5, 1.16 Pre-release 6, 1.16 Pre-release 8, ..., 21w11a, 21w15a, 1.17.1, 1.18 Release Candidate 3, 1.18.1

Retrieved