diff options
author | SHsuperCM <shsupercm@gmail.com> | 2022-03-04 09:55:50 +0200 |
---|---|---|
committer | SHsuperCM <shsupercm@gmail.com> | 2022-03-04 10:03:28 +0200 |
commit | d2a7a6b219ff2b229774dba336417822ec019b7b (patch) | |
tree | 3ab4c2fd99a7420feaa502e78e0816be1e585f57 /src/main/java | |
parent | 5b465c7ec114700e51f22dff6a68e594bef5bc5b (diff) | |
download | CITResewn-d2a7a6b219ff2b229774dba336417822ec019b7b.tar.gz CITResewn-d2a7a6b219ff2b229774dba336417822ec019b7b.tar.bz2 CITResewn-d2a7a6b219ff2b229774dba336417822ec019b7b.zip |
Added back enchantment scroll multiplier config
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java index 2d584aa..b05dc6e 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java @@ -37,20 +37,23 @@ public class CITResewnConfigScreenFactory { .setDefaultValue(defaultConfig.enabled) .build()); - class CurrentScreen { Screen screen; boolean prevToggle = false; } final CurrentScreen currentScreen = new CurrentScreen(); - category.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.citresewn.defaults.title"), false) - .setTooltip(new TranslatableText("config.citresewn.defaults.tooltip")) - .setYesNoTextSupplier((b) -> { - if (b != currentScreen.prevToggle) { - //noinspection unchecked - MinecraftClient.getInstance().setScreen((Screen) FabricLoader.getInstance().getEntrypoints(DEFAULTS_CONFIG_ENTRYPOINT, Function.class).stream().findAny().orElseThrow().apply(currentScreen.screen)); - - currentScreen.prevToggle = b; - } + if (FabricLoader.getInstance().isModLoaded("citresewn-defaults")) { + class CurrentScreen { boolean prevToggle = false; } final CurrentScreen currentScreen = new CurrentScreen(); + category.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.citresewn-defaults.title"), false) + .setTooltip(new TranslatableText("config.citresewn-defaults.tooltip")) - return new TranslatableText("config.citresewn.configure"); - }) - .build()); + .setYesNoTextSupplier((b) -> { + if (b != currentScreen.prevToggle) { + //noinspection unchecked + MinecraftClient.getInstance().setScreen((Screen) FabricLoader.getInstance().getEntrypoints(DEFAULTS_CONFIG_ENTRYPOINT, Function.class).stream().findAny().orElseThrow().apply(create(parent))); + + currentScreen.prevToggle = b; + } + + return new TranslatableText("config.citresewn.configure"); + }) + .build()); + } category.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.citresewn.mute_errors.title"), currentConfig.mute_errors) .setTooltip(new TranslatableText("config.citresewn.mute_errors.tooltip")) @@ -67,7 +70,7 @@ public class CITResewnConfigScreenFactory { category.addEntry(entryBuilder.startIntSlider(new TranslatableText("config.citresewn.cache_ms.title"), currentConfig.cache_ms / 50, 0, 5 * 20) .setTooltip(new TranslatableText("config.citresewn.cache_ms.tooltip")) .setSaveConsumer(newConfig -> currentConfig.cache_ms = newConfig * 50) - .setDefaultValue(currentConfig.cache_ms / 50) + .setDefaultValue(defaultConfig.cache_ms / 50) .setTextGetter(ticks -> { if (ticks <= 1) return new TranslatableText("config.citresewn.cache_ms.ticks." + ticks).formatted(Formatting.AQUA); @@ -90,6 +93,6 @@ public class CITResewnConfigScreenFactory { .requireRestart() .build()); - return currentScreen.screen = builder.build(); + return builder.build(); } } |