aboutsummaryrefslogtreecommitdiff
path: root/forge
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2021-03-28 23:02:31 +0800
committershedaniel <daniel@shedaniel.me>2021-03-28 23:02:31 +0800
commit9402858f8f6f4ddee96fbaf171de7f0cfd770d5b (patch)
tree3e45f4ae1946c6ad41b27f0026fe7cb7ef2cc191 /forge
parent939d940c178637748f0c393e1209647479fdd8f3 (diff)
downloadRoughlyEnoughItems-9402858f8f6f4ddee96fbaf171de7f0cfd770d5b.tar.gz
RoughlyEnoughItems-9402858f8f6f4ddee96fbaf171de7f0cfd770d5b.tar.bz2
RoughlyEnoughItems-9402858f8f6f4ddee96fbaf171de7f0cfd770d5b.zip
Porperly save JEI compatibility settings
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'forge')
-rw-r--r--forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java3
-rw-r--r--forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java3
-rw-r--r--forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsInitializerImpl.java43
3 files changed, 46 insertions, 3 deletions
diff --git a/forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java b/forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java
index 437a05e22..40bc41a49 100644
--- a/forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java
+++ b/forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java
@@ -23,6 +23,7 @@
package me.shedaniel.rei.forge;
+import me.shedaniel.architectury.platform.forge.EventBuses;
import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
import me.shedaniel.rei.api.common.plugins.PluginManager;
import me.shedaniel.rei.api.common.plugins.PluginView;
@@ -35,6 +36,7 @@ import me.shedaniel.rei.plugin.client.DefaultClientRuntimePlugin;
import me.shedaniel.rei.plugin.common.DefaultPlugin;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
+import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import java.util.ArrayList;
import java.util.List;
@@ -50,6 +52,7 @@ public class PluginDetectorImpl {
}
public static void detectCommonPlugins() {
+ EventBuses.registerModEventBus("roughlyenoughitems", FMLJavaModLoadingContext.get().getModEventBus());
RoughlyEnoughItemsForge.<REIPlugin, me.shedaniel.rei.api.common.plugins.REIPlugin<?>>scanAnnotation(REIPlugin.class, me.shedaniel.rei.api.common.plugins.REIPlugin.class::isAssignableFrom, (modId, plugin) -> {
((PluginView) PluginManager.getInstance()).registerPlugin(plugin);
});
diff --git a/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java b/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java
index c3430c559..7f035c134 100644
--- a/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java
+++ b/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java
@@ -24,13 +24,11 @@
package me.shedaniel.rei.forge;
import com.google.common.collect.Lists;
-import me.shedaniel.architectury.platform.forge.EventBuses;
import me.shedaniel.rei.RoughlyEnoughItemsInitializer;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.common.Mod;
-import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.forgespi.language.IModInfo;
import net.minecraftforge.forgespi.language.ModFileScanData;
import org.apache.commons.lang3.tuple.ImmutablePair;
@@ -51,7 +49,6 @@ public class RoughlyEnoughItemsForge {
public static final Logger LOGGER = LogManager.getFormatterLogger("REI");
public RoughlyEnoughItemsForge() {
- EventBuses.registerModEventBus("roughlyenoughitems", FMLJavaModLoadingContext.get().getModEventBus());
RoughlyEnoughItemsInitializer.onInitialize();
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> RoughlyEnoughItemsInitializer::onInitializeClient);
}
diff --git a/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsInitializerImpl.java b/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsInitializerImpl.java
new file mode 100644
index 000000000..b6ce353b2
--- /dev/null
+++ b/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsInitializerImpl.java
@@ -0,0 +1,43 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020 shedaniel
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package me.shedaniel.rei.forge;
+
+import me.shedaniel.rei.RoughlyEnoughItemsState;
+import net.minecraftforge.api.distmarker.Dist;
+import net.minecraftforge.fml.ModList;
+import net.minecraftforge.fml.loading.FMLEnvironment;
+
+public class RoughlyEnoughItemsInitializerImpl {
+ public static boolean isClient() {
+ return FMLEnvironment.dist == Dist.CLIENT;
+ }
+
+ public static void checkMods() {
+ if (isClient()) {
+ if (!ModList.get().isLoaded("cloth-config")) {
+ RoughlyEnoughItemsState.error("Cloth Config is not installed!", "https://www.curseforge.com/minecraft/mc-mods/cloth-config/files/all");
+ }
+ }
+ }
+}