Skip to content

Commit

Permalink
Only highlight packs if corresponding matches are enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Antikyth committed Oct 17, 2023
1 parent 0b5aaf0 commit fdb4197
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public abstract class ResourcePackEntryMixin extends AlwaysSelectedEntryListWidg
target = "Lnet/minecraft/client/gui/screen/pack/PackListWidget$ResourcePackEntry;displayName:Lnet/minecraft/text/OrderedText;"
))
private OrderedText highlightDisplayName(OrderedText displayName) {
if (displayName == null) return null;
if (!enabled() || displayName == null) return displayName;

return this.displayNameMatchManager.getHighlightedText(displayName, this.query);
}
Expand All @@ -71,7 +71,7 @@ private OrderedText highlightDisplayName(OrderedText displayName) {
target = "Lnet/minecraft/client/gui/screen/pack/PackListWidget$ResourcePackEntry;description:Lnet/minecraft/client/font/MultilineText;"
))
private MultilineText highlightDescription(MultilineText description) {
if (description == null) return null;
if (!highlightDescriptions() || description == null) return description;

// If we can't get the lines of text then we can't highlight the text.
if (!(description instanceof MultilineTextLinesAccessor multilineText)) return description;
Expand Down Expand Up @@ -106,4 +106,9 @@ private static boolean enabled() {
return SearchableConfig.INSTANCE.select_packs_screen.add_search.value()
&& SearchableConfig.INSTANCE.highlight_matches.value();
}

@Unique
private static boolean highlightDescriptions() {
return enabled() && SearchableConfig.INSTANCE.select_packs_screen.match_descriptions.value();
}
}

0 comments on commit fdb4197

Please sign in to comment.