Interface MinecraftVersion

All Superinterfaces:
Comparable<MinecraftVersion>

public sealed interface MinecraftVersion extends Comparable<MinecraftVersion>
A Minecraft version, such as 26.4, 26.4.1 or 26.4-snapshot-5.

Versions are ordered by number, then by stage: snapshots, pre-releases, release candidates, then the release.

Since:
0.1.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    A development stage, in release order.
  • Method Summary

    Modifier and Type
    Method
    Description
    id()
    Returns the version id, for instance 26.4-snapshot-5.
    int
    Returns which snapshot, pre-release or release candidate this is, 2 in 26.4.1-rc-2, 0 for a release.
    int
    Returns the first number of the version, 26 in 26.4.1-rc-2.
    int
    Returns the second number of the version, 4 in 26.4.1-rc-2.
    Returns the display name, for instance 26.4 Snapshot 5.
    of(int major, int minor, int patch, MinecraftVersion.Stage stage, int iteration)
    Creates a version.
    Parses a version id.
    int
    Returns the third number of the version, 1 in 26.4.1-rc-2, 0 when omitted as in 26.4.
    Returns the development stage, MinecraftVersion.Stage.RELEASE_CANDIDATE in 26.4.1-rc-2.

    Methods inherited from interface Comparable

    compareTo
  • Method Details

    • of

      @Contract("_, _, _, _, _ -> new") static MinecraftVersion of(int major, int minor, int patch, MinecraftVersion.Stage stage, int iteration)
      Creates a version.
      Parameters:
      major - the first number of the version
      minor - the second number of the version
      patch - the third number of the version, 0 if absent
      stage - the development stage
      iteration - which snapshot, pre-release or release candidate this is, 0 for a release
      Returns:
      the version
      Throws:
      IllegalArgumentException - if a number is negative, or the iteration does not match the stage
      Since:
      0.1.0
    • parse

      @Contract("_ -> new") static MinecraftVersion parse(String id)
      Parses a version id.
      Parameters:
      id - the version id, for instance 26.2-rc-10
      Returns:
      the version
      Throws:
      IllegalArgumentException - if the id is malformed
      Since:
      0.1.0
    • major

      @Contract(pure=true) int major()
      Returns the first number of the version, 26 in 26.4.1-rc-2.
      Returns:
      the first number of the version, 26 in 26.4.1-rc-2
      Since:
      0.1.0
    • minor

      @Contract(pure=true) int minor()
      Returns the second number of the version, 4 in 26.4.1-rc-2.
      Returns:
      the second number of the version, 4 in 26.4.1-rc-2
      Since:
      0.1.0
    • patch

      @Contract(pure=true) int patch()
      Returns the third number of the version, 1 in 26.4.1-rc-2, 0 when omitted as in 26.4.
      Returns:
      the third number of the version, 1 in 26.4.1-rc-2, 0 when omitted as in 26.4
      Since:
      0.1.0
    • stage

      Returns the development stage, MinecraftVersion.Stage.RELEASE_CANDIDATE in 26.4.1-rc-2.
      Returns:
      the development stage, MinecraftVersion.Stage.RELEASE_CANDIDATE in 26.4.1-rc-2
      Since:
      0.1.0
    • iteration

      @Contract(pure=true) int iteration()
      Returns which snapshot, pre-release or release candidate this is, 2 in 26.4.1-rc-2, 0 for a release.
      Returns:
      which snapshot, pre-release or release candidate this is, 2 in 26.4.1-rc-2, 0 for a release
      Since:
      0.1.0
    • id

      @Contract(pure=true) String id()
      Returns the version id, for instance 26.4-snapshot-5.
      Returns:
      the version id, for instance 26.4-snapshot-5
      Since:
      0.1.0
    • name

      @Contract(pure=true) String name()
      Returns the display name, for instance 26.4 Snapshot 5.
      Returns:
      the display name, for instance 26.4 Snapshot 5
      Since:
      0.1.0