diff options
| author | shedaniel <daniel@shedaniel.me> | 2023-11-07 14:09:52 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2024-04-16 00:38:18 +0900 |
| commit | 54ffa6bc8868e8e5e1337806d0a681b316096cde (patch) | |
| tree | f859f757d9ed0c7ce76dada9b732c7e37efe4786 /runtime/src | |
| parent | 73dd8da0bdda912c7482b34fb0dc4f2d680005bc (diff) | |
| download | RoughlyEnoughItems-54ffa6bc8868e8e5e1337806d0a681b316096cde.tar.gz RoughlyEnoughItems-54ffa6bc8868e8e5e1337806d0a681b316096cde.tar.bz2 RoughlyEnoughItems-54ffa6bc8868e8e5e1337806d0a681b316096cde.zip | |
Rename keybinds category to input, add category descriptions
Diffstat (limited to 'runtime/src')
| -rw-r--r-- | runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoriesListWidget.java | 2 | ||||
| -rw-r--r-- | runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoryEntryWidget.java | 55 | ||||
| -rw-r--r-- | runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigCategories.java | 41 | ||||
| -rw-r--r-- | runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigGroups.java | 54 | ||||
| -rw-r--r-- | runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigOptions.java | 96 | ||||
| -rw-r--r-- | runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/OptionCategory.java | 14 | ||||
| -rwxr-xr-x | runtime/src/main/resources/assets/roughlyenoughitems/lang/en_us.json | 50 | ||||
| -rw-r--r-- | runtime/src/main/resources/assets/roughlyenoughitems/textures/gui/config/input.png (renamed from runtime/src/main/resources/assets/roughlyenoughitems/textures/gui/config/keybinds.png) | bin | 238 -> 238 bytes |
8 files changed, 182 insertions, 130 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoriesListWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoriesListWidget.java index 9f8fdf65f..3ab77951c 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoriesListWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoriesListWidget.java @@ -37,7 +37,7 @@ import java.util.List; public class ConfigCategoriesListWidget { public static Widget create(Rectangle bounds, List<OptionCategory> categories, IntValue selected) { WidgetWithBounds list = ListWidget.builderOf(RectangleUtils.inset(bounds, 3, 5), categories, - (index, entry) -> ConfigCategoryEntryWidget.create(entry)) + (index, entry) -> ConfigCategoryEntryWidget.create(entry, bounds.width - 6)) .gap(3) .isSelectable((index, entry) -> true) .selected(selected) diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoryEntryWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoryEntryWidget.java index e3d34d3d3..051464ff0 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoryEntryWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoryEntryWidget.java @@ -23,33 +23,72 @@ package me.shedaniel.rei.impl.client.gui.config.components; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Matrix4f; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; -import me.shedaniel.rei.api.client.gui.widgets.Label; -import me.shedaniel.rei.api.client.gui.widgets.WidgetWithBounds; -import me.shedaniel.rei.api.client.gui.widgets.Widgets; +import me.shedaniel.rei.api.client.gui.widgets.*; +import me.shedaniel.rei.api.client.util.MatrixUtils; +import me.shedaniel.rei.impl.client.gui.config.options.ConfigUtils; import me.shedaniel.rei.impl.client.gui.config.options.OptionCategory; +import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.util.FormattedCharSequence; + +import static me.shedaniel.rei.api.client.gui.widgets.Widget.scissor; public class ConfigCategoryEntryWidget { - public static WidgetWithBounds create(OptionCategory category) { - Label label = Widgets.createLabel(new Point(21, 7), category.getName().copy().withStyle(style -> style.withColor(0xFFC0C0C0))) + public static WidgetWithBounds create(OptionCategory category, int width) { + boolean hasDescription = !category.getDescription().getString().endsWith(".desc"); + Label label = Widgets.createLabel(new Point(21, hasDescription ? 5 : 7), category.getName().copy().withStyle(style -> style.withColor(0xFFC0C0C0))) .leftAligned(); Font font = Minecraft.getInstance().font; - Rectangle bounds = new Rectangle(0, 0, label.getBounds().getMaxX(), 7 * 3); + MutableComponent description = category.getDescription().copy().withStyle(style -> style.withColor(0xFF909090)); + Widget descriptionLabel = Widgets.createDrawableWidget((helper, matrices, mouseX, mouseY, delta) -> { + renderTextScrolling(matrices, description, 0, 0, (int) ((width - 21 - 6) / 0.75), 0xFF909090); + }); + Rectangle bounds = new Rectangle(0, 0, label.getBounds().getMaxX(), hasDescription ? 24 : 7 * 3); return Widgets.concatWithBounds( bounds, label, - Widgets.createTexturedWidget(category.getIcon(), new Rectangle(3, 3, 16, 16), 0, 0, 1, 1, 1, 1) + hasDescription ? Widgets.withTranslate(Widgets.withTranslate(descriptionLabel, Matrix4f.createScaleMatrix(0.75f, 0.75f, 0.75f)), 21, 5 + 10, 0) : Widgets.noOp(), + Widgets.createTexturedWidget(category.getIcon(), new Rectangle(3, hasDescription ? 5 : 3, 16, 16), 0, 0, 1, 1, 1, 1) ); } public static WidgetWithBounds createTiny(OptionCategory category) { Rectangle bounds = new Rectangle(0, 0, 16, 16); + Component[] texts = category.getDescription().getString().endsWith(".desc") ? new Component[]{category.getName()} + : new Component[]{category.getName().copy().withStyle(ChatFormatting.UNDERLINE), category.getDescription()}; return Widgets.withTooltip( Widgets.withBounds(Widgets.createTexturedWidget(category.getIcon(), bounds, 0, 0, 1, 1, 1, 1), bounds), - category.getName() + texts ); } + + private static void renderTextScrolling(PoseStack poses, Component text, int x, int y, int width, int color) { + renderTextScrolling(poses, text.getVisualOrderText(), x, y, width, color); + } + + private static void renderTextScrolling(PoseStack poses, FormattedCharSequence text, int x, int y, int width, int color) { + try (CloseableScissors scissors = scissor(poses, new Rectangle(x, y, width, y + 9))) { + Font font = Minecraft.getInstance().font; + int textWidth = font.width(text); + textWidth = MatrixUtils.transform(MatrixUtils.inverse(poses.last().pose()), new Rectangle(0, 0, textWidth, 100)).width; + width = MatrixUtils.transform(MatrixUtils.inverse(poses.last().pose()), new Rectangle(0, 0, width, 100)).width; + if (textWidth > width && !ConfigUtils.isReducedMotion()) { + poses.pushPose(); + float textX = (System.currentTimeMillis() % ((textWidth + 10) * textWidth / 3)) / (float) textWidth * 3; + poses.translate(-textX, 0, 0); + font.drawShadow(poses, text, x + width - textWidth - 10, y, color); + font.drawShadow(poses, text, x + width, y, color); + poses.popPose(); + } else { + font.drawShadow(poses, text, x, y, color); + } + } + } } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigCategories.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigCategories.java index fb23b5956..469013a0a 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigCategories.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigCategories.java @@ -34,18 +34,16 @@ import static me.shedaniel.rei.impl.client.gui.config.options.ConfigUtils.transl public interface AllREIConfigCategories { static OptionCategory make(String key) { return OptionCategory.of(new ResourceLocation("roughlyenoughitems:textures/gui/config/" + key + ".png"), - translatable("config.rei.categories." + key)); + translatable("config.rei.categories." + key), + translatable("config.rei.categories." + key + ".desc")); } OptionCategory APPEARANCE = make("appearance") .add(APPEARANCE_INTERFACE) .add(APPEARANCE_TOOLTIPS); - OptionCategory KEYBINDS = make("keybinds") - .add(KEYBINDS_KEYBINDS) + OptionCategory INPUT = make("input") + .add(INPUT_KEYBINDS) /*.add(KEYBINDS_ADVANCED)*/; - OptionCategory CHEATS = make("cheats") - .add(CHEATS_CHEATS) - .add(CHEATS_ADVANCED); OptionCategory LAYOUT = make("layout") .add(LAYOUT_WIDGETS) .add(LAYOUT_PANEL); @@ -53,22 +51,25 @@ public interface AllREIConfigCategories { .add(ACCESSIBILITY_DISPLAY) .add(ACCESSIBILITY_WIDGETS) .add(ACCESSIBILITY_FEATURES); + OptionCategory FILTERING = make("filtering") + .add(FILTERING_FILTERING) + .add(FILTERING_ADVANCED); + OptionCategory LIST = make("list") + .add(LIST_ENTRIES) + .add(LIST_COLLAPSIBLE_GROUPS); OptionCategory FAVORITES = make("favorites") .add(FAVORITES_FAVORITES) .add(FAVORITES_ADVANCED); - OptionCategory PERFORMANCE = make("performance") - .add(PERFORMANCE_RENDERING) - .add(PERFORMANCE_RELOAD); OptionCategory SEARCH = make("search") .add(SEARCH_APPEARANCE) .add(SEARCH_FILTERS) .add(SEARCH_ADVANCED); - OptionCategory FILTERING = make("filtering") - .add(FILTERING_FILTERING) - .add(FILTERING_ADVANCED); - OptionCategory LIST = make("list") - .add(LIST_ENTRIES) - .add(LIST_COLLAPSIBLE_GROUPS); + OptionCategory CHEATS = make("cheats") + .add(CHEATS_CHEATS) + .add(CHEATS_ADVANCED); + OptionCategory PERFORMANCE = make("performance") + .add(PERFORMANCE_RENDERING) + .add(PERFORMANCE_RELOAD); OptionCategory DEBUG = make("debug") .add(DEBUG_PERFORMANCE); OptionCategory FLAGS = make("flags"); @@ -77,15 +78,15 @@ public interface AllREIConfigCategories { .add(RESET_RESET); List<OptionCategory> CATEGORIES = ImmutableList.of( APPEARANCE, - KEYBINDS, - CHEATS, + INPUT, LAYOUT, ACCESSIBILITY, - FAVORITES, - PERFORMANCE, - SEARCH, FILTERING, LIST, + FAVORITES, + SEARCH, + CHEATS, + PERFORMANCE, DEBUG, // FLAGS, RESET diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigGroups.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigGroups.java index 9176c34c9..32e2a002d 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigGroups.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigGroups.java @@ -39,7 +39,7 @@ public interface AllREIConfigGroups { OptionGroup APPEARANCE_TOOLTIPS = make("appearance.tooltips") .add(APPEND_MOD_NAMES) .add(APPEND_FAVORITES_HINT); - OptionGroup KEYBINDS_KEYBINDS = make("keybinds.keybinds") + OptionGroup INPUT_KEYBINDS = make("input.keybinds") .add(RECIPE_KEYBIND) .add(USAGE_KEYBIND) .add(HIDE_KEYBIND) @@ -50,14 +50,8 @@ public interface AllREIConfigGroups { .add(FAVORITE_KEYBIND) .add(EXPORT_IMAGE_KEYBIND) .add(BACK_KEYBIND); - OptionGroup KEYBINDS_ADVANCED = make("keybinds.advanced") + OptionGroup INPUT_ADVANCED = make("input.advanced") .add(USE_NATIVE_KEYBINDS); - OptionGroup CHEATS_CHEATS = make("cheats.cheats") - .add(CHEATS_MODE) - .add(CHEATS_METHOD) - .add(CHEATS_AMOUNT); - OptionGroup CHEATS_ADVANCED = make("cheats.advanced") - .add(GIVE_COMMAND); OptionGroup LAYOUT_WIDGETS = make("layout.widgets") .add(SEARCH_FIELD_LOCATION) .add(CONFIG_BUTTON_LOCATION) @@ -76,6 +70,19 @@ public interface AllREIConfigGroups { .add(VANILLA_RECIPE_BOOK) .add(STATUS_EFFECTS_LOCATION) .add(INVENTORY_SEARCH); + OptionGroup FILTERING_FILTERING = make("filtering.filtering") + .add(CATEGORIES) + .add(CUSTOMIZED_FILTERING); + OptionGroup FILTERING_ADVANCED = make("filtering.advanced") + .add(FILTER_DISPLAYS) + .add(MERGE_DISPLAYS); + OptionGroup LIST_ENTRIES = make("list.entries") + .add(DISPLAY_MODE) + .add(ORDERING) + .add(ZOOM) + .add(FOCUS_MODE); + OptionGroup LIST_COLLAPSIBLE_GROUPS = make("list.collapsible_groups") + .add(COLLAPSIBLE_ENTRIES); OptionGroup FAVORITES_FAVORITES = make("favorites.favorites") .add(FAVORITES_MODE) .add(NEW_FAVORITES_BUTTON_VISIBILITY); @@ -83,12 +90,6 @@ public interface AllREIConfigGroups { .add(GAME_MODE_COMMAND) .add(TIME_COMMAND) .add(WEATHER_COMMAND); - OptionGroup PERFORMANCE_RENDERING = make("performance.rendering") - .add(BATCHED_RENDERING) - .add(CACHED_RENDERING); - OptionGroup PERFORMANCE_RELOAD = make("performance.reload") - .add(RELOAD_THREAD) - .add(CACHED_DISPLAY_LOOKUP); OptionGroup SEARCH_APPEARANCE = make("search.appearance") .add(SYNTAX_HIGHLIGHTING); OptionGroup SEARCH_FILTERS = make("search.filters") @@ -97,19 +98,18 @@ public interface AllREIConfigGroups { .add(TAG_SEARCH) .add(IDENTIFIER_SEARCH); OptionGroup SEARCH_ADVANCED = make("search.advanced"); - OptionGroup FILTERING_FILTERING = make("filtering.filtering") - .add(CATEGORIES) - .add(CUSTOMIZED_FILTERING); - OptionGroup FILTERING_ADVANCED = make("filtering.advanced") - .add(FILTER_DISPLAYS) - .add(MERGE_DISPLAYS); - OptionGroup LIST_ENTRIES = make("list.entries") - .add(DISPLAY_MODE) - .add(ORDERING) - .add(ZOOM) - .add(FOCUS_MODE); - OptionGroup LIST_COLLAPSIBLE_GROUPS = make("list.collapsible_groups") - .add(COLLAPSIBLE_ENTRIES); + OptionGroup CHEATS_CHEATS = make("cheats.cheats") + .add(CHEATS_MODE) + .add(CHEATS_METHOD) + .add(CHEATS_AMOUNT); + OptionGroup CHEATS_ADVANCED = make("cheats.advanced") + .add(GIVE_COMMAND); + OptionGroup PERFORMANCE_RENDERING = make("performance.rendering") + .add(BATCHED_RENDERING) + .add(CACHED_RENDERING); + OptionGroup PERFORMANCE_RELOAD = make("performance.reload") + .add(RELOAD_THREAD) + .add(CACHED_DISPLAY_LOOKUP); OptionGroup DEBUG_PERFORMANCE = make("debug.performance") .add(PLUGINS_PERFORMANCE) .add(SEARCH_PERFORMANCE) diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigOptions.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigOptions.java index 3b621b5f5..704d7f0ab 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigOptions.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigOptions.java @@ -73,37 +73,29 @@ public interface AllREIConfigOptions { .enabledDisabled(); CompositeOption<Boolean> APPEND_FAVORITES_HINT = make("appearance.append_favorites_hint", i -> i.advanced.tooltips.displayFavoritesTooltip, (i, v) -> i.advanced.tooltips.displayFavoritesTooltip = v) .enabledDisabled(); - CompositeOption<ModifierKeyCode> RECIPE_KEYBIND = make("keybinds.recipe", i -> i.basics.keyBindings.recipeKeybind.copy(), (i, v) -> i.basics.keyBindings.recipeKeybind = v) + CompositeOption<ModifierKeyCode> RECIPE_KEYBIND = make("input.recipe", i -> i.basics.keyBindings.recipeKeybind.copy(), (i, v) -> i.basics.keyBindings.recipeKeybind = v) .keybind(); - CompositeOption<ModifierKeyCode> USAGE_KEYBIND = make("keybinds.usage", i -> i.basics.keyBindings.usageKeybind.copy(), (i, v) -> i.basics.keyBindings.usageKeybind = v) + CompositeOption<ModifierKeyCode> USAGE_KEYBIND = make("input.usage", i -> i.basics.keyBindings.usageKeybind.copy(), (i, v) -> i.basics.keyBindings.usageKeybind = v) .keybind(); - CompositeOption<ModifierKeyCode> HIDE_KEYBIND = make("keybinds.hide", i -> i.basics.keyBindings.hideKeybind.copy(), (i, v) -> i.basics.keyBindings.hideKeybind = v) + CompositeOption<ModifierKeyCode> HIDE_KEYBIND = make("input.hide", i -> i.basics.keyBindings.hideKeybind.copy(), (i, v) -> i.basics.keyBindings.hideKeybind = v) .keybind(); - CompositeOption<ModifierKeyCode> PREVIOUS_PAGE_KEYBIND = make("keybinds.previous_page", i -> i.basics.keyBindings.previousPageKeybind.copy(), (i, v) -> i.basics.keyBindings.previousPageKeybind = v) + CompositeOption<ModifierKeyCode> PREVIOUS_PAGE_KEYBIND = make("input.previous_page", i -> i.basics.keyBindings.previousPageKeybind.copy(), (i, v) -> i.basics.keyBindings.previousPageKeybind = v) .keybind(); - CompositeOption<ModifierKeyCode> NEXT_PAGE_KEYBIND = make("keybinds.next_page", i -> i.basics.keyBindings.nextPageKeybind.copy(), (i, v) -> i.basics.keyBindings.nextPageKeybind = v) + CompositeOption<ModifierKeyCode> NEXT_PAGE_KEYBIND = make("input.next_page", i -> i.basics.keyBindings.nextPageKeybind.copy(), (i, v) -> i.basics.keyBindings.nextPageKeybind = v) .keybind(); - CompositeOption<ModifierKeyCode> FOCUS_SEARCH_KEYBIND = make("keybinds.focus_search", i -> i.basics.keyBindings.focusSearchFieldKeybind.copy(), (i, v) -> i.basics.keyBindings.focusSearchFieldKeybind = v) + CompositeOption<ModifierKeyCode> FOCUS_SEARCH_KEYBIND = make("input.focus_search", i -> i.basics.keyBindings.focusSearchFieldKeybind.copy(), (i, v) -> i.basics.keyBindings.focusSearchFieldKeybind = v) .keybind(); - CompositeOption<ModifierKeyCode> COPY_RECIPE_ID_KEYBIND = make("keybinds.copy_recipe_id", i -> i.basics.keyBindings.copyRecipeIdentifierKeybind.copy(), (i, v) -> i.basics.keyBindings.copyRecipeIdentifierKeybind = v) + CompositeOption<ModifierKeyCode> COPY_RECIPE_ID_KEYBIND = make("input.copy_recipe_id", i -> i.basics.keyBindings.copyRecipeIdentifierKeybind.copy(), (i, v) -> i.basics.keyBindings.copyRecipeIdentifierKeybind = v) .keybind(); - CompositeOption<ModifierKeyCode> FAVORITE_KEYBIND = make("keybinds.favorite", i -> i.basics.keyBindings.favoriteKeybind.copy(), (i, v) -> i.basics.keyBindings.favoriteKeybind = v) + CompositeOption<ModifierKeyCode> FAVORITE_KEYBIND = make("input.favorite", i -> i.basics.keyBindings.favoriteKeybind.copy(), (i, v) -> i.basics.keyBindings.favoriteKeybind = v) .keybind(); - CompositeOption<ModifierKeyCode> EXPORT_IMAGE_KEYBIND = make("keybinds.export_image", i -> i.basics.keyBindings.exportImageKeybind.copy(), (i, v) -> i.basics.keyBindings.exportImageKeybind = v) + CompositeOption<ModifierKeyCode> EXPORT_IMAGE_KEYBIND = make("input.export_image", i -> i.basics.keyBindings.exportImageKeybind.copy(), (i, v) -> i.basics.keyBindings.exportImageKeybind = v) .keybind(); - CompositeOption<ModifierKeyCode> BACK_KEYBIND = make("keybinds.back", i -> i.basics.keyBindings.previousScreenKeybind.copy(), (i, v) -> i.basics.keyBindings.previousScreenKeybind = v) + CompositeOption<ModifierKeyCode> BACK_KEYBIND = make("input.back", i -> i.basics.keyBindings.previousScreenKeybind.copy(), (i, v) -> i.basics.keyBindings.previousScreenKeybind = v) .keybind(); // TODO: NATIVE KEYBINDS - CompositeOption<Boolean> USE_NATIVE_KEYBINDS = make("keybinds.use_native_keybinds", i -> i.basics.keyBindings.useNativeKeybinds, (i, v) -> i.basics.keyBindings.useNativeKeybinds = v) + CompositeOption<Boolean> USE_NATIVE_KEYBINDS = make("input.use_native_keybinds", i -> i.basics.keyBindings.useNativeKeybinds, (i, v) -> i.basics.keyBindings.useNativeKeybinds = v) .enabledDisabled(); - CompositeOption<CheatingMode> CHEATS_MODE = make("cheats.mode", i -> i.basics.cheating, (i, v) -> i.basics.cheating = v) - .enumOptions(); - CompositeOption<ItemCheatingStyle> CHEATS_METHOD = make("cheats.method", i -> i.basics.cheatingStyle, (i, v) -> i.basics.cheatingStyle = v) - .enumOptions(); - CompositeOption<ItemCheatingMode> CHEATS_AMOUNT = make("cheats.amount", i -> i.functionality.itemCheatingMode, (i, v) -> i.functionality.itemCheatingMode = v) - .enumOptions(); - CompositeOption<String> GIVE_COMMAND = make("cheats.give_command", i -> i.advanced.commands.giveCommand, (i, v) -> i.advanced.commands.giveCommand = v) - .string(); CompositeOption<SearchFieldLocation> SEARCH_FIELD_LOCATION = make("layout.search_field_location", i -> i.appearance.layout.searchFieldLocation, (i, v) -> i.appearance.layout.searchFieldLocation = v) .entry(OptionValueEntry.<SearchFieldLocation>enumOptions().overrideText(location -> { if (Minecraft.getInstance().screen instanceof REIConfigScreen configScreen) { @@ -152,35 +144,6 @@ public interface AllREIConfigOptions { .ofBoolean(translatable("config.rei.value.accessibility.status_effects_location.right"), translatable("config.rei.value.accessibility.status_effects_location.left")); CompositeOption<Boolean> INVENTORY_SEARCH = make("accessibility.inventory_search", i -> i.functionality.allowInventoryHighlighting, (i, v) -> i.functionality.allowInventoryHighlighting = v) .enabledDisabled(); - CompositeOption<Boolean> FAVORITES_MODE = make("favorites.mode", i -> i.basics.favoritesEnabled, (i, v) -> i.basics.favoritesEnabled = v) - .enabledDisabled(); - CompositeOption<FavoriteAddWidgetMode> NEW_FAVORITES_BUTTON_VISIBILITY = make("favorites.new_favorites_button_visibility", i -> i.advanced.layout.favoriteAddWidgetMode, (i, v) -> i.advanced.layout.favoriteAddWidgetMode = v) - .enumOptions(); - CompositeOption<String> GAME_MODE_COMMAND = make("favorites.game_mode_command", i -> i.advanced.commands.gamemodeCommand, (i, v) -> i.advanced.commands.gamemodeCommand = v) - .string(); - CompositeOption<String> TIME_COMMAND = make("favorites.time_command", i -> i.advanced.commands.timeCommand, (i, v) -> i.advanced.commands.timeCommand = v) - .string(); - CompositeOption<String> WEATHER_COMMAND = make("favorites.weather_command", i -> i.advanced.commands.weatherCommand, (i, v) -> i.advanced.commands.weatherCommand = v) - .string(); - CompositeOption<Boolean> BATCHED_RENDERING = make("performance.batched_rendering", i -> i.advanced.miscellaneous.newFastEntryRendering, (i, v) -> i.advanced.miscellaneous.newFastEntryRendering = v) - .enabledDisabled(); - CompositeOption<Boolean> CACHED_RENDERING = make("performance.cached_rendering", i -> i.advanced.miscellaneous.cachingFastEntryRendering, (i, v) -> i.advanced.miscellaneous.cachingFastEntryRendering = v) - .enabledDisabled(); - CompositeOption<Boolean> RELOAD_THREAD = make("performance.reload_thread", i -> i.advanced.miscellaneous.registerRecipesInAnotherThread, (i, v) -> i.advanced.miscellaneous.registerRecipesInAnotherThread = v) - .ofBoolean(translatable("config.rei.values.performance.reload_thread.main_thread"), translatable("config.rei.values.performance.reload_thread.rei_thread")); - CompositeOption<Boolean> CACHED_DISPLAY_LOOKUP = make("performance.cached_display_lookup", i -> i.advanced.miscellaneous.cachingDisplayLookup, (i, v) -> i.advanced.miscellaneous.cachingDisplayLookup = v) - .enabledDisabled(); - CompositeOption<SyntaxHighlightingMode> SYNTAX_HIGHLIGHTING = make("search.syntax_highlighting", i -> i.appearance.syntaxHighlightingMode, (i, v) -> i.appearance.syntaxHighlightingMode = v) - .enumOptions(); - CompositeOption<SearchMode> MOD_SEARCH = make("search.mod_search", i -> i.advanced.search.modSearch, (i, v) -> i.advanced.search.modSearch = v) - .enumOptions(); - CompositeOption<SearchMode> TOOLTIP_SEARCH = make("search.tooltip_search", i -> i.advanced.search.tooltipSearch, (i, v) -> i.advanced.search.tooltipSearch = v) - .enumOptions(); - CompositeOption<SearchMode> TAG_SEARCH = make("search.tag_search", i -> i.advanced.search.tagSearch, (i, v) -> i.advanced.search.tagSearch = v) - .enumOptions(); - CompositeOption<SearchMode> IDENTIFIER_SEARCH = make("search.identifier_search", i -> i.advanced.search.identifierSearch, (i, v) -> i.advanced.search.identifierSearch = v) - .enumOptions(); - // TODO: ASYNC_SEARCH CompositeOption<ConfigureCategoriesScreen> CATEGORIES = make("filtering.categories", i -> { return new ConfigureCategoriesScreen( new HashMap<>(i.getFilteringQuickCraftCategories()), @@ -236,6 +199,43 @@ public interface AllREIConfigOptions { }).configure((access, option, onClose) -> { Minecraft.getInstance().setScreen(new CollapsibleEntriesScreen(onClose, access.get(option))); }).requiresLevel(); + CompositeOption<Boolean> FAVORITES_MODE = make("favorites.mode", i -> i.basics.favoritesEnabled, (i, v) -> i.basics.favoritesEnabled = v) + .enabledDisabled(); + CompositeOption<FavoriteAddWidgetMode> NEW_FAVORITES_BUTTON_VISIBILITY = make("favorites.new_favorites_button_visibility", i -> i.advanced.layout.favoriteAddWidgetMode, (i, v) -> i.advanced.layout.favoriteAddWidgetMode = v) + .enumOptions(); + CompositeOption<String> GAME_MODE_COMMAND = make("favorites.game_mode_command", i -> i.advanced.commands.gamemodeCommand, (i, v) -> i.advanced.commands.gamemodeCommand = v) + .string(); + CompositeOption<String> TIME_COMMAND = make("favorites.time_command", i -> i.advanced.commands.timeCommand, (i, v) -> i.advanced.commands.timeCommand = v) + .string(); + CompositeOption<String> WEATHER_COMMAND = make("favorites.weather_command", i -> i.advanced.commands.weatherCommand, (i, v) -> i.advanced.commands.weatherCommand = v) + .string(); + CompositeOption<SyntaxHighlightingMode> SYNTAX_HIGHLIGHTING = make("search.syntax_highlighting", i -> i.appearance.syntaxHighlightingMode, (i, v) -> i.appearance.syntaxHighlightingMode = v) + .enumOptions(); + CompositeOption<SearchMode> MOD_SEARCH = make("search.mod_search", i -> i.advanced.search.modSearch, (i, v) -> i.advanced.search.modSearch = v) + .enumOptions(); + CompositeOption<SearchMode> TOOLTIP_SEARCH = make("search.tooltip_search", i -> i.advanced.search.tooltipSearch, (i, v) -> i.advanced.search.tooltipSearch = v) + .enumOptions(); + CompositeOption<SearchMode> TAG_SEARCH = make("search.tag_search", i -> i.advanced.search.tagSearch, (i, v) -> i.advanced.search.tagSearch = v) + .enumOptions(); + CompositeOption<SearchMode> IDENTIFIER_SEARCH = make("search.identifier_search", i -> i.advanced.search.identifierSearch, (i, v) -> i.advanced.search.identifierSearch = v) + .enumOptions(); + // TODO: ASYNC_SEARCH + CompositeOption<CheatingMode> CHEATS_MODE = make("cheats.mode", i -> i.basics.cheating, (i, v) -> i.basics.cheating = v) + .enumOptions(); + CompositeOption<ItemCheatingStyle> CHEATS_METHOD = make("cheats.method", i -> i.basics.cheatingStyle, (i, v) -> i.basics.cheatingStyle = v) + .enumOptions(); + CompositeOption<ItemCheatingMode> CHEATS_AMOUNT = make("cheats.amount", i -> i.functionality.itemCheatingMode, (i, v) -> i.functionality.itemCheatingMode = v) + .enumOptions(); + CompositeOption<String> GIVE_COMMAND = make("cheats.give_command", i -> i.advanced.commands.giveCommand, (i, v) -> i.advanced.commands.giveCommand = v) + .string(); + CompositeOption<Boolean> BATCHED_RENDERING = make("performance.batched_rendering", i -> i.advanced.miscellaneous.newFastEntryRendering, (i, v) -> i.advanced.miscellaneous.newFastEntryRendering = v) + .enabledDisabled(); + CompositeOption<Boolean> CACHED_RENDERING = make("performance.cached_rendering", i -> i.advanced.miscellaneous.cachingFastEntryRendering, (i, v) -> i.advanced.miscellaneous.cachingFastEntryRendering = v) + .enabledDisabled(); + CompositeOption<Boolean> RELOAD_THREAD = make("performance.reload_thread", i -> i.advanced.miscellaneous.registerRecipesInAnotherThread, (i, v) -> i.advanced.miscellaneous.registerRecipesInAnotherThread = v) + .ofBoolean(translatable("config.rei.values.performance.reload_thread.main_thread"), translatable("config.rei.values.performance.reload_thread.rei_thread")); + CompositeOption<Boolean> CACHED_DISPLAY_LOOKUP = make("performance.cached_display_lookup", i -> i.advanced.miscellaneous.cachingDisplayLookup, (i, v) -> i.advanced.miscellaneous.cachingDisplayLookup = v) + .enabledDisabled(); CompositeOption<Object> PLUGINS_PERFORMANCE = make("debug.plugins_performance", i -> null, (i, v) -> new Object()) .details((access, option, onClose) -> Minecraft.getInstance().setScreen(new PerformanceScreen(onClose))) .requiresLevel(); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/OptionCategory.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/OptionCategory.java index 67dd5ef12..5a9eaaf6a 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/OptionCategory.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/OptionCategory.java @@ -32,15 +32,17 @@ import java.util.List; public class OptionCategory { private final ResourceLocation icon; private final Component name; + private final Component description; private final List<OptionGroup> groups = new ArrayList<>(); - private OptionCategory(ResourceLocation icon, Component name) { + private OptionCategory(ResourceLocation icon, Component name, Component description) { this.icon = icon; this.name = name; + this.description = description; } - public static OptionCategory of(ResourceLocation icon, Component name) { - return new OptionCategory(icon, name); + public static OptionCategory of(ResourceLocation icon, Component name, Component description) { + return new OptionCategory(icon, name, description); } public OptionCategory add(OptionGroup group) { @@ -56,12 +58,16 @@ public class OptionCategory { return name; } + public Component getDescription() { + return description; + } + public List<OptionGroup> getGroups() { return groups; } public OptionCategory copy() { - OptionCategory category = new OptionCategory(icon, name); + OptionCategory category = new OptionCategory(icon, name, description); for (OptionGroup group : groups) { category.add(group.copy()); } diff --git a/runtime/src/main/resources/assets/roughlyenoughitems/lang/en_us.json b/runtime/src/main/resources/assets/roughlyenoughitems/lang/en_us.json index 7a408b64b..4937b183d 100755 --- a/runtime/src/main/resources/assets/roughlyenoughitems/lang/en_us.json +++ b/runtime/src/main/resources/assets/roughlyenoughitems/lang/en_us.json @@ -231,15 +231,21 @@ "_comment": "Config Tooltips", "config.roughlyenoughitems.title": "Roughly Enough Items Config", "config.rei.categories.appearance": "Appearance", - "config.rei.categories.keybinds": "Keybinds", - "config.rei.categories.cheats": "Cheats", + "config.rei.categories.appearance.desc": "Interface theming, style, tooltips", + "config.rei.categories.input": "Input", + "config.rei.categories.input.desc": "Keybindings, input methods", "config.rei.categories.layout": "Layout", + "config.rei.categories.layout.desc": "Widgets, boundaries", "config.rei.categories.accessibility": "Accessibility", - "config.rei.categories.favorites": "Favorites", - "config.rei.categories.performance": "Performance", - "config.rei.categories.search": "Search", + "config.rei.categories.accessibility.desc": "Vision, features", "config.rei.categories.filtering": "Filtering", + "config.rei.categories.filtering.desc": "Categories, entries filtering", "config.rei.categories.list": "List", + "config.rei.categories.list.desc": "List order, zoom, collapsible groups", + "config.rei.categories.favorites": "Favorites", + "config.rei.categories.search": "Search", + "config.rei.categories.cheats": "Cheats", + "config.rei.categories.performance": "Performance", "config.rei.categories.debug": "Debug", "config.rei.categories.flags": "Feature Flags", "config.rei.categories.reset": "Reload & Reset", @@ -264,23 +270,23 @@ "config.rei.options.appearance.append_mod_names.desc": "Appends the containing namespace for entries. The appended line will be in italisised light blue.", "config.rei.options.appearance.append_favorites_hint": "Append Favorites Hint", "config.rei.options.appearance.append_favorites_hint.desc": "Shows a hint on how to favorite an entry, or a recipe.", - "config.rei.options.groups.keybinds.keybinds": "Keybinds", - "config.rei.options.keybinds.recipe": "View Recipes", - "config.rei.options.keybinds.usage": "View Usages", - "config.rei.options.keybinds.hide": "Show / Hide REI", - "config.rei.options.keybinds.previous_page": "Navigate to Previous Page", - "config.rei.options.keybinds.next_page": "Navigate to Next Page", - "config.rei.options.keybinds.focus_search": "Focus Search Field", - "config.rei.options.keybinds.copy_recipe_id": "Copy Recipe Identifier", - "config.rei.options.keybinds.copy_recipe_id.desc": "Copy a recipe's identifier by pressing the keybind, while hovering over a recipe's info button (shown with \"+\", or \"?\").", - "config.rei.options.keybinds.favorite": "Favorite Entry", - "config.rei.options.keybinds.export_image": "Export Image", - "config.rei.options.keybinds.export_image.desc": "Export a recipe as an image by pressing the keybind, while hovering over a recipe.", - "config.rei.options.keybinds.back": "Back", - "config.rei.options.keybinds.back.desc": "Quickly navigate back to the previous recipes by pressing the keybind.", - "config.rei.options.groups.keybinds.advanced": "Advanced", - "config.rei.options.keybinds.use_native_keybinds": "Use Native Keybinds", - "config.rei.options.keybinds.use_native_keybinds.desc": "Instead of listing the keybindings in this configuration menu, create vanilla Minecraft-like keybinds in the Controls screen. Restarting Minecraft is required to disable this option.\nNote that Minecraft-like keybinds suffer from conflicts and lack of support for modifier keys (Fabric).", + "config.rei.options.groups.input.keybinds": "Keybinds", + "config.rei.options.input.recipe": "View Recipes", + "config.rei.options.input.usage": "View Usages", + "config.rei.options.input.hide": "Show / Hide REI", + "config.rei.options.input.previous_page": "Navigate to Previous Page", + "config.rei.options.input.next_page": "Navigate to Next Page", + "config.rei.options.input.focus_search": "Focus Search Field", + "config.rei.options.input.copy_recipe_id": "Copy Recipe Identifier", + "config.rei.options.input.copy_recipe_id.desc": "Copy a recipe's identifier by pressing the keybind, while hovering over a recipe's info button (shown with \"+\", or \"?\").", + "config.rei.options.input.favorite": "Favorite Entry", + "config.rei.options.input.export_image": "Export Image", + "config.rei.options.input.export_image.desc": "Export a recipe as an image by pressing the keybind, while hovering over a recipe.", + "config.rei.options.input.back": "Back", + "config.rei.options.input.back.desc": "Quickly navigate back to the previous recipes by pressing the keybind.", + "config.rei.options.groups.input.advanced": "Advanced", + "config.rei.options.input.use_native_keybinds": "Use Native Keybinds", + "config.rei.options.input.use_native_keybinds.desc": "Instead of listing the keybindings in this configuration menu, create vanilla Minecraft-like keybinds in the Controls screen. Restarting Minecraft is required to disable this option.\nNote that Minecraft-like keybinds suffer from conflicts and lack of support for modifier keys (Fabric).", "config.rei.options.groups.cheats.cheats": "Cheats", "config.rei.options.cheats.mode": "Mode", "config.rei.options.cheats.mode.desc": "Cheats mode allows you to grab items from the side. This requires operator permission. The /give command would be used as a fallback if REI is not installed on the server.", diff --git a/runtime/src/main/resources/assets/roughlyenoughitems/textures/gui/config/keybinds.png b/runtime/src/main/resources/assets/roughlyenoughitems/textures/gui/config/input.png Binary files differindex beec65770..beec65770 100644 --- a/runtime/src/main/resources/assets/roughlyenoughitems/textures/gui/config/keybinds.png +++ b/runtime/src/main/resources/assets/roughlyenoughitems/textures/gui/config/input.png |
