Skip to content

use round instead of truncating (matches modern VecDeltaCodec + RelativeMoveUtil) - #707

Merged
florianreuth merged 1 commit into
ViaVersion:masterfrom
Term4:entity_position_round_fix
Jul 25, 2026
Merged

use round instead of truncating (matches modern VecDeltaCodec + RelativeMoveUtil)#707
florianreuth merged 1 commit into
ViaVersion:masterfrom
Term4:entity_position_round_fix

Conversation

@Term4

@Term4 Term4 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor
image

Round instead of truncating in DOUBLE_TO_INT_TIMES_32

DOUBLE_TO_INT_TIMES_32 encodes the coordinates for every absolute entity position packet using (int)(value * 32), which truncates toward zero so negative coordinates land 1/32 block closer to zero than they should. Switching to Math.round fixes that and matches the rest of the pipeline: RelativeMoveUtil already rounds the relative-move deltas, and modern MC's VecDeltaCodec does too (see ss of unobfuscated minecraft 26.1 source).

@Term4
Term4 force-pushed the entity_position_round_fix branch from 502b288 to 973477c Compare July 12, 2026 23:22

@florianreuth florianreuth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@florianreuth
florianreuth merged commit 77d9d91 into ViaVersion:master Jul 25, 2026
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