-
Notifications
You must be signed in to change notification settings - Fork 389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Renamed Direction.idHorizontal
and related methods
#4036
Conversation
Since |
Good spot, I hadn't noticed these. |
@@ -51,7 +51,7 @@ CLASS net/minecraft/class_2350 net/minecraft/util/math/Direction | |||
ARG 1 y | |||
ARG 2 z | |||
METHOD method_10148 getOffsetX ()I | |||
METHOD method_10150 fromRotation (D)Lnet/minecraft/class_2350; | |||
METHOD method_10150 fromHorizontalDegrees (D)Lnet/minecraft/class_2350; | |||
ARG 0 rotation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename the argument as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I believe angle
would suffice for this one in particular.
The base branch was changed.
🚀 Target branch has been updated to 24w46a |
The field
Direction.idHorizontal
doesn't make sense to interpret as an id, and it certainly doesn't correspond the id of any other direction. This field's value is very frequently multiplied by 90 to obtain an angle in degree, so it makes more sense to to see it as the number of horizontal quarter turns required to face this direction.asRotation()
does precisely that, so I renammed it togetPositiveHorizontalDegrees()
. It does almost the same job as the existinggetHorizontalDegrees(Direction)
, except that the later throws when fed a vertical direction, and returns angles wrapped between -90° and 180°. The "positive" counterpart returns angles wrapped between 0° and 270°.I renamed
getHorizontalDegrees
togetHorizontalDegreesOrThrow
to further emphasize the difference in behaviour.