Search in sources :

Example 21 with Module

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

the class ModuleListSetting method parseImpl.

@Override
protected List<Module> parseImpl(String str) {
    String[] values = str.split(",");
    List<Module> modules = new ArrayList<>(values.length);
    try {
        for (String value : values) {
            Module module = Modules.get().get(value.trim());
            if (module != null)
                modules.add(module);
        }
    } catch (Exception ignored) {
    }
    return modules;
}
Also used : ArrayList(java.util.ArrayList) NbtString(net.minecraft.nbt.NbtString) Module(mathax.client.systems.modules.Module)

Example 22 with Module

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

the class AutoPot method stopSplashing.

private void stopSplashing() {
    changeSlot(prevSlot);
    setPressed(false);
    if (pitched) {
        if (previousPitch.get())
            mc.player.setPitch(prevPitch);
        else
            mc.player.setPitch(stoppedPitch.get().floatValue());
        pitched = false;
    }
    splashing = false;
    if (pauseAuras.get()) {
        for (Class<? extends Module> klass : AURA_LIST) {
            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 23 with Module

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

the class AutoPot method startSplashing.

private void startSplashing() {
    prevSlot = mc.player.getInventory().selectedSlot;
    if (rotate.get()) {
        switch(rotateMode.get()) {
            case Server:
                Rotations.rotate(mc.player.getYaw(), splashingPitch.get().floatValue());
                splash();
            case Client:
                if (mc.player.getPitch() != splashingPitch.get().floatValue())
                    prevPitch = mc.player.getPitch();
                pitched = true;
                mc.player.setPitch(splashingPitch.get().floatValue());
                splash();
        }
    }
    splash();
    wasAura.clear();
    if (pauseAuras.get()) {
        for (Class<? extends Module> klass : AURA_LIST) {
            Module module = Modules.get().get(klass);
            if (module.isActive()) {
                wasAura.add(klass);
                module.toggle();
            }
        }
    }
    wasBaritone = false;
    if (pauseBaritone.get() && BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().isPathing()) {
        wasBaritone = true;
        BaritoneAPI.getProvider().getPrimaryBaritone().getCommandManager().execute("pause");
    }
}
Also used : Module(mathax.client.systems.modules.Module)

Example 24 with Module

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

the class ResetCommand method build.

@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
    builder.then(literal("settings").then(argument("module", ModuleArgumentType.module()).executes(context -> {
        Module module = context.getArgument("module", Module.class);
        module.settings.forEach(group -> group.forEach(Setting::reset));
        module.info("Reset all settings.");
        return SINGLE_SUCCESS;
    })).then(literal("all").executes(context -> {
        Modules.get().getAll().forEach(module -> module.settings.forEach(group -> group.forEach(Setting::reset)));
        info("Reset all module settings.");
        return SINGLE_SUCCESS;
    }))).then(literal("gui").executes(context -> {
        GuiThemes.get().clearWindowConfigs();
        info("The Click GUI positioning has been reset.");
        return SINGLE_SUCCESS;
    }).then(literal("scale").executes(context -> {
        GuiThemes.get().resetScale();
        info("The GUI scale has been reset.");
        return SINGLE_SUCCESS;
    }))).then(literal("bind").then(argument("module", ModuleArgumentType.module()).executes(context -> {
        Module module = context.getArgument("module", Module.class);
        module.keybind.set(true, -1);
        module.info("Reset bind.");
        return SINGLE_SUCCESS;
    })).then(literal("all").executes(context -> {
        Modules.get().getAll().forEach(module -> module.keybind.set(true, -1));
        info("Reset all binds.");
        return SINGLE_SUCCESS;
    }))).then(literal("hud").executes(context -> {
        Systems.get(HUD.class).reset.run();
        ChatUtils.info("HUD", "Reset all elements.");
        return SINGLE_SUCCESS;
    }));
}
Also used : CommandSource(net.minecraft.command.CommandSource) SINGLE_SUCCESS(com.mojang.brigadier.Command.SINGLE_SUCCESS) Setting(mathax.client.settings.Setting) Systems(mathax.client.systems.Systems) GuiThemes(mathax.client.gui.GuiThemes) ChatUtils(mathax.client.utils.misc.ChatUtils) Modules(mathax.client.systems.modules.Modules) Command(mathax.client.systems.commands.Command) Module(mathax.client.systems.modules.Module) HUD(mathax.client.systems.hud.HUD) LiteralArgumentBuilder(com.mojang.brigadier.builder.LiteralArgumentBuilder) ModuleArgumentType(mathax.client.systems.commands.arguments.ModuleArgumentType) HUD(mathax.client.systems.hud.HUD) Module(mathax.client.systems.modules.Module)

Example 25 with Module

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

the class BindsCommand method build.

@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
    builder.executes(context -> {
        // Modules
        List<Module> modules = Modules.get().getAll().stream().filter(module -> module.keybind.isSet()).collect(Collectors.toList());
        info("--- Bound Modules ((highlight)%d(default)) ---", modules.size());
        for (Module module : modules) {
            HoverEvent hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, getTooltip(module));
            MutableText text = new LiteralText(module.title).formatted(Formatting.WHITE);
            text.setStyle(text.getStyle().withHoverEvent(hoverEvent));
            MutableText sep = new LiteralText(" - ");
            sep.setStyle(sep.getStyle().withHoverEvent(hoverEvent));
            text.append(sep.formatted(Formatting.GRAY));
            MutableText key = new LiteralText(module.keybind.toString());
            key.setStyle(key.getStyle().withHoverEvent(hoverEvent));
            text.append(key.formatted(Formatting.GRAY));
            ChatUtils.sendMsg(text);
        }
        return SINGLE_SUCCESS;
    });
}
Also used : LiteralText(net.minecraft.text.LiteralText) ChatUtils(mathax.client.utils.misc.ChatUtils) HoverEvent(net.minecraft.text.HoverEvent) Collectors(java.util.stream.Collectors) LiteralArgumentBuilder(com.mojang.brigadier.builder.LiteralArgumentBuilder) CommandSource(net.minecraft.command.CommandSource) SINGLE_SUCCESS(com.mojang.brigadier.Command.SINGLE_SUCCESS) Formatting(net.minecraft.util.Formatting) List(java.util.List) Modules(mathax.client.systems.modules.Modules) MutableText(net.minecraft.text.MutableText) Command(mathax.client.systems.commands.Command) Module(mathax.client.systems.modules.Module) MutableText(net.minecraft.text.MutableText) HoverEvent(net.minecraft.text.HoverEvent) Module(mathax.client.systems.modules.Module) LiteralText(net.minecraft.text.LiteralText)

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