Skip to content

Fix locate command dist overflow/underflow#11956

Merged
kennytv merged 1 commit into
PaperMC:mainfrom
HaHaWTH:fix/locate-command-dist
Jan 12, 2025
Merged

Fix locate command dist overflow/underflow#11956
kennytv merged 1 commit into
PaperMC:mainfrom
HaHaWTH:fix/locate-command-dist

Conversation

@HaHaWTH
Copy link
Copy Markdown
Contributor

@HaHaWTH HaHaWTH commented Jan 12, 2025

This pull request fixes MC-177381, which causes distance of structure overflow/underflow during calculation.

Changes

Replace Mth.sqrt in LocateCommand with Math.hypot to prevent any overflow/underflow.

This can be reproduced in latest Paper build with seed -1064495411872206035, use /locate command to search for a stronghold at coordinate -2735 ~ 688484.

@HaHaWTH HaHaWTH requested a review from a team as a code owner January 12, 2025 16:22
Copy link
Copy Markdown
Member

@kennytv kennytv left a comment

Choose a reason for hiding this comment

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

Thanks!

@kennytv kennytv merged commit 86c6308 into PaperMC:main Jan 12, 2025
@kennytv kennytv added the type: bug Something doesn't work as it was intended to. label Jan 12, 2025
@HaHaWTH HaHaWTH deleted the fix/locate-command-dist branch January 4, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug Something doesn't work as it was intended to.

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

2 participants