aboutsummaryrefslogtreecommitdiff
path: root/runtime/src/main/java/me
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2022-04-23 15:48:39 +0800
committershedaniel <daniel@shedaniel.me>2022-04-23 15:48:59 +0800
commitb04445138664ac1e8151286b0c3858c442da9419 (patch)
tree89b0f540e0d371efab2ba1c01a388884490d7f08 /runtime/src/main/java/me
parent8eb903cc67d5e6813570ddd1d74bcfd3a3ffba45 (diff)
downloadRoughlyEnoughItems-b04445138664ac1e8151286b0c3858c442da9419.tar.gz
RoughlyEnoughItems-b04445138664ac1e8151286b0c3858c442da9419.tar.bz2
RoughlyEnoughItems-b04445138664ac1e8151286b0c3858c442da9419.zip
Compare versions more on a smaller scale
Diffstat (limited to 'runtime/src/main/java/me')
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java
index 5b56c0739..adc82c4c4 100644
--- a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java
+++ b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java
@@ -30,14 +30,16 @@ import java.lang.invoke.MethodHandles;
import java.lang.reflect.Method;
public class RoughlyEnoughItemsInitializer {
- public static final String COMPATIBLE_MC_VERSION = "1.18";
+ public static final String COMPATIBLE_MC_VERSION_LOW = "1.18.2";
+ public static final String COMPATIBLE_MC_VERSION_HIGH = "1.19";
public static void onInitialize() {
RoughlyEnoughItemsState.env = isClient() ? EnvType.CLIENT : EnvType.SERVER;
RoughlyEnoughItemsState.isDev = isDev();
-
- if (getMinecraftVersion().startsWith("1.") && !getMinecraftVersion().startsWith(COMPATIBLE_MC_VERSION)) {
- RoughlyEnoughItemsState.error("Your current REI version (for " + COMPATIBLE_MC_VERSION + ") is not compatible with your current Minecraft version (" + getMinecraftVersion() + ").");
+
+ String minecraftVersion = getMinecraftVersion();
+ if (minecraftVersion.startsWith("1.") && (compareVersions(minecraftVersion, COMPATIBLE_MC_VERSION_LOW) < 0 || compareVersions(minecraftVersion, COMPATIBLE_MC_VERSION_HIGH) >= 0)) {
+ RoughlyEnoughItemsState.error("Your current REI version (for >=" + COMPATIBLE_MC_VERSION_LOW + " and <" + COMPATIBLE_MC_VERSION_HIGH + ") is not compatible with your current Minecraft version (" + minecraftVersion + ").");
}
checkMods();
@@ -106,4 +108,9 @@ public class RoughlyEnoughItemsInitializer {
public static String getMinecraftVersion() {
throw new AssertionError();
}
+
+ @ExpectPlatform
+ public static int compareVersions(String version1, String version2) {
+ throw new AssertionError();
+ }
} \ No newline at end of file