Class NmsVersionParser
java.lang.Object
com.kamikazejam.kamicommon.util.nms.NmsVersionParser
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intgetFormattedNmsInteger(String mcVer) Converts a Minecraft version string into an integer that sorts in release order.
-
Constructor Details
-
NmsVersionParser
public NmsVersionParser()
-
-
Method Details
-
getFormattedNmsInteger
Converts a Minecraft version string into an integer that sorts in release order.Two eras, because Minecraft left
1.xversioning behind after 1.21.11 and moved to calendar versions (26.1.1,26.1.2,26.2, ...):- Legacy (
1.x): the original packing is reproduced exactly, digit for digit, so every existingf("1.x.y")threshold keeps the value it has always had. Note the packing is textual rather than arithmetic, which is why1.21.10is12110and not1220. - Calendar (
>= 2.x):major*10_000 + minor*100 + patch, two digits each, so26.2reads as26|02|00and givesf("26.2") == 260200,f("26.1.2") == 260102. Every value lands far above every legacy value, since the legacy branch tops out at"1" + "99" + "99" == 19999, so no offset is needed and the two eras cannot overlap. It also stays monotonic, which the old 4-digit packing did not: that gavef("26.2") == 2620, sorting belowf("1.21.11") == 12111.
- Parameters:
mcVer- The MC version string (i.e. "1.20.4", "1.8.8", "26.2", or "26.2.build.115")- Returns:
- The version as an order-preserving integer
- Legacy (
-