aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/config/CITResewnDefaultsConfigScreenFactory.java9
-rw-r--r--defaults/src/main/resources/assets/citresewn-defaults/lang/en_us.json7
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java33
3 files changed, 29 insertions, 20 deletions
diff --git a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/config/CITResewnDefaultsConfigScreenFactory.java b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/config/CITResewnDefaultsConfigScreenFactory.java
index 6d89bc6..95b0579 100644
--- a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/config/CITResewnDefaultsConfigScreenFactory.java
+++ b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/config/CITResewnDefaultsConfigScreenFactory.java
@@ -4,7 +4,6 @@ import io.shcm.shsupercm.fabric.fletchingtable.api.Entrypoint;
import me.shedaniel.clothconfig2.api.ConfigBuilder;
import me.shedaniel.clothconfig2.api.ConfigCategory;
import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
-import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.text.LiteralText;
import net.minecraft.text.TranslatableText;
@@ -17,13 +16,17 @@ public class CITResewnDefaultsConfigScreenFactory {
ConfigBuilder builder = ConfigBuilder.create()
.setParentScreen(parent)
- .setTitle(new TranslatableText("config.citresewn.defaults.title"))
+ .setTitle(new TranslatableText("config.citresewn-defaults.title"))
.setSavingRunnable(currentConfig::write);
ConfigCategory category = builder.getOrCreateCategory(new LiteralText(""));
ConfigEntryBuilder entryBuilder = builder.entryBuilder();
-
+ category.addEntry(entryBuilder.startFloatField(new TranslatableText("config.citresewn-defaults.type_enchantment_scroll_multiplier.title"), currentConfig.type_enchantment_scroll_multiplier)
+ .setTooltip(new TranslatableText("config.citresewn-defaults.type_enchantment_scroll_multiplier.tooltip"))
+ .setSaveConsumer(newConfig -> currentConfig.type_enchantment_scroll_multiplier = newConfig)
+ .setDefaultValue(defaultConfig.type_enchantment_scroll_multiplier)
+ .build());
return builder.build();
}
diff --git a/defaults/src/main/resources/assets/citresewn-defaults/lang/en_us.json b/defaults/src/main/resources/assets/citresewn-defaults/lang/en_us.json
index 72784ed..5f68e45 100644
--- a/defaults/src/main/resources/assets/citresewn-defaults/lang/en_us.json
+++ b/defaults/src/main/resources/assets/citresewn-defaults/lang/en_us.json
@@ -1,4 +1,7 @@
{
- "config.citresewn.defaults.title": "CIT Resewn: Defaults",
- "config.citresewn.defaults.tooltip": "Go to the defaults' config menu"
+ "config.citresewn-defaults.title": "CIT Resewn: Defaults",
+ "config.citresewn-defaults.tooltip": "Go to the defaults' config menu",
+
+ "config.citresewn-defaults.type_enchantment_scroll_multiplier.title": "Type Enchantment: Scroll multiplier",
+ "config.citresewn-defaults.type_enchantment_scroll_multiplier.tooltip": "A general multiplier for how fast cit enchantment glints scroll"
} \ No newline at end of file
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();
}
}