Cache converted resource packs by effective stack and ZIP hash - #420
Closed
AlexProgrammerDE wants to merge 3 commits into
Closed
AlexProgrammerDE wants to merge 3 commits into
AlexProgrammerDE wants to merge 3 commits into
Conversation
Wait for the Bedrock pack stack before pushing a Java pack so server order controls asset overrides. Prepare and hash the exact converted ZIP before advertising it, allowing Java clients to reuse their cached copy. Key source caches by advertised content identity and decryption key, and converted caches by ordered source bytes and converter version. Honor disabled, memory, and disk cache modes; add regression tests for order, content changes, and stable ZIP output.
Merge the current main branch, including EditorConfig and Checkstyle rules. Preserve delayed pack conversion and cache identity behavior while updating the affected Java code to pass the new build checks.
Bring in the latest chunk completion and request scheduling changes while retaining the resource pack cache behavior. The merged code passes the full Gradle build.
4 tasks
AlexProgrammerDE
added a commit
to StackAnvil/ViaBedrock
that referenced
this pull request
Sep 26, 2026
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
added a commit
to StackAnvil/ViaBedrock
that referenced
this pull request
Sep 26, 2026
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.
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.
Description
Fixes #416. Supersedes #417.
Bedrock announces pack identities in
RESOURCE_PACKS_INFO, then sends the effective pack order inRESOURCE_PACK_STACK. The Java pack is now pushed only after the stack arrives and the Bedrock sources have loaded. Conversion uses that stack order, so pack overrides match the server's choice.The HTTP server prepares the converted ZIP before the Java push. The push advertises the SHA-1 of the exact ZIP it serves and a stable UUID derived from that SHA-1. A new URL token still restricts each connection's download, while an unchanged ZIP keeps the same hash and UUID for the Java client's cache.
Source pack caches use the advertised content ID and decryption key in addition to pack UUID and version. If Bedrock provides no content ID, the source is downloaded again rather than trusted by UUID and version alone. The converted cache keys on the ordered source bytes and ViaBedrock build version. Disk entries are checked against their SHA-1 before reuse;
pack-cachedisabled, memory, and disk modes apply to converted packs as well.ZIP entries are written in a stable path order. Stack-only packs cannot replace sources already loaded from the Info packet.
Testing
./gradlew buildLive Bedrock server and Java client behavior still needs verification. A Bedrock server that changes pack bytes while reusing a nonempty content ID can still make its own source cache stale, because the advertised metadata gives no way to detect that change without downloading it.