Skip to content

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

Open
Term4 wants to merge 1 commit into
ViaVersion:masterfrom
Term4:entity_position_round_fix
Open

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

Conversation

@Term4

@Term4 Term4 commented Jul 8, 2026

Copy link
Copy Markdown
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).

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