Open
Conversation
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.
AI Assistance Notice: I used an AI assistant to help draft this PR text and Javadocs. The code and docs were reviewed and adjusted by me; any mistakes are my own, and I’m responsible for the final result. I just really hate writing documents.
Summary
Converts
PackFormatfrom an int-only API to a major.minor model to support Mojang’s minor pack-format bumps (e.g.,65.2,68.0), while retaining the int-based API via deprecations (not removals).Highlights
Introduces
FormatVersionvalue object and public accessors:formatVersion(),minVersion(),maxVersion()isInRange(FormatVersion)Keeps legacy API (deprecated):
format(),min(),max(),isInRange(int),format(int),format(int,int,int)Validates ranges and comparisons in
PackFormatImplAdds
FormatVersionfactory overloadsCorrects
isSingle()semantics andhashCode()implementationMotivation
Recent/coming snapshots use minor increments for pack formats (e.g.,
65.1,65.2). Anintcannot represent these precisely. We provide forward compatibility without breaking existing consumers that still rely on the int-based API.What changed
API
FormatVersion-based surface (formatVersion,minVersion,maxVersion,isInRange(FormatVersion))Factories
format(FormatVersion)andformat(FormatVersion, FormatVersion, FormatVersion)format(int)/format(int,int,int)now delegate to the new factoriesImplementation
PackFormatImplnow checksmin ≤ format ≤ maxusingFormatVersion.compareToisSingle()requiresformat == min == maxisInRange(int)delegates toisInRange(FormatVersion.of(int))isInRange(FormatVersion)uses inclusive boundshashCode()now usesObjects.hash(...)Quality
FormatVersionctor to avoid duplicationBackwards compatibility
68.0 → 68).Migration guide
Before
After (preferred)
Bridging (still works, deprecated)
Risks
isSingle()(onlymin == max) will see corrected behavior (format == min == max).Example usage
Type: Enhancement / Compatibility
Breaking changes: No (API additions + deprecations only)