Skip to content

Commit 719c00e

Browse files
committed
Localize Configs
1 parent 8faf35d commit 719c00e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1446
-1468
lines changed

Common/src/main/java/mezz/jei/common/config/ClientConfig.java

Lines changed: 39 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public final class ClientConfig implements IClientConfig {
2525
// cheat_mode
2626
private final Supplier<GiveMode> giveMode;
2727
private final Supplier<Boolean> cheatToHotbarUsingHotkeysEnabled;
28-
private final Supplier<Boolean> showHiddenItemsEnabled;
28+
private final Supplier<Boolean> showHiddenIngredients;
2929

3030
// bookmarks
3131
private final Supplier<Boolean> addBookmarksToFrontEnabled;
@@ -51,139 +51,77 @@ public final class ClientConfig implements IClientConfig {
5151

5252
// tags
5353
private final Supplier<Boolean> tagContentTooltipEnabled;
54-
private final Supplier<Boolean> hideSingleIngredientTagsEnabled;
54+
private final Supplier<Boolean> hideSingleTagContentTooltipEnabled;
5555

5656
public ClientConfig(IConfigSchemaBuilder schema) {
5757
instance = this;
5858

5959
boolean isDev = Services.PLATFORM.getModHelper().isInDev();
6060

6161
IConfigCategoryBuilder appearance = schema.addCategory("appearance");
62-
centerSearchBarEnabled = appearance.addBoolean(
63-
"CenterSearch",
64-
defaultCenterSearchBar,
65-
"Move the JEI search bar to the bottom center of the screen."
66-
);
62+
centerSearchBarEnabled = appearance.addBoolean("centerSearch", defaultCenterSearchBar );
6763
maxRecipeGuiHeight = appearance.addInteger(
68-
"RecipeGuiHeight",
64+
"recipeGuiHeight",
6965
defaultRecipeGuiHeight,
7066
minRecipeGuiHeight,
71-
Integer.MAX_VALUE,
72-
"Max recipe GUI height."
67+
Integer.MAX_VALUE
7368
);
7469

75-
IConfigCategoryBuilder cheatMode = schema.addCategory("cheat_mode");
76-
giveMode = cheatMode.addEnum(
77-
"GiveMode",
78-
GiveMode.defaultGiveMode,
79-
"Choose if JEI should give ingredients directly to the inventory or pick them up with the mouse."
80-
);
81-
cheatToHotbarUsingHotkeysEnabled = cheatMode.addBoolean(
82-
"CheatToHotbarUsingHotkeysEnabled",
83-
false,
84-
"Enable cheating items into the hotbar by using Shift + numeric keys."
85-
);
86-
showHiddenItemsEnabled = cheatMode.addBoolean(
87-
"ShowHiddenItems",
88-
false,
89-
"Enable showing items that are not in the creative menu."
90-
);
70+
IConfigCategoryBuilder cheating = schema.addCategory("cheating");
71+
giveMode = cheating.addEnum("giveMode", GiveMode.defaultGiveMode);
72+
cheatToHotbarUsingHotkeysEnabled = cheating.addBoolean("cheatToHotbarUsingHotkeysEnabled", false);
73+
showHiddenIngredients = cheating.addBoolean("showHiddenIngredients", false);
74+
showTagRecipesEnabled = cheating.addBoolean("showTagRecipesEnabled", isDev);
9175

9276
IConfigCategoryBuilder bookmarks = schema.addCategory("bookmarks");
93-
addBookmarksToFrontEnabled = bookmarks.addBoolean(
94-
"AddBookmarksToFrontEnabled",
95-
false,
96-
"Add new bookmarks to the front of the bookmark list instead of the end."
97-
);
98-
bookmarkTooltipFeatures = bookmarks.addList(
99-
"BookmarkTooltipFeatures",
77+
addBookmarksToFrontEnabled = bookmarks.addBoolean("addBookmarksToFrontEnabled", false);
78+
dragToRearrangeBookmarksEnabled = bookmarks.addBoolean("dragToRearrangeBookmarksEnabled", true);
79+
80+
IConfigCategoryBuilder tooltips = schema.addCategory("tooltips");
81+
bookmarkTooltipFeatures = tooltips.addList(
82+
"bookmarkTooltipFeatures",
10083
BookmarkTooltipFeature.DEFAULT_BOOKMARK_TOOLTIP_FEATURES,
101-
new ListSerializer<>(new EnumSerializer<>(BookmarkTooltipFeature.class)),
102-
"Extra features for bookmark tooltips."
103-
);
104-
holdShiftToShowBookmarkTooltipFeaturesEnabled = bookmarks.addBoolean(
105-
"HoldShiftToShowBookmarkTooltipFeatures",
106-
true,
107-
"Hold Shift to show bookmark tooltip features."
108-
);
109-
dragToRearrangeBookmarksEnabled = bookmarks.addBoolean(
110-
"DragToRearrangeBookmarksEnabled",
111-
true,
112-
"Drag bookmarks to rearrange them in the list."
84+
new ListSerializer<>(new EnumSerializer<>(BookmarkTooltipFeature.class))
11385
);
86+
holdShiftToShowBookmarkTooltipFeaturesEnabled = tooltips.addBoolean("holdShiftToShowBookmarkTooltipFeatures", true);
87+
showCreativeTabNamesEnabled = tooltips.addBoolean("showCreativeTabNamesEnabled", false);
88+
tagContentTooltipEnabled = tooltips.addBoolean("tagContentTooltipEnabled", true);
89+
hideSingleTagContentTooltipEnabled = tooltips.addBoolean("hideSingleTagContentTooltipEnabled", true);
90+
91+
IConfigCategoryBuilder performance = schema.addCategory("performance");
92+
lowMemorySlowSearchEnabled = performance.addBoolean("lowMemorySlowSearchEnabled", false);
93+
94+
IConfigCategoryBuilder lookups = schema.addCategory("lookups");
95+
lookupFluidContentsEnabled = lookups.addBoolean("lookupFluidContentsEnabled", false);
96+
lookupBlockTagsEnabled = lookups.addBoolean("lookupBlockTagsEnabled", true);
11497

11598
IConfigCategoryBuilder advanced = schema.addCategory("advanced");
116-
lowMemorySlowSearchEnabled = advanced.addBoolean(
117-
"LowMemorySlowSearchEnabled",
118-
false,
119-
"Set low-memory mode (makes search very slow but uses less RAM)."
120-
);
121-
catchRenderErrorsEnabled = advanced.addBoolean(
122-
"CatchRenderErrorsEnabled",
123-
!isDev,
124-
"Catch render errors from ingredients and attempt to recover from them instead of crashing."
125-
);
126-
lookupFluidContentsEnabled = advanced.addBoolean(
127-
"lookupFluidContentsEnabled",
128-
false,
129-
"When looking up recipes with items that contain fluids, also look up recipes for the fluids."
130-
);
131-
lookupBlockTagsEnabled = advanced.addBoolean(
132-
"lookupBlockTagsEnabled",
133-
true,
134-
"When searching for item tags, also include tags for the default blocks contained in the items."
135-
);
136-
showTagRecipesEnabled = advanced.addBoolean(
137-
"showTagRecipesEnabled",
138-
isDev,
139-
"Show recipes for ingredient tags like item tags and block tags."
140-
);
141-
showCreativeTabNamesEnabled = advanced.addBoolean(
142-
"showCreativeTabNamesEnabled",
143-
false,
144-
"Show creative tab names in ingredient tooltips."
145-
);
99+
catchRenderErrorsEnabled = advanced.addBoolean("catchRenderErrorsEnabled", !isDev);
146100

147101
IConfigCategoryBuilder input = schema.addCategory("input");
148102
dragDelayMs = input.addInteger(
149103
"dragDelayInMilliseconds",
150104
150,
151105
0,
152-
1000,
153-
"Number of milliseconds before a long mouse click is considered a drag operation."
106+
1000
154107
);
155108
smoothScrollRate = input.addInteger(
156109
"smoothScrollRate",
157110
9,
158111
1,
159-
50,
160-
"Scroll rate for scrolling the mouse wheel in smooth-scrolling scroll boxes. Measured in pixels."
112+
50
161113
);
162114

163115
IConfigCategoryBuilder sorting = schema.addCategory("sorting");
164116
ingredientSorterStages = sorting.addList(
165-
"IngredientSortStages",
117+
"ingredientSortStages",
166118
IngredientSortStage.defaultStages,
167-
new ListSerializer<>(new EnumSerializer<>(IngredientSortStage.class)),
168-
"Sorting order for the ingredient list."
119+
new ListSerializer<>(new EnumSerializer<>(IngredientSortStage.class))
169120
);
170121
recipeSorterStages = sorting.addList(
171-
"RecipeSorterStages",
122+
"recipeSorterStages",
172123
RecipeSorterStage.defaultStages,
173-
new ListSerializer<>(new EnumSerializer<>(RecipeSorterStage.class)),
174-
"Sorting order for displayed recipes."
175-
);
176-
177-
IConfigCategoryBuilder tags = schema.addCategory("tags");
178-
tagContentTooltipEnabled = tags.addBoolean(
179-
"TagContentTooltipEnabled",
180-
true,
181-
"Show tag content in tooltips."
182-
);
183-
hideSingleIngredientTagsEnabled = tags.addBoolean(
184-
"HideSingleIngredientTagsEnabled",
185-
true,
186-
"Hide tags that only have 1 ingredient."
124+
new ListSerializer<>(new EnumSerializer<>(RecipeSorterStage.class))
187125
);
188126
}
189127

@@ -237,8 +175,8 @@ public GiveMode getGiveMode() {
237175
}
238176

239177
@Override
240-
public boolean isShowHiddenItemsEnabled() {
241-
return showHiddenItemsEnabled.get();
178+
public boolean getShowHiddenIngredients() {
179+
return showHiddenIngredients.get();
242180
}
243181

244182
@Override
@@ -307,8 +245,8 @@ public boolean isTagContentTooltipEnabled() {
307245
}
308246

309247
@Override
310-
public boolean isHideSingleIngredientTagsEnabled() {
311-
return hideSingleIngredientTagsEnabled.get();
248+
public boolean getHideSingleTagContentTooltipEnabled() {
249+
return hideSingleTagContentTooltipEnabled.get();
312250
}
313251

314252
@Override

Common/src/main/java/mezz/jei/common/config/ConfigManager.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import mezz.jei.api.runtime.config.IJeiConfigFile;
44
import mezz.jei.api.runtime.config.IJeiConfigManager;
5+
import mezz.jei.common.config.file.ConfigSchema;
56
import org.jetbrains.annotations.Unmodifiable;
67

78
import java.nio.file.Path;
@@ -11,18 +12,22 @@
1112
import java.util.Map;
1213

1314
public class ConfigManager implements IJeiConfigManager {
14-
private final Map<Path, IJeiConfigFile> configFiles = new HashMap<>();
15+
private final Map<Path, ConfigSchema> configFiles = new HashMap<>();
1516

1617
public ConfigManager() {
1718

1819
}
1920

20-
public void registerConfigFile(IJeiConfigFile configFile) {
21+
public void registerConfigFile(ConfigSchema configFile) {
2122
this.configFiles.put(configFile.getPath(), configFile);
2223
}
2324

2425
@Override
2526
public @Unmodifiable Collection<IJeiConfigFile> getConfigFiles() {
2627
return Collections.unmodifiableCollection(configFiles.values());
2728
}
29+
30+
public void onJeiStarted() {
31+
configFiles.values().forEach(ConfigSchema::markDirty);
32+
}
2833
}

Common/src/main/java/mezz/jei/common/config/DebugConfig.java

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,12 @@ public static void create(IConfigSchemaBuilder schema) {
2323

2424
private DebugConfig(IConfigSchemaBuilder schema) {
2525
IConfigCategoryBuilder advanced = schema.addCategory("debug");
26-
debugModeEnabled = advanced.addBoolean(
27-
"DebugMode",
28-
false,
29-
"Debug mode enabled."
30-
);
31-
debugGuisEnabled = advanced.addBoolean(
32-
"DebugGuis",
33-
false,
34-
"Debug GUIs enabled."
35-
);
36-
debugInputsEnabled = advanced.addBoolean(
37-
"DebugInputs",
38-
false,
39-
"Debug inputs enabled."
40-
);
41-
debugInfoTooltipsEnabled = advanced.addBoolean(
42-
"debugInfoTooltipsEnabled",
43-
false,
44-
"Add debug information to ingredient tooltips when advanced tooltips are enabled."
45-
);
46-
crashingTestIngredientsEnabled = advanced.addBoolean(
47-
"CrashingTestItemsEnabled",
48-
false,
49-
"Adds ingredients to JEI that intentionally crash, to help debug JEI."
50-
);
51-
logSuffixTreeStats = advanced.addBoolean(
52-
"logSuffixTreeStats",
53-
false,
54-
"Log information about the suffix trees used for searching, to help debug JEI."
55-
);
26+
debugModeEnabled = advanced.addBoolean("debugMode", false);
27+
debugGuisEnabled = advanced.addBoolean("debugGuis", false);
28+
debugInputsEnabled = advanced.addBoolean("debugInputs", false);
29+
debugInfoTooltipsEnabled = advanced.addBoolean("debugInfoTooltipsEnabled", false);
30+
crashingTestIngredientsEnabled = advanced.addBoolean("crashingTestItemsEnabled", false);
31+
logSuffixTreeStats = advanced.addBoolean("logSuffixTreeStats", false);
5632
}
5733

5834
public static boolean isDebugModeEnabled() {

Common/src/main/java/mezz/jei/common/config/IClientConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public interface IClientConfig {
2424

2525
GiveMode getGiveMode();
2626

27-
boolean isShowHiddenItemsEnabled();
27+
boolean getShowHiddenIngredients();
2828

2929
List<BookmarkTooltipFeature> getBookmarkTooltipFeatures();
3030

@@ -48,7 +48,7 @@ public interface IClientConfig {
4848

4949
boolean isTagContentTooltipEnabled();
5050

51-
boolean isHideSingleIngredientTagsEnabled();
51+
boolean getHideSingleTagContentTooltipEnabled();
5252

5353
boolean isShowTagRecipesEnabled();
5454

Common/src/main/java/mezz/jei/common/config/IngredientFilterConfig.java

Lines changed: 11 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -21,61 +21,17 @@ public class IngredientFilterConfig implements IIngredientFilterConfig {
2121

2222
public IngredientFilterConfig(IConfigSchemaBuilder builder) {
2323
IConfigCategoryBuilder search = builder.addCategory("search");
24-
modNameSearchMode = search.addEnum(
25-
"ModNameSearchMode",
26-
SearchMode.REQUIRE_PREFIX,
27-
"Search mode for mod names (prefix: @)."
28-
);
29-
tooltipSearchMode = search.addEnum(
30-
"TooltipSearchMode",
31-
SearchMode.ENABLED,
32-
"Search mode for tooltips (prefix: #)."
33-
);
34-
tagSearchMode = search.addEnum(
35-
"TagSearchMode",
36-
SearchMode.REQUIRE_PREFIX,
37-
"Search mode for tags (prefix: $)."
38-
);
39-
colorSearchMode = search.addEnum(
40-
"ColorSearchMode",
41-
SearchMode.DISABLED,
42-
"Search mode for colors (prefix: ^)."
43-
);
44-
resourceLocationSearchMode = search.addEnum(
45-
"ResourceLocationSearchMode",
46-
SearchMode.DISABLED,
47-
"Search mode for resource locations (prefix: &)."
48-
);
49-
creativeTabSearchMode = search.addEnum(
50-
"CreativeTabSearchMode",
51-
SearchMode.DISABLED,
52-
"Search mode for creative mode tab names (prefix: %)."
53-
);
54-
searchAdvancedTooltips = search.addBoolean(
55-
"SearchAdvancedTooltips",
56-
false,
57-
"Search in advanced tooltips (visible with F3 + H)."
58-
);
59-
searchModIds = search.addBoolean(
60-
"SearchModIds",
61-
true,
62-
"Search mod IDs in addition to mod names."
63-
);
64-
searchModAliases = search.addBoolean(
65-
"SearchModAliases",
66-
true,
67-
"Search mod aliases (alternative names) that are added by plugins, in addition to mod names."
68-
);
69-
searchShortModNames = search.addBoolean(
70-
"SearchShortModNames",
71-
true,
72-
"Search by the shorthand first letters of a mod's name."
73-
);
74-
searchIngredientAliases = search.addBoolean(
75-
"SearchIngredientAliases",
76-
true,
77-
"Search ingredient aliases (alternative names) that are added by plugins, in addition to ingredient names."
78-
);
24+
modNameSearchMode = search.addEnum("modNameSearchMode", SearchMode.REQUIRE_PREFIX);
25+
tooltipSearchMode = search.addEnum("tooltipSearchMode", SearchMode.ENABLED);
26+
tagSearchMode = search.addEnum("tagSearchMode", SearchMode.REQUIRE_PREFIX);
27+
colorSearchMode = search.addEnum("colorSearchMode", SearchMode.DISABLED);
28+
resourceLocationSearchMode = search.addEnum("resourceLocationSearchMode", SearchMode.DISABLED);
29+
creativeTabSearchMode = search.addEnum("creativeTabSearchMode", SearchMode.DISABLED);
30+
searchAdvancedTooltips = search.addBoolean("searchAdvancedTooltips", false);
31+
searchModIds = search.addBoolean("searchModIds", true);
32+
searchModAliases = search.addBoolean("searchModAliases", true);
33+
searchShortModNames = search.addBoolean("searchShortModNames", false);
34+
searchIngredientAliases = search.addBoolean("searchIngredientAliases", true);
7935
}
8036

8137
@Override

0 commit comments

Comments
 (0)