Fix deduplication of version-specific resource packs #117
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.
Summary
Resource packs are registered into a HashSet so ForcePack can quickly look them up per server. Until now, equality only considered the URL/hash-based UUID plus the server name. That makes two entries for the same ZIP indistinguishable, even if one is the default pack list and the other is a pack-format override. As soon as an override reuses a URL already declared in the fallback section, the override entry is discarded during registration, so filtering by pack_format never sees it.
Problem
Admins may reuse the same base packs across all versions and add extra ZIPs only for specific pack formats. Because the fallback and override entries shared URL+hash, the fallback copy was dropped while the “extra” ZIP survived. ForcePack therefore kept only the override-only entries and sent an incomplete set of packs to clients e.g., they received just the new ZIP without the shared base packs.
Example configuration
Solution
Include the pack-format range in
ResourcePack.equals/hashCode. Default entries (no version) and version-specific entries are now distinguishable even when the URL/hash is identical. During registration both variants survive, and later filteringsearchForValidPacksstill prefers overrides because they remain in the set.