Skip to content
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

Rewrite #92

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
Draft

Rewrite #92

wants to merge 16 commits into from

Conversation

iGabyTM
Copy link
Member

@iGabyTM iGabyTM commented Aug 24, 2024

Changed

Added placeholders

@iGabyTM iGabyTM added the enhancement New feature or request label Aug 24, 2024
double rotation = player.getLocation().getYaw();

if (rotation < 0.0D) {
rotation += 360.0D;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unsure what values the getYaw method can return but considering that it can be lower than 0, I'd suggest we normalize the data here:

  • get absolute value
  • divide by 360 and get the remainder

This also prevents the multiple Math.abs calls below.

Copy link
Member Author

@iGabyTM iGabyTM Aug 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would Math.abs(rotation - 90) <= 45 become then?

A yaw of 0 or 360 represents the positive z direction.
A yaw of 180 represents the negative z direction.
A yaw of 90 represents the negative x direction.
A yaw of 270 represents the positive x direction.

org.bukkit.Location#getYaw()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would Math.abs(rotation - 90) <= 45 become then?

I am a bit confused why we actually need to do that? Can't we do the Absolute, % 360, and then check the ranges and convert them too cardinal directions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idk that's inherited code

@iGabyTM
Copy link
Member Author

iGabyTM commented Aug 26, 2024

By reading the version from MANIFEST we will have to update it in a single place, build.gradle
see 2822ceb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants