Skip to content

Commit

Permalink
Added config option to disable custom item search
Browse files Browse the repository at this point in the history
  • Loading branch information
r8420 committed Aug 13, 2020
1 parent c63acd4 commit 7422c6e
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/main/java/at/feldim2425/moreoverlays/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class Config {
public static ForgeConfigSpec.IntValue render_spawnAColor;
public static ForgeConfigSpec.IntValue render_spawnNColor;
public static ForgeConfigSpec.DoubleValue render_spawnLineWidth;

public static ForgeConfigSpec.BooleanValue search_searchCustom;


public static void initialize() {
Expand Down Expand Up @@ -52,6 +54,10 @@ public static void initialize() {
render_spawnNColor = builder.comment("Color the X that marks \"Spawns at night possible\"").defineInRange("spawn_night_color", 0xFFFF00, 0, 0xFFFFFF);
render_spawnLineWidth = builder.comment("Line width for spawn indication").defineInRange("spawn_line_width", 2, 0, Double.MAX_VALUE);
builder.pop();

builder.comment("Settings for the search overlay").push("searchoverlay");
search_searchCustom = builder.comment("Also searches for the custom name of an item in user inventory (for example items named in anvil)\nSetting this to false will increase performance but will not find custom named items.").define("custom_search", true);
builder.pop();

config_client = builder.build();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package at.feldim2425.moreoverlays.itemsearch;

import java.util.Arrays;
import java.util.Map;

import com.google.common.collect.BiMap;
Expand All @@ -10,6 +11,7 @@

import at.feldim2425.moreoverlays.api.itemsearch.SlotHandler;
import at.feldim2425.moreoverlays.api.itemsearch.SlotViewWrapper;
import at.feldim2425.moreoverlays.config.Config;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
Expand Down Expand Up @@ -197,7 +199,7 @@ private void checkSlots(ContainerScreen<?> container) {
}

private boolean isSearchedItem(ItemStack stack) {
if(stack.getDisplayName().getString().toLowerCase().contains(JeiModule.getJEITextField().getText().toLowerCase())) {
if(Config.search_searchCustom.get() && Arrays.stream(JeiModule.getJEITextField().getText().toLowerCase().split(" ", -1)).anyMatch(stack.getDisplayName().getString().toLowerCase()::contains)) {
return true;
}
if (emptyFilter) return true;
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/moreoverlays/lang/de_de.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"config.moreoverlays.category.lightoverlay": "Licht-Overlay",
"config.moreoverlays.category.chunkbounds": "Chunk Grenzen",
"config.moreoverlays.category.itemsearch": "Item Suche",
"config.moreoverlays.category.searchoverlay": "Item Suche",
"config.moreoverlays.category.rendersettings" : "Render Einstellungen"
}
1 change: 1 addition & 0 deletions src/main/resources/assets/moreoverlays/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"config.moreoverlays.category.lightoverlay": "Lightoverlay",
"config.moreoverlays.category.chunkbounds": "Chunk bounds",
"config.moreoverlays.category.itemsearch": "Item Search",
"config.moreoverlays.category.searchoverlay": "Item Search",
"config.moreoverlays.category.rendersettings": "Render Settings"
}
3 changes: 2 additions & 1 deletion src/main/resources/assets/moreoverlays/lang/nl_nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
"key.moreoverlays.lightoverlay.desc": "Tonen/Verbergen Donkere Plekken",

"gui.config.moreoverlays.tile": "MoreOverlays Instellingen",
"gui.config.moreoverlays.reset_config": "Instellingen Resetten",
"gui.config.moreoverlays.reset_config": "Instellingen resetten",
"gui.config.moreoverlays.undo": "Wijzigingen resetten",
"gui.config.moreoverlays.save": "Opslaan",

"config.moreoverlays.category.lightoverlay": "Licht-Overlay",
"config.moreoverlays.category.chunkbounds": "Chunk Grenzen",
"config.moreoverlays.category.itemsearch": "Item Zoeken",
"config.moreoverlays.category.searchoverlay": "Item Zoeken",
"config.moreoverlays.category.rendersettings": "Render Instellingen"
}
1 change: 1 addition & 0 deletions src/main/resources/assets/moreoverlays/lang/ru_ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"config.moreoverlays.category.chunkbounds": "Границы чанков",
"config.moreoverlays.category.lightoverlay": "Метки темноты",
"config.moreoverlays.category.itemsearch": "Поиск предметов",
"config.moreoverlays.category.searchoverlay": "Поиск предметов",
"config.moreoverlays.category.rendersettings": "Настройки графики"
}

0 comments on commit 7422c6e

Please sign in to comment.