Skip to content

Commit c2ce53d

Browse files
committed
Fix for Meteor build 4 (Make the search widget show module aliases in the search results)
1 parent fea4a34 commit c2ce53d

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

src/main/java/me/pindour/catpuccin/gui/screens/CatpuccinModulesScreen.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import meteordevelopment.meteorclient.utils.Utils;
2020
import meteordevelopment.meteorclient.utils.misc.NbtUtils;
2121
import net.minecraft.client.gui.DrawContext;
22+
import net.minecraft.util.Pair;
2223

2324
import java.util.ArrayList;
2425
import java.util.List;
@@ -116,30 +117,30 @@ protected WWindow createCategory(WContainer c, Category category, List<Module> m
116117
protected void createSearchW(WContainer w, String text) {
117118
if (!text.isEmpty()) {
118119
// Titles
119-
Set<Module> modules = Modules.get().searchTitles(text);
120+
List<Pair<Module, String>> modules = Modules.get().searchTitles(text);
120121

121122
if (!modules.isEmpty()) {
122123
WSection section = w.add(theme.section("Modules")).expandX().widget();
123124
section.spacing = 0;
124125

125126
int count = 0;
126-
for (Module module : modules) {
127+
for (Pair<Module, String> p : modules) {
127128
if (count >= Config.get().moduleSearchCount.get() || count >= modules.size()) break;
128-
section.add(theme.module(module)).expandX();
129+
section.add(theme.module(p.getLeft(), p.getRight())).expandX();
129130
count++;
130131
}
131132
}
132133

133134
// Settings
134-
modules = Modules.get().searchSettingTitles(text);
135+
Set<Module> settings = Modules.get().searchSettingTitles(text);
135136

136-
if (!modules.isEmpty()) {
137+
if (!settings.isEmpty()) {
137138
WSection section = w.add(theme.section("Settings")).expandX().widget();
138139
section.spacing = 0;
139140

140141
int count = 0;
141-
for (Module module : modules) {
142-
if (count >= Config.get().moduleSearchCount.get() || count >= modules.size()) break;
142+
for (Module module : settings) {
143+
if (count >= Config.get().moduleSearchCount.get() || count >= settings.size()) break;
143144
section.add(theme.module(module)).expandX();
144145
count++;
145146
}

src/main/java/me/pindour/catpuccin/gui/themes/catpuccin/CatpuccinGuiTheme.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,8 @@ public WAccount account(WidgetScreen screen, Account<?> account) {
374374
}
375375

376376
@Override
377-
public WWidget module(Module module) {
378-
return w(new WCatpuccinModule(module));
377+
public WWidget module(Module module, String title) {
378+
return w(new WCatpuccinModule(module, title));
379379
}
380380

381381
@Override

src/main/java/me/pindour/catpuccin/gui/themes/catpuccin/widgets/WCatpuccinModule.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
public class WCatpuccinModule extends WPressable implements CatpuccinWidget {
2222
private final Module module;
23+
private final String title;
2324

2425
private double titleWidth;
2526
private boolean wasHovered = false;
@@ -34,8 +35,9 @@ public class WCatpuccinModule extends WPressable implements CatpuccinWidget {
3435
private Color semiTransparentColor;
3536
private Color transparentColor;
3637

37-
public WCatpuccinModule(Module module) {
38+
public WCatpuccinModule(Module module, String title) {
3839
this.module = module;
40+
this.title = title;
3941
this.tooltip = module.description;
4042
}
4143

@@ -67,7 +69,7 @@ public double pad() {
6769
protected void onCalculateSize() {
6870
double pad = pad();
6971

70-
if (titleWidth == 0) titleWidth = theme.textWidth(module.title);
72+
if (titleWidth == 0) titleWidth = theme.textWidth(title);
7173

7274
width = pad + titleWidth + pad;
7375
height = pad + theme.textHeight() + pad;
@@ -161,6 +163,6 @@ protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, doub
161163

162164
// Text
163165
Color textColor = ColorUtils.interpolateColor(theme.textColor(), theme.baseColor(), highlightProgress);
164-
catpuccinRenderer().text(RichText.of(module.title), x, y + pad, textColor);
166+
catpuccinRenderer().text(RichText.of(title), x, y + pad, textColor);
165167
}
166168
}

0 commit comments

Comments
 (0)