diff options
| author | shedaniel <daniel@shedaniel.me> | 2022-04-28 14:04:03 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2022-04-28 14:04:03 +0800 |
| commit | 1089b9e7f55711c6ae293a06bea919ff055c917a (patch) | |
| tree | 1cb1dcab924ff20e53cc0f7fefd24d5d106a01a5 /forge/src/main/java | |
| parent | 3b233ed80761e29409f16b30e8c8082334e07ca6 (diff) | |
| parent | 7ed1289a2427d45e440c9ea0a88346668b0fcf6c (diff) | |
| download | RoughlyEnoughItems-1089b9e7f55711c6ae293a06bea919ff055c917a.tar.gz RoughlyEnoughItems-1089b9e7f55711c6ae293a06bea919ff055c917a.tar.bz2 RoughlyEnoughItems-1089b9e7f55711c6ae293a06bea919ff055c917a.zip | |
Merge remote-tracking branch 'origin/8.x-1.18.2' into 9.x-1.19
# Conflicts:
# runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java
# runtime/src/main/java/me/shedaniel/rei/impl/client/gui/performance/PerformanceScreen.java
Diffstat (limited to 'forge/src/main/java')
| -rw-r--r-- | forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsInitializerImpl.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsInitializerImpl.java b/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsInitializerImpl.java index 54ed0c55f..76952dd4b 100644 --- a/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsInitializerImpl.java +++ b/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsInitializerImpl.java @@ -28,6 +28,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.loading.FMLEnvironment; import net.minecraftforge.fml.loading.FMLLoader; +import org.apache.maven.artifact.versioning.ComparableVersion; public class RoughlyEnoughItemsInitializerImpl { public static boolean isClient() { @@ -47,4 +48,16 @@ public class RoughlyEnoughItemsInitializerImpl { public static String getMinecraftVersion() { return ModList.get().getModContainerById("minecraft").get().getModInfo().getVersion().toString(); } + + public static int compareVersions(String version1, String version2) { + ComparableVersion v1 = new ComparableVersion(version1); + ComparableVersion v2 = new ComparableVersion(version2); + + try { + return v1.compareTo(v2); + } catch (IllegalStateException e) { + new IllegalStateException("Failed to compare versions: " + version1 + " and " + version2, e).printStackTrace(); + return 0; + } + } } |
