Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class ClientNetStorageSearchHelper
// TODO 等到有空的时候,我应该给IStackKeyRender加个接口,允许其产出无数量tooltip
private final Map<IStackKey<?>, List<String>> tooltipCache = new HashMap<>();
private final Map<IStackKey<?>, List<String>> tagCache = new HashMap<>();
private final Map<IStackKey<?>, String> itemIdCache = new HashMap<>();

public void loadTexts(@NotNull String text)
{
Expand Down Expand Up @@ -147,7 +148,7 @@ public boolean matches(@NotNull IStackKey<?> key)
* 单个 searchText:
* 1. 先按 | 拆分,多个部分按或合并
* 2. 每个部分可带 - 前缀表示取反
* 3. 再根据 @ / $ / # / 默认 选择匹配范围
* 3. 再根据 @ / $ / # / * / 默认 选择匹配范围
*/
private boolean matchesSingleSearchText(@NotNull KeyAmount keyAmount, @NotNull String searchText)
{
Expand Down Expand Up @@ -211,6 +212,11 @@ private boolean matchesSingleOrPart(@NotNull KeyAmount keyAmount, @NotNull Strin
needle = actual.substring(1);
matched = needle.isEmpty() || matchesTag(keyAmount, needle);
}
case '*' ->
{
needle = actual.substring(1);
matched = needle.isEmpty() || matchesItemId(keyAmount, needle);
}
default -> matched = matchesName(keyAmount, actual);
}

Expand Down Expand Up @@ -246,6 +252,11 @@ private boolean matchesTag(@NotNull KeyAmount keyAmount, @NotNull String needle)
return false;
}

private boolean matchesItemId(@NotNull KeyAmount keyAmount, @NotNull String needle)
{
return checkTextMatches(getItemId(keyAmount.key()), needle);
}

private boolean matchesName(@NotNull KeyAmount keyAmount, @NotNull String needle)
{
return checkTextMatches(getName(keyAmount.key()), needle);
Expand Down Expand Up @@ -295,6 +306,20 @@ else if (ModPresence.isLoaded(OtherModIds.JE_CHARACTERS))
k -> k.getModId().toLowerCase(Locale.ENGLISH));
}

private @NotNull String getItemId(@NotNull IStackKey<?> key)
{
return this.itemIdCache.computeIfAbsent(key,
k -> {
if (key instanceof com.wintercogs.beyonddimensions.api.storage.key.impl.ItemStackKey itemKey)
{
net.minecraft.resources.ResourceLocation registryName =
net.minecraft.core.registries.BuiltInRegistries.ITEM.getKey(itemKey.getSource());
return registryName.getPath().toLowerCase(Locale.ENGLISH);
}
return "";
});
}

private @NotNull List<String> getTags(@NotNull IStackKey<?> key)
{
return this.tagCache.computeIfAbsent(key,
Expand Down Expand Up @@ -332,6 +357,7 @@ public void clearDerivedCaches()
this.matchCache.clear();
this.nameCache.clear();
this.modidCache.clear();
this.itemIdCache.clear();
this.tooltipCache.clear();
this.tagCache.clear();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/beyonddimensions/lang/de_de.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"tooltip.button.beyonddimensions.sort_mode_stop": "Aktuell: Sortierung deaktiviert",
"tooltip.item.unstable_space_time.long_data": "Raumzeit stabilisiert sich noch, %s Stabilisierungszyklen benötigt. Bitte stets bei sich tragen.",
"tooltip.beyonddimensions.item.xp_exchange": "In der Hand: Rechtsklick öffnet die Einstellungen\nIn Lager-GUIs: Rechtsklick speichert XP, Mittelklick ruft XP ab",
"tooltip.editbox.beyonddimensions.search": "Gib Text ein, um nach Namen zu suchen\nGib '@' ein, um Mod-IDs zu filtern\nGib '$' ein, um Tooltip-Inhalte zu filtern\nGib '#' ein, um Tags zu filtern\nTrenne mehrere Filter mit Leerzeichen; mit Anführungszeichen kannst du Leerzeichen suchen\nVerwende '|' für ODER-Treffer und '-' zum Ausschließen von Treffern\nDrücke Shift+Z, um die Verknüpfung mit dem JEI/EMI-Suchfeld umzuschalten",
"tooltip.editbox.beyonddimensions.search": "Gib Text ein, um nach Namen zu suchen\nGib '@' ein, um Mod-IDs zu filtern\nGib '$' ein, um Tooltip-Inhalte zu filtern\nGib '#' ein, um Tags zu filtern\nGib '*' ein, um Gegenstands-IDs zu filtern\nTrenne mehrere Filter mit Leerzeichen; mit Anführungszeichen kannst du Leerzeichen suchen\nVerwende '|' für ODER-Treffer und '-' zum Ausschließen von Treffern\nDrücke Shift+Z, um die Verknüpfung mit dem JEI/EMI-Suchfeld umzuschalten",
"tooltip.editbox.beyonddimensions.xp_exchange_target_level": "Gib die XP-Stufe ein, die gehalten oder für manuellen Austausch verwendet werden soll\nWerte über dem Limit werden automatisch begrenzt",
"tooltip.button.beyonddimensions.xp_exchange.keep_mode_working": "Aktuell: Aktiv (hält die Zielstufe automatisch)",
"tooltip.button.beyonddimensions.xp_exchange.keep_mode_not_working": "Aktuell: Inaktiv (nur manueller Austausch)",
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/beyonddimensions/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"tooltip.button.beyonddimensions.sort_mode_stop": "Current: Auto-sort disabled",
"tooltip.item.unstable_space_time.long_data": "Spacetime is stabilizing, requires %s more stabilization cycles. Please keep it on your person.",
"tooltip.beyonddimensions.item.xp_exchange": "When held: Right-click to open settings\nIn storage GUIs: Right-click to store XP, Middle-click to retrieve XP",
"tooltip.editbox.beyonddimensions.search": "Type text to search by name\nType '@' to filter mod IDs\nType '$' to filter tooltip contents\nType '#' to filter tags\nUse spaces to separate multiple filters; wrap in quotes to search spaces\nUse '|' for OR matches and '-' to exclude matches\nPress Shift+Z to toggle JEI/EMI search box linking",
"tooltip.editbox.beyonddimensions.search": "Type text to search by name\nType '@' to filter mod IDs\nType '$' to filter tooltip contents\nType '#' to filter tags\nType '*' to filter item IDs\nUse spaces to separate multiple filters; wrap in quotes to search spaces\nUse '|' for OR matches and '-' to exclude matches\nPress Shift+Z to toggle JEI/EMI search box linking",
"tooltip.editbox.beyonddimensions.xp_exchange_target_level": "Enter the XP level to keep or use for manual exchange\nValues above the limit are clamped automatically",
"tooltip.button.beyonddimensions.xp_exchange.keep_mode_working": "Current: Working (actively keeps target level)",
"tooltip.button.beyonddimensions.xp_exchange.keep_mode_not_working": "Current: Not Working (manual exchange only)",
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/beyonddimensions/lang/es_es.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"tooltip.button.beyonddimensions.sort_mode_stop": "Actual: Orden automático desactivado",
"tooltip.item.unstable_space_time.long_data": "El espacio-tiempo aún se estabiliza, faltan %s ciclos. Por favor, llévalo siempre contigo.",
"tooltip.beyonddimensions.item.xp_exchange": "Al sostenerlo: clic derecho para abrir la configuración\nEn GUIs de almacenamiento: clic derecho para guardar XP, clic central para recuperar XP",
"tooltip.editbox.beyonddimensions.search": "Escribe texto para buscar por nombre\nEscribe '@' para filtrar IDs de mods\nEscribe '$' para filtrar el contenido de los tooltips\nEscribe '#' para filtrar etiquetas\nSepara varios filtros con espacios; usa comillas para buscar espacios\nUsa '|' para coincidencias OR y '-' para excluir coincidencias\nPulsa Shift+Z para alternar el enlace con la caja de búsqueda JEI/EMI",
"tooltip.editbox.beyonddimensions.search": "Escribe texto para buscar por nombre\nEscribe '@' para filtrar IDs de mods\nEscribe '$' para filtrar el contenido de los tooltips\nEscribe '#' para filtrar etiquetas\nEscribe '*' para filtrar IDs de objetos\nSepara varios filtros con espacios; usa comillas para buscar espacios\nUsa '|' para coincidencias OR y '-' para excluir coincidencias\nPulsa Shift+Z para alternar el enlace con la caja de búsqueda JEI/EMI",
"tooltip.editbox.beyonddimensions.xp_exchange_target_level": "Introduce el nivel de XP que quieres mantener o usar para el intercambio manual\nLos valores por encima del límite se ajustan automáticamente",
"tooltip.button.beyonddimensions.xp_exchange.keep_mode_working": "Actual: Funcionando (mantiene activamente el nivel objetivo)",
"tooltip.button.beyonddimensions.xp_exchange.keep_mode_not_working": "Actual: Sin funcionar (solo intercambio manual)",
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/beyonddimensions/lang/fr_fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"tooltip.button.beyonddimensions.sort_mode_stop": "Actuel : Tri auto. désactivé",
"tooltip.item.unstable_space_time.long_data": "L'espace-temps se stabilise encore, %s cycles requis. Gardez-le sur vous en permanence.",
"tooltip.beyonddimensions.item.xp_exchange": "En main : clic droit pour ouvrir les paramètres\nDans les interfaces de stockage : clic droit pour stocker l'XP, clic milieu pour récupérer l'XP",
"tooltip.editbox.beyonddimensions.search": "Saisissez du texte pour rechercher par nom\nSaisissez '@' pour filtrer les IDs des mods\nSaisissez '$' pour filtrer le contenu des infobulles\nSaisissez '#' pour filtrer les tags\nSéparez plusieurs filtres par des espaces ; utilisez des guillemets pour rechercher des espaces\nUtilisez '|' pour une correspondance OU et '-' pour exclure une correspondance\nAppuyez sur Maj+Z pour activer/désactiver le lien avec la barre de recherche JEI/EMI",
"tooltip.editbox.beyonddimensions.search": "Saisissez du texte pour rechercher par nom\nSaisissez '@' pour filtrer les IDs des mods\nSaisissez '$' pour filtrer le contenu des infobulles\nSaisissez '#' pour filtrer les tags\nSaisissez '*' pour filtrer les ID d'objets\nSéparez plusieurs filtres par des espaces ; utilisez des guillemets pour rechercher des espaces\nUtilisez '|' pour une correspondance OU et '-' pour exclure une correspondance\nAppuyez sur Maj+Z pour activer/désactiver le lien avec la barre de recherche JEI/EMI",
"tooltip.editbox.beyonddimensions.xp_exchange_target_level": "Entrez le niveau d'XP à maintenir ou à utiliser pour l'échange manuel\nLes valeurs au-dessus de la limite sont réduites automatiquement",
"tooltip.button.beyonddimensions.xp_exchange.keep_mode_working": "Actuel : En marche (maintient activement le niveau cible)",
"tooltip.button.beyonddimensions.xp_exchange.keep_mode_not_working": "Actuel : À l'arrêt (échange manuel uniquement)",
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/beyonddimensions/lang/ja_jp.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"tooltip.button.beyonddimensions.sort_mode_stop": "現在:自動整頓OFF",
"tooltip.item.unstable_space_time.long_data": "時空は安定化中、残り%s回の安定化サイクルが必要です。常に携帯してください。",
"tooltip.beyonddimensions.item.xp_exchange": "手に持った状態:右クリックで設定を開く\nストレージGUI内:右クリックで経験値を保存、中クリックで経験値を取り出す",
"tooltip.editbox.beyonddimensions.search": "テキストを入力して名前で検索\n'@'を入力してMod IDを絞り込み\n'$'を入力してツールチップ内容を絞り込み\n'#'を入力してタグを絞り込み\n複数のフィルターはスペースで区切り、スペースを含む文字は引用符で囲って検索\n'|'でOR検索、'-'で除外検索\nShift+ZでJEI/EMI検索ボックス連動を切り替え",
"tooltip.editbox.beyonddimensions.search": "テキストを入力して名前で検索\n'@'を入力してMod IDを絞り込み\n'$'を入力してツールチップ内容を絞り込み\n'#'を入力してタグを絞り込み\n'*'を入力してアイテムIDを絞り込み\n複数のフィルターはスペースで区切り、スペースを含む文字は引用符で囲って検索\n'|'でOR検索、'-'で除外検索\nShift+ZでJEI/EMI検索ボックス連動を切り替え",
"tooltip.editbox.beyonddimensions.xp_exchange_target_level": "維持または手動交換に使う経験値レベルを入力\n上限を超える値は自動で制限されます",
"tooltip.button.beyonddimensions.xp_exchange.keep_mode_working": "現在:動作中(目標レベルを維持)",
"tooltip.button.beyonddimensions.xp_exchange.keep_mode_not_working": "現在:停止中(手動交換のみ)",
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/beyonddimensions/lang/ko_kr.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"tooltip.button.beyonddimensions.sort_mode_stop": "현재: 자동 정렬 비활성화됨",
"tooltip.item.unstable_space_time.long_data": "시공간 안정화 중, %s회의 안정화 주기 남음. 항상 휴대하십시오.",
"tooltip.beyonddimensions.item.xp_exchange": "손에 들었을 때: 우클릭으로 설정 열기\n저장 GUI에서: 우클릭으로 XP 저장, 휠 클릭으로 XP 회수",
"tooltip.editbox.beyonddimensions.search": "텍스트를 입력해 이름으로 검색\n'@'를 입력해 모드 ID 필터링\n'$'를 입력해 툴팁 내용 필터링\n'#'를 입력해 태그 필터링\n여러 필터는 공백으로 구분하고, 공백 문자를 검색하려면 따옴표로 감싸기\n'|'는 OR 매칭, '-'는 매칭 제외\nShift+Z를 눌러 JEI/EMI 검색창 연동 전환",
"tooltip.editbox.beyonddimensions.search": "텍스트를 입력해 이름으로 검색\n'@'를 입력해 모드 ID 필터링\n'$'를 입력해 툴팁 내용 필터링\n'#'를 입력해 태그 필터링\n'*'를 입력해 아이템 ID 필터링\n여러 필터는 공백으로 구분하고, 공백 문자를 검색하려면 따옴표로 감싸기\n'|'는 OR 매칭, '-'는 매칭 제외\nShift+Z를 눌러 JEI/EMI 검색창 연동 전환",
"tooltip.editbox.beyonddimensions.xp_exchange_target_level": "유지하거나 수동 교환에 사용할 XP 레벨을 입력하세요\n한도를 넘는 값은 자동으로 제한됩니다",
"tooltip.button.beyonddimensions.xp_exchange.keep_mode_working": "현재: 작업 중 (목표 레벨을 적극 유지)",
"tooltip.button.beyonddimensions.xp_exchange.keep_mode_not_working": "현재: 작업 안 함 (수동 교환만)",
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/beyonddimensions/lang/pt_br.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"tooltip.button.beyonddimensions.sort_mode_stop": "Atual: Ordenação automática desativada",
"tooltip.item.unstable_space_time.long_data": "O espaço-tempo está estabilizando, faltam %s ciclos. Mantenha-o sempre com você.",
"tooltip.beyonddimensions.item.xp_exchange": "Segurando: Botão direito abre as configurações\nEm GUIs de armazenamento: Botão direito para guardar XP, Botão do meio para recuperar XP",
"tooltip.editbox.beyonddimensions.search": "Digite texto para pesquisar por nome\nDigite '@' para filtrar IDs de mods\nDigite '$' para filtrar conteúdo de tooltips\nDigite '#' para filtrar tags\nSepare vários filtros com espaços; use aspas para pesquisar caracteres de espaço\nUse '|' para correspondência OU e '-' para excluir correspondências\nPressione Shift+Z para alternar a vinculação da caixa de pesquisa JEI/EMI",
"tooltip.editbox.beyonddimensions.search": "Digite texto para pesquisar por nome\nDigite '@' para filtrar IDs de mods\nDigite '$' para filtrar conteúdo de tooltips\nDigite '#' para filtrar tags\nDigite '*' para filtrar IDs de itens\nSepare vários filtros com espaços; use aspas para pesquisar caracteres de espaço\nUse '|' para correspondência OU e '-' para excluir correspondências\nPressione Shift+Z para alternar a vinculação da caixa de pesquisa JEI/EMI",
"tooltip.editbox.beyonddimensions.xp_exchange_target_level": "Digite o nível de XP para manter ou usar na troca manual\nValores acima do limite são reduzidos automaticamente",
"tooltip.button.beyonddimensions.xp_exchange.keep_mode_working": "Atual: Trabalhando (mantém o nível alvo ativamente)",
"tooltip.button.beyonddimensions.xp_exchange.keep_mode_not_working": "Atual: Não trabalhando (apenas troca manual)",
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/beyonddimensions/lang/ru_ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"tooltip.button.beyonddimensions.sort_mode_stop": "Текущий: Автосортировка отключена",
"tooltip.item.unstable_space_time.long_data": "Пространство-время стабилизируется, осталось %s циклов. Носите с собой постоянно.",
"tooltip.beyonddimensions.item.xp_exchange": "В руке: ПКМ открывает настройки\nВ интерфейсах хранилища: ПКМ - сохранить опыт, СКМ - извлечь опыт",
"tooltip.editbox.beyonddimensions.search": "Введите текст для поиска по имени\nВведите '@', чтобы фильтровать ID модов\nВведите '$', чтобы фильтровать содержимое подсказок\nВведите '#', чтобы фильтровать теги\nРазделяйте несколько фильтров пробелами; используйте кавычки для поиска пробелов\nИспользуйте '|' для совпадения по ИЛИ, а '-' для исключения совпадений\nНажмите Shift+Z для переключения привязки к строке поиска JEI/EMI",
"tooltip.editbox.beyonddimensions.search": "Введите текст для поиска по имени\nВведите '@', чтобы фильтровать ID модов\nВведите '$', чтобы фильтровать содержимое подсказок\nВведите '#', чтобы фильтровать теги\nВведите '*', чтобы фильтровать ID предметов\nРазделяйте несколько фильтров пробелами; используйте кавычки для поиска пробелов\nИспользуйте '|' для совпадения по ИЛИ, а '-' для исключения совпадений\nНажмите Shift+Z для переключения привязки к строке поиска JEI/EMI",
"tooltip.editbox.beyonddimensions.xp_exchange_target_level": "Введите уровень опыта для поддержания или ручного обмена\nЗначения выше лимита автоматически ограничиваются",
"tooltip.button.beyonddimensions.xp_exchange.keep_mode_working": "Текущий: Работает (активно поддерживает целевой уровень)",
"tooltip.button.beyonddimensions.xp_exchange.keep_mode_not_working": "Текущий: Не работает (только ручной обмен)",
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/beyonddimensions/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"tooltip.button.beyonddimensions.sort_mode_stop": "当前:自动整理关闭",
"tooltip.item.unstable_space_time.long_data": "时空仍在稳定中,仍需%s个稳定周期,请保持随身携带",
"tooltip.beyonddimensions.item.xp_exchange": "手持时:右键打开设置界面\n在仓库GUI中:右键存入经验,中键取出经验",
"tooltip.editbox.beyonddimensions.search": "输入文本以按名称搜索\n输入'@'以筛选模组ID\n输入'$'以筛选提示框内容\n输入'#'以筛选标签\n按空格分割多个筛选字段,使用引号包裹可搜索空格字符\n使用'|'可进行或匹配,使用'-'可排除匹配\n按Shift+Z以开关JEI/EMI搜索框联动",
"tooltip.editbox.beyonddimensions.search": "输入文本以按名称搜索\n输入'@'以筛选模组ID\n输入'$'以筛选提示框内容\n输入'#'以筛选标签\n输入'*'以筛选物品ID\n按空格分割多个筛选字段,使用引号包裹可搜索空格字符\n使用'|'可进行或匹配,使用'-'可排除匹配\n按Shift+Z以开关JEI/EMI搜索框联动",
"tooltip.editbox.beyonddimensions.xp_exchange_target_level": "输入要维持或手动交互的经验等级\n超过上限时会自动回限",
"tooltip.button.beyonddimensions.xp_exchange.keep_mode_working": "当前:工作(主动维持设定等级)",
"tooltip.button.beyonddimensions.xp_exchange.keep_mode_not_working": "当前:不工作(仅手动交互)",
Expand Down
Loading