aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2023-02-18 17:59:31 +0800
committershedaniel <daniel@shedaniel.me>2023-02-18 19:32:53 +0800
commit3f1226c6986ffe092541bc146a5ebe1407e55693 (patch)
treecb8ef8e308e32f0d1080f3a82fd6cb3a764843e3
parent0566dd779c719d6c3c49310752d487e893e0dff5 (diff)
downloadRoughlyEnoughItems-3f1226c6986ffe092541bc146a5ebe1407e55693.tar.gz
RoughlyEnoughItems-3f1226c6986ffe092541bc146a5ebe1407e55693.tar.bz2
RoughlyEnoughItems-3f1226c6986ffe092541bc146a5ebe1407e55693.zip
Disable globalized config screen
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java64
1 files changed, 30 insertions, 34 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java
index 5ccb12899..d9205e392 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java
@@ -41,9 +41,10 @@ import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.JsonNull;
import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.JsonObject;
import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.JsonPrimitive;
import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.api.DeserializationException;
-import me.shedaniel.clothconfig2.api.*;
-import me.shedaniel.clothconfig2.gui.AbstractConfigScreen;
-import me.shedaniel.clothconfig2.gui.GlobalizedClothConfigScreen;
+import me.shedaniel.clothconfig2.api.AbstractConfigListEntry;
+import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
+import me.shedaniel.clothconfig2.api.Modifier;
+import me.shedaniel.clothconfig2.api.ModifierKeyCode;
import me.shedaniel.clothconfig2.gui.entries.KeyCodeEntry;
import me.shedaniel.clothconfig2.gui.entries.TextListEntry;
import me.shedaniel.rei.api.client.REIRuntime;
@@ -400,8 +401,6 @@ public class ConfigManagerImpl implements ConfigManager {
provider.setOptionFunction((baseI13n, field) -> field.isAnnotationPresent(ConfigObjectImpl.DontApplyFieldName.class) ? baseI13n : String.format("%s.%s", baseI13n, field.getName()));
provider.setCategoryFunction((baseI13n, categoryName) -> String.format("%s.%s", baseI13n, categoryName));
provider.setBuildFunction(builder -> {
- builder.setGlobalized(true);
- builder.setGlobalizedExpanded(false);
if (Minecraft.getInstance().getConnection() != null && Minecraft.getInstance().getConnection().getRecipeManager() != null) {
TextListEntry feedbackEntry = ConfigEntryBuilder.create().startTextDescription(
Component.translatable("text.rei.feedback", Component.translatable("text.rei.feedback.link")
@@ -417,36 +416,33 @@ public class ConfigManagerImpl implements ConfigManager {
builder.getOrCreateCategory(Component.translatable("config.roughlyenoughitems.advanced")).getEntries().add(0, new ReloadPluginsEntry(220));
builder.getOrCreateCategory(Component.translatable("config.roughlyenoughitems.advanced")).getEntries().add(0, new PerformanceEntry(220));
}
+ ConfigAddonRegistryImpl addonRegistry = (ConfigAddonRegistryImpl) ConfigAddonRegistry.getInstance();
+ if (!addonRegistry.getAddons().isEmpty()) {
+ builder.getOrCreateCategory(Component.translatable("config.roughlyenoughitems.basics")).getEntries().add(0, new EmptyEntry(4));
+ builder.getOrCreateCategory(Component.translatable("config.roughlyenoughitems.basics")).getEntries().add(0, new ConfigAddonsEntry(220));
+ }
+ TextListEntry supportText = ConfigEntryBuilder.create().startTextDescription(
+ Component.translatable("text.rei.support.me.desc",
+ Component.translatable("text.rei.support.me.patreon")
+ .withStyle(style -> style
+ .withColor(TextColor.fromRgb(0xff1fc3ff))
+ .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://patreon.com/shedaniel"))
+ .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("https://patreon.com/shedaniel")))
+ ),
+ Component.translatable("text.rei.support.me.bisect")
+ .withStyle(style -> style
+ .withColor(TextColor.fromRgb(0xff1fc3ff))
+ .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://www.bisecthosting.com/shedaniel"))
+ .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("https://www.bisecthosting.com/shedaniel")))
+ )
+ )
+ .withStyle(ChatFormatting.GRAY)
+ ).build();
+ builder.getOrCreateCategory(Component.translatable("config.roughlyenoughitems.basics")).getEntries().add(0, new EmptyEntry(4));
+ builder.getOrCreateCategory(Component.translatable("config.roughlyenoughitems.basics")).getEntries().add(0, supportText);
+ builder.getOrCreateCategory(Component.translatable("config.roughlyenoughitems.basics")).getEntries().add(0, new TitleTextEntry(Component.translatable("text.rei.support.me")));
+ builder.getOrCreateCategory(Component.translatable("config.roughlyenoughitems.basics")).getEntries().add(0, new EmptyEntry(4));
return builder.setAfterInitConsumer(screen -> {
- ConfigAddonRegistryImpl addonRegistry = (ConfigAddonRegistryImpl) ConfigAddonRegistry.getInstance();
- if (!addonRegistry.getAddons().isEmpty()) {
- ((GlobalizedClothConfigScreen) screen).listWidget.children().add(0, (AbstractConfigEntry) new EmptyEntry(4));
- ConfigAddonsEntry configAddonsEntry = new ConfigAddonsEntry(220);
- configAddonsEntry.setScreen((AbstractConfigScreen) screen);
- ((GlobalizedClothConfigScreen) screen).listWidget.children().add(0, (AbstractConfigEntry) configAddonsEntry);
- }
- ((GlobalizedClothConfigScreen) screen).listWidget.children().add(0, (AbstractConfigEntry) new EmptyEntry(4));
- TextListEntry supportText = ConfigEntryBuilder.create().startTextDescription(
- Component.translatable("text.rei.support.me.desc",
- Component.translatable("text.rei.support.me.patreon")
- .withStyle(style -> style
- .withColor(TextColor.fromRgb(0xff1fc3ff))
- .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://patreon.com/shedaniel"))
- .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("https://patreon.com/shedaniel")))
- ),
- Component.translatable("text.rei.support.me.bisect")
- .withStyle(style -> style
- .withColor(TextColor.fromRgb(0xff1fc3ff))
- .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://www.bisecthosting.com/shedaniel"))
- .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("https://www.bisecthosting.com/shedaniel")))
- )
- )
- .withStyle(ChatFormatting.GRAY)
- ).build();
- supportText.setScreen((AbstractConfigScreen) screen);
- ((GlobalizedClothConfigScreen) screen).listWidget.children().add(0, (AbstractConfigEntry) supportText);
- ((GlobalizedClothConfigScreen) screen).listWidget.children().add(0, (AbstractConfigEntry) new TitleTextEntry(Component.translatable("text.rei.support.me")));
- ((GlobalizedClothConfigScreen) screen).listWidget.children().add(0, (AbstractConfigEntry) new EmptyEntry(4));
ScreenHooks.addRenderableWidget(screen, new Button(screen.width - 104, 4, 100, 20, Component.translatable("text.rei.credits"), button -> {
CreditsScreen creditsScreen = new CreditsScreen(screen);
Minecraft.getInstance().setScreen(creditsScreen);