Skip to content

Commit

Permalink
Add the options
Browse files Browse the repository at this point in the history
  • Loading branch information
shedaniel committed Sep 25, 2023
1 parent 2e9bee0 commit 54e3ba5
Show file tree
Hide file tree
Showing 7 changed files with 307 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ public enum FavoriteAddWidgetMode {

@Override
public String toString() {
return I18n.get("config.roughlyenoughitems.layout.favoriteAddWidgetMode." + name().toLowerCase(Locale.ROOT));
return I18n.get("config.rei.value.favorites.new_favorites_button_visibility." + name().toLowerCase(Locale.ROOT));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,8 @@ public static class Basics {
}

public static class KeyBindings {
@ConfigEntry.Gui.Excluded
public boolean useNativeKeybinds;
public ModifierKeyCode recipeKeybind = ModifierKeyCode.of(InputConstants.Type.KEYSYM.getOrCreate(InputConstants.KEY_R), Modifier.none());
public ModifierKeyCode usageKeybind = ModifierKeyCode.of(InputConstants.Type.KEYSYM.getOrCreate(InputConstants.KEY_U), Modifier.none());
public ModifierKeyCode hideKeybind = ModifierKeyCode.of(InputConstants.Type.KEYSYM.getOrCreate(InputConstants.KEY_O), Modifier.of(false, true, false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import java.util.List;

import static me.shedaniel.rei.impl.client.gui.config.options.AllREIConfigGroups.*;
import static me.shedaniel.rei.impl.client.gui.config.options.ConfigUtils.translatable;

public interface AllREIConfigCategories {
Expand All @@ -37,19 +38,41 @@ static OptionCategory make(String key) {
}

OptionCategory APPEARANCE = make("appearance")
.add(AllREIConfigGroups.INTERFACE);
OptionCategory KEYBINDS = make("keybinds");
OptionCategory CHEATS = make("cheats");
OptionCategory LAYOUT = make("layout");
OptionCategory ACCESSIBILITY = make("accessibility");
OptionCategory FAVORITES = make("favorites");
OptionCategory PERFORMANCE = make("performance");
OptionCategory SEARCH = make("search");
OptionCategory FILTERING = make("filtering");
OptionCategory LIST = make("list");
OptionCategory DEBUG = make("debug");
.add(APPEARANCE_INTERFACE)
.add(APPEARANCE_TOOLTIPS);
OptionCategory KEYBINDS = make("keybinds")
.add(KEYBINDS_KEYBINDS)
.add(KEYBINDS_ADVANCED);
OptionCategory CHEATS = make("cheats")
.add(CHEATS_CHEATS)
.add(CHEATS_ADVANCED);
OptionCategory LAYOUT = make("layout")
.add(LAYOUT_WIDGETS)
.add(LAYOUT_PANEL);
OptionCategory ACCESSIBILITY = make("accessibility")
.add(ACCESSIBILITY_DISPLAY)
.add(ACCESSIBILITY_WIDGETS);
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);
OptionCategory DEBUG = make("debug")
.add(DEBUG_PERFORMANCE);
OptionCategory FLAGS = make("flags");
OptionCategory RESET = make("reset");
OptionCategory RESET = make("reset")
.add(RESET_RELOAD)
.add(RESET_RESET);
List<OptionCategory> CATEGORIES = ImmutableList.of(
APPEARANCE,
KEYBINDS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,75 @@

package me.shedaniel.rei.impl.client.gui.config.options;

import static me.shedaniel.rei.impl.client.gui.config.options.AllREIConfigOptions.*;
import static me.shedaniel.rei.impl.client.gui.config.options.ConfigUtils.translatable;

interface AllREIConfigGroups {
static <T> OptionGroup make(String id) {
return new OptionGroup(translatable("config.rei.options.groups." + id));
}

OptionGroup INTERFACE = make("interface");
OptionGroup APPEARANCE_INTERFACE = make("appearance.interface")
.add(THEME)
.add(RECIPE_BORDER)
.add(REDUCED_MOTION)
.add(RECIPE_LOOKUP_STYLE);
OptionGroup APPEARANCE_TOOLTIPS = make("appearance.tooltips")
.add(APPEND_MOD_NAMES)
.add(APPEND_FAVORITES_HINT);
OptionGroup KEYBINDS_KEYBINDS = make("keybinds.keybinds");
OptionGroup KEYBINDS_ADVANCED = make("keybinds.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)
.add(CRAFTABLE_FILTER);
OptionGroup LAYOUT_PANEL = make("layout.panel")
.add(BOUNDARIES);
OptionGroup ACCESSIBILITY_DISPLAY = make("accessibility.display")
.add(LARGER_TABS)
.add(LARGER_ARROW_BUTTONS);
OptionGroup ACCESSIBILITY_WIDGETS = make("accessibility.widgets")
.add(SCROLLBAR_VISIBILITY)
.add(CLICKABLE_RECIPE_ARROWS);
OptionGroup FAVORITES_FAVORITES = make("favorites.favorites")
.add(FAVORITES_MODE)
.add(NEW_FAVORITES_BUTTON_VISIBILITY);
OptionGroup FAVORITES_ADVANCED = make("favorites.advanced")
.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")
.add(MOD_SEARCH)
.add(TOOLTIP_SEARCH)
.add(TAG_SEARCH)
.add(IDENTIFIER_SEARCH);
OptionGroup SEARCH_ADVANCED = make("search.advanced");
OptionGroup FILTERING_FILTERING = make("filtering.filtering");
OptionGroup FILTERING_ADVANCED = make("filtering.advanced")
.add(FILTER_DISPLAYS);
OptionGroup LIST_ENTRIES = make("list.entries")
.add(DISPLAY_MODE)
.add(ORDERING)
.add(ZOOM)
.add(FOCUS_MODE);
OptionGroup DEBUG_PERFORMANCE = make("debug.performance")
.add(SEARCH_PERFORMANCE)
.add(ENTRY_LIST_PERFORMANCE);
OptionGroup RESET_RELOAD = make("reset.reload");
OptionGroup RESET_RESET = make("reset.reset");
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,86 @@ static <T> CompositeOption<T> make(String id, Function<ConfigObjectImpl, T> bind
translatable("config.rei.options." + id + ".desc"), bind);
}

CompositeOption<CheatingMode> CHEATING_MODE = make("cheating_mode", i -> i.basics.cheating, (i, v) -> i.basics.cheating = v)
CompositeOption<AppearanceTheme> THEME = make("appearance.theme", i -> i.appearance.theme, (i, v) -> i.appearance.theme = v)
.enumOptions();
CompositeOption<Boolean> FAVORITES = make("favorites", i -> i.basics.favoritesEnabled, (i, v) -> i.basics.favoritesEnabled = v)
CompositeOption<RecipeBorderType> RECIPE_BORDER = make("appearance.recipe_border", i -> i.appearance.recipeBorder, (i, v) -> i.appearance.recipeBorder = v)
.enumOptions();
CompositeOption<Boolean> REDUCED_MOTION = make("appearance.reduced_motion", i -> i.basics.reduceMotion, (i, v) -> i.basics.reduceMotion = v)
.enabledDisabled();
CompositeOption<DisplayScreenType> RECIPE_LOOKUP_STYLE = make("appearance.recipe_lookup_style", i -> i.appearance.recipeScreenType, (i, v) -> i.appearance.recipeScreenType = v)
.enumOptions();
CompositeOption<Boolean> APPEND_MOD_NAMES = make("appearance.append_mod_names", i -> i.advanced.tooltips.appendModNames, (i, v) -> i.advanced.tooltips.appendModNames = v)
.enabledDisabled();
CompositeOption<Boolean> APPEND_FAVORITES_HINT = make("appearance.append_favorites_hint", i -> i.advanced.tooltips.displayFavoritesTooltip, (i, v) -> i.advanced.tooltips.displayFavoritesTooltip = v)
.enabledDisabled();
// 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)
.enabledDisabled();
CompositeOption<CheatingMode> CHEATS_MODE = make("cheats.cheats", 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);
CompositeOption<SearchFieldLocation> SEARCH_FIELD_LOCATION = make("layout.search_field_location", i -> i.appearance.layout.searchFieldLocation, (i, v) -> i.appearance.layout.searchFieldLocation = v)
.enumOptions();
CompositeOption<ConfigButtonPosition> CONFIG_BUTTON_LOCATION = make("layout.config_button_location", i -> i.appearance.layout.configButtonLocation, (i, v) -> i.appearance.layout.configButtonLocation = v)
.enumOptions();
CompositeOption<Boolean> CRAFTABLE_FILTER = make("layout.craftable_filter", i -> i.appearance.layout.showCraftableOnlyButton, (i, v) -> i.appearance.layout.showCraftableOnlyButton = v)
.enabledDisabled();
CompositeOption<Boolean> REDUCED_MOTION = make("reduced_motion", i -> i.basics.reduceMotion, (i, v) -> i.basics.reduceMotion = v)
.trueFalse();
CompositeOption<ItemCheatingStyle> CHEATING_STYLE = make("cheating_style", i -> i.basics.cheatingStyle, (i, v) -> i.basics.cheatingStyle = v)
// TODO: BOUNDARIES
CompositeOption<Boolean> BOUNDARIES = make("layout.boundaries", i -> true, (i, v) -> {
});
CompositeOption<Boolean> LARGER_TABS = make("accessibility.larger_tabs", i -> !i.advanced.accessibility.useCompactTabs, (i, v) -> i.advanced.accessibility.useCompactTabs = !v)
.enabledDisabled();
CompositeOption<Boolean> LARGER_ARROW_BUTTONS = make("accessibility.larger_arrow_buttons", i -> !i.advanced.accessibility.useCompactTabButtons, (i, v) -> i.advanced.accessibility.useCompactTabButtons = !v)
.enabledDisabled();
CompositeOption<Boolean> SCROLLBAR_VISIBILITY = make("accessibility.scrollbar_visibility", i -> i.advanced.accessibility.compositeScrollBarPermanent, (i, v) -> i.advanced.accessibility.compositeScrollBarPermanent = v)
.ofBoolean(translatable("config.rei.value.accessibility.scrollbar_visibility.when_scrolling"), translatable("config.rei.value.accessibility.scrollbar_visibility.always"));
CompositeOption<Boolean> CLICKABLE_RECIPE_ARROWS = make("accessibility.clickable_recipe_arrows", i -> i.advanced.miscellaneous.clickableRecipeArrows, (i, v) -> i.advanced.miscellaneous.clickableRecipeArrows = 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<DisplayScreenType> DISPLAY_SCREEN_TYPE = make("display_screen_type", i -> i.appearance.recipeScreenType, (i, v) -> i.appearance.recipeScreenType = v)
CompositeOption<String> GAME_MODE_COMMAND = make("favorites.game_mode_command", i -> i.advanced.commands.gamemodeCommand, (i, v) -> i.advanced.commands.gamemodeCommand = v);
CompositeOption<String> TIME_COMMAND = make("favorites.time_command", i -> i.advanced.commands.timeCommand, (i, v) -> i.advanced.commands.timeCommand = v);
CompositeOption<String> WEATHER_COMMAND = make("favorites.weather_command", i -> i.advanced.commands.weatherCommand, (i, v) -> i.advanced.commands.weatherCommand = v);
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<AppearanceTheme> THEME = make("theme", i -> i.appearance.theme, (i, v) -> i.appearance.theme = v)
CompositeOption<SearchMode> TOOLTIP_SEARCH = make("search.tooltip_search", i -> i.advanced.search.tooltipSearch, (i, v) -> i.advanced.search.tooltipSearch = v)
.enumOptions();
CompositeOption<SearchFieldLocation> SEARCH_FIELD_LOCATION = make("search_field_location", i -> i.appearance.layout.searchFieldLocation, (i, v) -> i.appearance.layout.searchFieldLocation = v)
CompositeOption<SearchMode> TAG_SEARCH = make("search.tag_search", i -> i.advanced.search.tagSearch, (i, v) -> i.advanced.search.tagSearch = v)
.enumOptions();
CompositeOption<ConfigButtonPosition> CONFIG_BUTTON_LOCATION = make("config_button_location", i -> i.appearance.layout.configButtonLocation, (i, v) -> i.appearance.layout.configButtonLocation = v)
CompositeOption<SearchMode> IDENTIFIER_SEARCH = make("search.identifier_search", i -> i.advanced.search.identifierSearch, (i, v) -> i.advanced.search.identifierSearch = v)
.enumOptions();
CompositeOption<Boolean> CRAFTABLE_FILTER = make("craftable_filter", i -> i.appearance.layout.showCraftableOnlyButton, (i, v) -> i.appearance.layout.showCraftableOnlyButton = v)
// TODO: ASYNC_SEARCH
// TODO: CUSTOMIZED_FILTERING
CompositeOption<Boolean> FILTER_DISPLAYS = make("filtering.filter_displays", i -> i.advanced.filtering.shouldFilterDisplays, (i, v) -> i.advanced.filtering.shouldFilterDisplays = v)
.enabledDisabled();
CompositeOption<Boolean> DISPLAY_MODE = make("list.display_mode", i -> i.appearance.scrollingEntryListWidget, (i, v) -> i.appearance.scrollingEntryListWidget = v)
.ofBoolean(translatable("config.rei.value.list.display_mode.paginated"), translatable("config.rei.value.list.display_mode.scrolled"));
CompositeOption<EntryPanelOrderingConfig> ORDERING = make("list.ordering", i -> i.advanced.layout.entryPanelOrdering, (i, v) -> i.advanced.layout.entryPanelOrdering = v)
.enumOptions();
CompositeOption<Double> ZOOM = make("list.zoom", i -> i.advanced.accessibility.entrySize, (i, v) -> i.advanced.accessibility.entrySize = v);
CompositeOption<Boolean> FOCUS_MODE = make("list.focus_mode", i -> i.appearance.isFocusModeZoomed, (i, v) -> i.appearance.isFocusModeZoomed = v)
.ofBoolean(translatable("config.rei.value.list.focus_mode.highlighted"), translatable("config.rei.value.list.focus_mode.zoomed"));
// TODO: PLUGINS_PERFORMANCE
CompositeOption<Boolean> SEARCH_PERFORMANCE = make("debug.search_performance", i -> i.advanced.search.debugSearchTimeRequired, (i, v) -> i.advanced.search.debugSearchTimeRequired = v)
.enabledDisabled();
CompositeOption<Boolean> ENTRY_LIST_PERFORMANCE = make("debug.entry_list_performance", i -> i.advanced.layout.debugRenderTimeRequired, (i, v) -> i.advanced.layout.debugRenderTimeRequired = v)
.enabledDisabled();
// TODO: RELOAD
// TODO: RESET
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@

public class OptionGroup {
private final Component groupName;
private final List<CompositeOption> options = new ArrayList<>();
private final List<CompositeOption<?>> options = new ArrayList<>();

public OptionGroup(Component groupName) {
this.groupName = groupName;
}

public OptionGroup add(CompositeOption option) {
public OptionGroup add(CompositeOption<?> option) {
this.options.add(option);
return this;
}
Expand Down
Loading

0 comments on commit 54e3ba5

Please sign in to comment.