Skip to content

perf(resource-packs): cache converted packs by content - #430

Open
AlexProgrammerDE wants to merge 1 commit into
ViaVersionAddons:mainfrom
StackAnvil:stackanvil/north-star
Open

AlexProgrammerDE wants to merge 1 commit into
ViaVersionAddons:mainfrom
StackAnvil:stackanvil/north-star

Conversation

@AlexProgrammerDE

@AlexProgrammerDE AlexProgrammerDE commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

What this changes

Converting a resource-pack stack on every join repeats expensive ZIP work and can advertise stale output when the pack content changes. Cache conversions by the effective pack stack and content hash, and verify cached ZIPs before reuse.

Write converted packs and their index atomically, give identical content a stable advertised hash and ID, and make ZIP entry order deterministic. Encode ResourcePackClientResponse with the current varint pack-list count; the old 16-bit count breaks game-protocol downloads. Add focused cache, load-state, and packet-layout tests. Based on ViaBedrock PR #420.

This is the current north-star feature from StackAnvil's viabedrock patch stack. The PR branch contains this feature alone, based on upstream.

Review focus

Please check that a changed source pack cannot reuse an older conversion, and that reconnecting with unchanged packs avoids another conversion.

Testing

  • Run ./gradlew test checkstyleMain checkstyleTest on the feature-only checkout.
  • Join Bedrock Dedicated Server 1.26.51.1 with a resource pack, reconnect, and confirm the converted pack is reused.
  • Change the pack texture and version, then confirm a new conversion contains the changed bytes and the Java client loads it.
  • Join the same server with Fabulously Optimized after the cache checks.

The live joins used the full StackAnvil patch stack and a local ViaProxy build compatible with the current ViaBedrock API.

Converting a resource-pack stack on every join repeats expensive ZIP work and can advertise stale output when the pack content changes. Cache conversions by the effective pack stack and content hash, and verify cached ZIPs before reuse.

Write converted packs and their index atomically, give identical content a stable advertised hash and ID, and make ZIP entry order deterministic. Encode ResourcePackClientResponse with the current varint pack-list count; the old 16-bit count breaks game-protocol downloads. Add focused cache, load-state, and packet-layout tests. Based on ViaBedrock PR ViaVersionAddons#420.
@AlexProgrammerDE
AlexProgrammerDE marked this pull request as ready for review September 26, 2026 07:49
@AlexProgrammerDE
AlexProgrammerDE force-pushed the stackanvil/north-star branch 2 times, most recently from ea70eea to af37749 Compare September 26, 2026 10:58
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.

3 participants