Search in sources :

Example 11 with Module

use of mathax.client.systems.modules.Module in project Client by MatHax.

the class SettingArgumentType method getSetting.

public static Setting<?> getSetting(CommandContext<?> context) throws CommandSyntaxException {
    Module module = context.getArgument("module", Module.class);
    String settingName = context.getArgument("setting", String.class);
    Setting<?> setting = module.settings.get(settingName);
    if (setting == null)
        throw NO_SUCH_SETTING.create(settingName);
    return setting;
}
Also used : Module(mathax.client.systems.modules.Module)

Example 12 with Module

use of mathax.client.systems.modules.Module in project Client by MatHax.

the class ModuleArgumentType method parse.

@Override
public Module parse(StringReader reader) throws CommandSyntaxException {
    String argument = reader.readString();
    Module module = Modules.get().get(argument);
    if (module == null)
        throw NO_SUCH_MODULE.create(argument);
    return module;
}
Also used : Module(mathax.client.systems.modules.Module)

Example 13 with Module

use of mathax.client.systems.modules.Module in project Client by MatHax.

the class AutoEat method stopEating.

private void stopEating() {
    changeSlot(prevSlot);
    setPressed(false);
    eating = false;
    if (pauseAuras.get()) {
        for (Class<? extends Module> klass : AURAS) {
            Module module = Modules.get().get(klass);
            if (wasAura.contains(klass) && !module.isActive())
                module.toggle();
        }
    }
    if (pauseBaritone.get() && wasBaritone)
        BaritoneAPI.getProvider().getPrimaryBaritone().getCommandManager().execute("resume");
}
Also used : Module(mathax.client.systems.modules.Module)

Example 14 with Module

use of mathax.client.systems.modules.Module in project Client by MatHax.

the class ModulesScreen method createCategory.

// Category
protected WWindow createCategory(WContainer c, Category category) {
    WWindow w = theme.window(category.name);
    w.id = category.name;
    w.padding = 0;
    w.spacing = 0;
    if (theme.categoryIcons())
        w.beforeHeaderInit = wContainer -> wContainer.add(theme.item(category.icon.getDefaultStack())).pad(2);
    c.add(w);
    w.view.scrollOnlyWhenMouseOver = true;
    w.view.hasScrollBar = false;
    w.view.spacing = 0;
    for (Module module : Modules.get().getGroup(category)) {
        w.add(theme.module(module)).expandX();
    }
    return w;
}
Also used : Utils(mathax.client.utils.Utils) WVerticalList(mathax.client.gui.widgets.containers.WVerticalList) WWindow(mathax.client.gui.widgets.containers.WWindow) GuiTheme(mathax.client.gui.GuiTheme) Set(java.util.Set) Items(net.minecraft.item.Items) WContainer(mathax.client.gui.widgets.containers.WContainer) WSection(mathax.client.gui.widgets.containers.WSection) Tabs(mathax.client.gui.tabs.Tabs) ArrayList(java.util.ArrayList) Cell(mathax.client.gui.utils.Cell) List(java.util.List) WTextBox(mathax.client.gui.widgets.input.WTextBox) TabScreen(mathax.client.gui.tabs.TabScreen) NbtUtils(mathax.client.utils.misc.NbtUtils) Category(mathax.client.systems.modules.Category) Modules(mathax.client.systems.modules.Modules) Module(mathax.client.systems.modules.Module) WWindow(mathax.client.gui.widgets.containers.WWindow) Module(mathax.client.systems.modules.Module)

Example 15 with Module

use of mathax.client.systems.modules.Module in project Client by MatHax.

the class ModulesScreen method createSearch.

protected WWindow createSearch(WContainer c) {
    WWindow w = theme.window("Search");
    w.id = "search";
    if (theme.categoryIcons())
        w.beforeHeaderInit = wContainer -> wContainer.add(theme.item(Items.COMPASS.getDefaultStack())).pad(2);
    c.add(w);
    w.view.scrollOnlyWhenMouseOver = true;
    w.view.hasScrollBar = false;
    w.view.maxHeight -= 20;
    WVerticalList l = theme.verticalList();
    WTextBox text = w.add(theme.textBox("")).minWidth(140).expandX().widget();
    text.setFocused(true);
    text.action = () -> {
        l.clear();
        createSearchW(l, text.get());
    };
    text.actionOnEnter = () -> {
        Set<Module> modules = Modules.get().searchTitles(text.get());
        if (modules.size() != 1)
            return;
        Module target = modules.iterator().next();
        target.toggle();
    };
    w.add(l).expandX();
    createSearchW(l, text.get());
    return w;
}
Also used : Utils(mathax.client.utils.Utils) WVerticalList(mathax.client.gui.widgets.containers.WVerticalList) WWindow(mathax.client.gui.widgets.containers.WWindow) GuiTheme(mathax.client.gui.GuiTheme) Set(java.util.Set) Items(net.minecraft.item.Items) WContainer(mathax.client.gui.widgets.containers.WContainer) WSection(mathax.client.gui.widgets.containers.WSection) Tabs(mathax.client.gui.tabs.Tabs) ArrayList(java.util.ArrayList) Cell(mathax.client.gui.utils.Cell) List(java.util.List) WTextBox(mathax.client.gui.widgets.input.WTextBox) TabScreen(mathax.client.gui.tabs.TabScreen) NbtUtils(mathax.client.utils.misc.NbtUtils) Category(mathax.client.systems.modules.Category) Modules(mathax.client.systems.modules.Modules) Module(mathax.client.systems.modules.Module) WWindow(mathax.client.gui.widgets.containers.WWindow) WTextBox(mathax.client.gui.widgets.input.WTextBox) Module(mathax.client.systems.modules.Module) WVerticalList(mathax.client.gui.widgets.containers.WVerticalList)

Aggregations

Module (mathax.client.systems.modules.Module)29 Modules (mathax.client.systems.modules.Modules)7 ArrayList (java.util.ArrayList)5 List (java.util.List)5 SINGLE_SUCCESS (com.mojang.brigadier.Command.SINGLE_SUCCESS)4 LiteralArgumentBuilder (com.mojang.brigadier.builder.LiteralArgumentBuilder)4 WSection (mathax.client.gui.widgets.containers.WSection)4 Command (mathax.client.systems.commands.Command)4 Category (mathax.client.systems.modules.Category)4 CommandSource (net.minecraft.command.CommandSource)4 Set (java.util.Set)3 GuiTheme (mathax.client.gui.GuiTheme)3 TabScreen (mathax.client.gui.tabs.TabScreen)3 Tabs (mathax.client.gui.tabs.Tabs)3 Cell (mathax.client.gui.utils.Cell)3 WContainer (mathax.client.gui.widgets.containers.WContainer)3 WVerticalList (mathax.client.gui.widgets.containers.WVerticalList)3 WWindow (mathax.client.gui.widgets.containers.WWindow)3 WTextBox (mathax.client.gui.widgets.input.WTextBox)3 ModuleArgumentType (mathax.client.systems.commands.arguments.ModuleArgumentType)3