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

fix: use correct chebyshev calculation in AreaMap #82

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

skerit
Copy link
Contributor

@skerit skerit commented Jan 12, 2025

The chebyshevDistance method in the AreaMap class seems to be wrong:

return Math.min(Math.abs(x0 - x1), Math.abs(z0 - z1));

The current implementation uses Math.min instead of Math.max, even though there are other places in the code where Math.max is used instead:

int chebyshevDistance = Math.max(Math.abs(watchedPos.getSectionX() - chunkPos.x), Math.abs(watchedPos.getSectionZ() - chunkPos.z));

If this was correct I'd love to hear why, if not here's the tiny PR to fix it :)

@ishland ishland changed the base branch from ver/1.21.3 to ver/1.21.4 January 13, 2025 07:28
@ishland ishland merged commit cd25690 into RelativityMC:ver/1.21.4 Jan 13, 2025
1 check passed
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.

2 participants