aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnModMenu.java
diff options
context:
space:
mode:
authorSHsuperCM <shsupercm@gmail.com>2022-01-21 14:21:23 +0200
committerSHsuperCM <shsupercm@gmail.com>2022-01-21 14:21:23 +0200
commit897172bde9128da47181a6db6c1ff4885081ba8d (patch)
tree462e0c45eddaf727596a77b6a17d41560fa4796e /src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnModMenu.java
parentc3c547c6f950ebbc047cd31672f6a794483a9d0e (diff)
downloadCITResewn-897172bde9128da47181a6db6c1ff4885081ba8d.tar.gz
CITResewn-897172bde9128da47181a6db6c1ff4885081ba8d.tar.bz2
CITResewn-897172bde9128da47181a6db6c1ff4885081ba8d.zip
Re(moved) most of the old sources
Diffstat (limited to 'src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnModMenu.java')
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnModMenu.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnModMenu.java b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnModMenu.java
index 7a4954c..cf6d9bd 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnModMenu.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnModMenu.java
@@ -3,11 +3,23 @@ package shcm.shsupercm.fabric.citresewn.config;
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import net.fabricmc.loader.api.FabricLoader;
-import shcm.shsupercm.fabric.citresewn.OptionalCompat;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.gui.screen.NoticeScreen;
+import net.minecraft.text.Text;
public class CITResewnModMenu implements ModMenuApi {
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
- return OptionalCompat.getModConfigScreenFactory()::apply;
+ if (FabricLoader.getInstance().isModLoaded("cloth-config2"))
+ return new ClothConfigOpenImpl().getModConfigScreenFactory();
+
+ return parent -> new NoticeScreen(() -> MinecraftClient.getInstance().setScreen(parent), Text.of("CIT Resewn"), Text.of("CIT Resewn requires Cloth Config to be able to show the config."));
+ }
+
+ private static class ClothConfigOpenImpl implements ModMenuApi {
+ @Override
+ public ConfigScreenFactory<?> getModConfigScreenFactory() {
+ return CITResewnConfigScreenFactory::create;
+ }
}
}