Skip to content

GH-83 Fix invalid pitch normalization - #84

Open
Koboo wants to merge 3 commits into
AtlasEngineCa:masterfrom
Koboo:fix-gh-83
Open

Koboo wants to merge 3 commits into
AtlasEngineCa:masterfrom
Koboo:fix-gh-83

Conversation

@Koboo

@Koboo Koboo commented Sep 11, 2026

Copy link
Copy Markdown

This PR fixes my issue #83. There you can find a detailed error description.

The previous PR #29 which added pitch rotation add this normalization without any reason. As far as I can see is the pitch correct, but has no real advantage, apart from rejecting negative pitches. But according to Minestom/Minecraft a pitch is valid as long as it is in the range of -90°...90°.
Yaw is cyclic, so the normalization there is reasonable.

This PR deletes ("skips") the normalization of the pitch value to allow negative pitches. If the pitch exceeds the regular range, the constructor validation of Minestom takes take of us. 👍🏻

@Koboo

Koboo commented Sep 12, 2026

Copy link
Copy Markdown
Author

I also replaced several places where a deprecated Pos(Point) constructor was used and replaced it with the Point.asPos() method.

The constructor-approach is deprecated, because if the Point is already a Pos, the constructor would still create a new object. The new method just casts the Point to a Pos or creates a new Pos object with yaw and pitch zeroed.

Here is the code of asPos()
https://github.com/Minestom/Minestom/blob/16842f195400d0ff4adb1713cd113dc241b5ad17/src/main/java/net/minestom/server/coordinate/Point.java#L750

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant