Fix world border speed: varlong, not varint (regressed in 1.19)#1200
Open
atiweb wants to merge 1 commit into
Open
Fix world border speed: varlong, not varint (regressed in 1.19)#1200atiweb wants to merge 1 commit into
atiweb wants to merge 1 commit into
Conversation
ClientboundInitializeBorderPacket and ClientboundSetBorderLerpSizePacket encode the border lerp time as a VarLong in vanilla (long lerpTime, writeVarLong/readVarLong). minecraft-data had speed correct as varlong in 1.17-1.18.2, but it regressed to varint in 1.19 and was never fixed - wrong for every version from 1.19 to 1.21.11. VarInt and VarLong encode identically below 2^28 ms (~74h), so this only breaks on long (multi-day) border interpolations, where the multi-byte VarLong mis-parses as a VarInt. Verified readVarLong/writeVarLong against the Mojang server jars for 1.19.4 and 1.21.3-1.21.9. 1.19 and 1.19.2 also needed varlong re-declared as a native type (it had been dropped when the field regressed to varint and nothing else used it); later versions already declare it. proto.yml edited, protocol.json regenerated with npm run build.
atiweb
force-pushed
the
fix/world-border-speed-varlong
branch
from
June 18, 2026 04:25
300231e to
964d484
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
packet_initialize_world_borderandpacket_world_border_lerp_sizeboth define theirspeedfield (the border lerp time) asvarint. In the vanilla client/server it is a VarLong:This is a regression. minecraft-data had
speedcorrect asvarlongin 1.17–1.18.2, but it was changed tovarintin 1.19 and never corrected, so it has been wrong for every version from 1.19 through 1.21.11:speedvarlong✓varint✗Impact
A VarInt and a VarLong encode to identical bytes for values below 2^28 (~74h expressed in ms), which is why this seldom surfaces. But a long border interpolation — a slow multi-day border shrink (
/worldborder set <size> <seconds>with a large duration) — emits a VarLong that needs 5+ bytes, which a VarInt reader mis-parses (wrong value, then stream desync). These packets are clientbound, so it affects any consumer decoding them.Verification
readVarLong/writeVarLongconfirmed against the official Mojang server jars for 1.19.4 (where the regression begins) and 1.21.3 / 1.21.5 / 1.21.6 / 1.21.8 / 1.21.9; 1.17–1.18 already shipped the correctvarlong.Change
speed: varint→speed: varlongin both packets, for 1.19 → 1.21.11.proto.ymledited andprotocol.jsonregenerated withnpm run build(32 files, +64/−64; no other content touched).node compileProtocol.jsvalidate passes for all versions.