diff options
| author | shedaniel <daniel@shedaniel.me> | 2023-02-18 17:59:31 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2023-05-29 21:22:07 +0800 |
| commit | 77e36ec2707e60865e5e2d7735d66060c4b6f05d (patch) | |
| tree | e816aa1a805b97272f42e05da4c700e82fcfd92c /runtime/src/main/java | |
| parent | 21cd9c37987fe8d438ff9246e8aefbca10785711 (diff) | |
| download | RoughlyEnoughItems-77e36ec2707e60865e5e2d7735d66060c4b6f05d.tar.gz RoughlyEnoughItems-77e36ec2707e60865e5e2d7735d66060c4b6f05d.tar.bz2 RoughlyEnoughItems-77e36ec2707e60865e5e2d7735d66060c4b6f05d.zip | |
Disable globalized config screen
Diffstat (limited to 'runtime/src/main/java')
| -rw-r--r-- | runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java | 56 |
1 files changed, 26 insertions, 30 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 984afdedb..901934487 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; @@ -393,8 +394,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( new TranslatableComponent("text.rei.feedback", new TranslatableComponent("text.rei.feedback.link") @@ -410,36 +409,33 @@ public class ConfigManagerImpl implements ConfigManager { builder.getOrCreateCategory(new TranslatableComponent("config.roughlyenoughitems.advanced")).getEntries().add(0, new ReloadPluginsEntry(220)); builder.getOrCreateCategory(new TranslatableComponent("config.roughlyenoughitems.advanced")).getEntries().add(0, new PerformanceEntry(220)); } - 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( + 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( new TranslatableComponent("text.rei.support.me.desc", new TranslatableComponent("text.rei.support.me.patreon") - .withStyle(style -> style - .withColor(TextColor.fromRgb(0xff1fc3ff)) - .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://patreon.com/shedaniel")) + .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, new ImmutableTextComponent("https://patreon.com/shedaniel"))) - ), + ), new TranslatableComponent("text.rei.support.me.bisect") - .withStyle(style -> style - .withColor(TextColor.fromRgb(0xff1fc3ff)) - .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://www.bisecthosting.com/shedaniel")) + .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, new ImmutableTextComponent("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(new TranslatableComponent("text.rei.support.me"))); - ((GlobalizedClothConfigScreen) screen).listWidget.children().add(0, (AbstractConfigEntry) new EmptyEntry(4)); + ) + ) + .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(new TranslatableComponent("text.rei.support.me"))); + builder.getOrCreateCategory(Component.translatable("config.roughlyenoughitems.basics")).getEntries().add(0, new EmptyEntry(4)); + return builder.setAfterInitConsumer(screen -> { ScreenHooks.addButton(screen, new Button(screen.width - 104, 4, 100, 20, new TranslatableComponent("text.rei.credits"), button -> { CreditsScreen creditsScreen = new CreditsScreen(screen); Minecraft.getInstance().setScreen(creditsScreen); |
