Interface VersionScheme


public interface VersionScheme
Strategy interface for converting between classic Java release numbers and Minecraft's year-based drop numbering.

The project ships with three entry points:

  • MOJANG, which keeps the historically grounded mappings and stays conservative when no official classic alias exists.
  • CROA_CUSTOM, which keeps the same historical mappings but treats 1.21.11 as a custom 1.22 milestone, continues custom hotfixes on the 25.4.x line, and shifts the projected future classic aliases forward by one minor line.
  • mapped(MappingTable), which lets callers create their own exact scheme from user-defined mappings.

Both built-in schemes are exact for the release lines that are explicitly registered in MappingTable. Those mappings are based on the real Java release groupings, so hotfix numbers stay contiguous even when Mojang skipped a classic patch number such as 1.4.3 or 1.7.3.

  • Field Details

    • MOJANG

      static final VersionScheme MOJANG
      Canonical scheme that models Mojang's published numbering direction as closely as possible.

      For historical Java releases, this scheme uses an explicit mapping table grouped by the actual feature update or game drop each version belongs to. That means examples such as 1.20.3 -> 23.2 and 1.21.4 -> 24.4 are treated as separate drops instead of being folded into the same release line.

      For post-2025 releases, Mojang no longer publishes a classic 1.x.y alias. To avoid inventing more structure than the official numbering guarantees, this scheme only projects the first drop of a future year back into classic form. Additional future drops without an explicit table entry are rejected rather than guessed.

    • CROA_CUSTOM

      static final VersionScheme CROA_CUSTOM
      Custom scheme that keeps the same exact historical mappings as MOJANG, but makes one project-specific reinterpretation.

      Under this scheme, the release line represented officially by 1.21.11 / 25.4 is treated as a custom 1.22. Hotfixes on that custom line continue naturally as 1.22.1 -> 25.4.1, 1.22.2 -> 25.4.2, and so on. Because the base 1.22 identifier is already consumed by that alias, projected future aliases move forward by one classic minor line: 26.1 -> 1.23, 26.1.1 -> 1.23.1, 27.1 -> 1.24, and so on.

      Outside that reinterpretation, this scheme follows MOJANG as closely as possible.

  • Method Details

    • mapped

      @NotNull static @NotNull VersionScheme mapped(@NotNull @NotNull MappingTable mappings)
      Creates a scheme backed only by the supplied explicit mapping table.

      The returned scheme normalizes values that are already in the requested family and uses the table only for cross-family conversions. If a conversion is not present in the table, the scheme throws an IllegalArgumentException instead of guessing a fallback.

      Parameters:
      mappings - mapping table to use for exact drop/classic conversions
      Returns:
      scheme backed by the supplied explicit mappings
    • toClassic

      @NotNull @NotNull String toClassic(@NotNull @NotNull MinecraftVersion version)
      Converts the supplied parsed version into classic numbering.

      If the input is already classic, implementations return a normalized classic string. Otherwise, they translate the version according to the scheme's own mapping rules.

      Parameters:
      version - parsed version to convert
      Returns:
      classic representation of the supplied version
      Throws:
      IllegalArgumentException - when the scheme cannot produce a reliable classic mapping
    • toClassic

      @NotNull default @NotNull String toClassic(@NotNull @NotNull String version)
      Parses the supplied text and delegates to toClassic(MinecraftVersion).

      This is the convenient entry point when the caller does not need to keep a MinecraftVersion instance around.

      Parameters:
      version - textual version to convert
      Returns:
      classic representation of the supplied version
      Throws:
      IllegalArgumentException - when the text cannot be parsed or the scheme cannot map it
    • toDrop

      @NotNull @NotNull String toDrop(@NotNull @NotNull MinecraftVersion version)
      Converts the supplied parsed version into drop numbering.

      If the input is already a drop version, implementations return a normalized drop string. Otherwise, they translate the version according to the scheme's own mapping rules.

      Parameters:
      version - parsed version to convert
      Returns:
      drop representation of the supplied version
      Throws:
      IllegalArgumentException - when the scheme cannot produce a reliable drop mapping
    • toDrop

      @NotNull default @NotNull String toDrop(@NotNull @NotNull String version)
      Parses the supplied text and delegates to toDrop(MinecraftVersion).

      This overload is useful when callers want the convenience of string input while still benefiting from the same validation and mapping rules as the object-based API.

      Parameters:
      version - textual version to convert
      Returns:
      drop representation of the supplied version
      Throws:
      IllegalArgumentException - when the text cannot be parsed or the scheme cannot map it