Skip to content
Merged
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 @@ -19,6 +19,8 @@
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.utils.misc.NbtUtils;
import net.minecraft.client.input.KeyInput;
import net.minecraft.client.util.MacWindowUtil;
import net.minecraft.item.Items;
import net.minecraft.util.Pair;

Expand All @@ -28,9 +30,12 @@

import static meteordevelopment.meteorclient.utils.Utils.getWindowHeight;
import static meteordevelopment.meteorclient.utils.Utils.getWindowWidth;
import static org.lwjgl.glfw.GLFW.*;

public class ModulesScreen extends TabScreen {
private WCategoryController controller;
private WWindow searchWindow;
private WTextBox searchTextBox;

public ModulesScreen(GuiTheme theme) {
super(theme, Tabs.get().getFirst());
Expand Down Expand Up @@ -115,6 +120,7 @@ protected void createSearchW(WContainer w, String text) {
protected WWindow createSearch(WContainer c) {
WWindow w = theme.window("Search");
w.id = "search";
searchWindow = w;

if (theme.categoryIcons()) {
w.beforeHeaderInit = wContainer -> wContainer.add(theme.item(Items.COMPASS.getDefaultStack())).pad(2);
Expand All @@ -129,6 +135,7 @@ protected WWindow createSearch(WContainer c) {

WTextBox text = w.add(theme.textBox("")).minWidth(140).expandX().widget();
text.setFocused(true);
searchTextBox = text;
text.action = () -> {
l.clear();
createSearchW(l, text.get());
Expand All @@ -140,6 +147,25 @@ protected WWindow createSearch(WContainer c) {
return w;
}

@Override
public boolean keyPressed(KeyInput value) {
if (locked) return false;

boolean cntrl = MacWindowUtil.IS_MAC ? value.modifiers() == GLFW_MOD_SUPER : value.modifiers() == GLFW_MOD_CONTROL;

if (cntrl && value.key() == GLFW_KEY_F) {
if (searchWindow != null) searchWindow.setExpanded(true);
if (searchTextBox != null) {
searchTextBox.setFocused(true);
searchTextBox.setCursorMax();
}

return true;
}

return super.keyPressed(value);
}

// Favorites

protected Cell<WWindow> createFavorites(WContainer c) {
Expand Down Expand Up @@ -193,7 +219,8 @@ public boolean fromClipboard() {
}

@Override
public void reload() {}
public void reload() {
}

// Stuff

Expand Down Expand Up @@ -227,8 +254,7 @@ protected void refresh() {
if (favorites == null) {
favorites = createFavorites(this);
if (favorites != null) windows.add(favorites.widget());
}
else {
} else {
favorites.widget().clear();

if (!createFavoritesW(favorites.widget())) {
Expand Down